Skip to content

Кодгайд Академии по JS #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 7, 2017

Conversation

o0
Copy link
Contributor

@o0 o0 commented Feb 22, 2017

Формализация правил из ESLint'a академии в виде внятных объяснений, почему используется то или иное правило.


### Объявление функций
'no-func-assign': 'error',
- Функции объявляются как функциональные выражения, а не определения функций.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это правило про то, что если у тебя есть вот такая функция:

function myFunc() {};

и ты присваиваешь переменно myFunc что-то другое, то это скорее всего ошибка:

myFunc  = {name: 'Вот такое вот говно'};

#### Блоки кода отделяются двумя пробелами
Код внутри блока отбивается двумя пробелами относительно начала блока.
Правило работает даже внутри кода с другим отступом.
```diff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется здесь diff не уместен

```

```diff
+ document.querySelectorAll('button').
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется здесь diff не уместен

пробелов сделает отступ неотличимым при быстром чтении кода от отступа
у вложенного блока.

```diff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется здесь diff не уместен


Такой же перенос можно использовать в проверке условий (`if`, `while`).

```diff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется здесь diff не уместен

Copy link

@zeckson zeckson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется ```diff не очень уместен

@juwain juwain changed the base branch from master to feature/total-destructuration July 7, 2017 13:28
@juwain juwain merged commit 4f525b6 into feature/total-destructuration Jul 7, 2017
@juwain juwain deleted the feature/js-codeguide branch July 7, 2017 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants