-
Notifications
You must be signed in to change notification settings - Fork 335
Кодгайд Академии по 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
Conversation
…е практики в коде
|
||
### Объявление функций | ||
'no-func-assign': 'error', | ||
- Функции объявляются как функциональные выражения, а не определения функций. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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'). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется здесь diff
не уместен
пробелов сделает отступ неотличимым при быстром чтении кода от отступа | ||
у вложенного блока. | ||
|
||
```diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется здесь diff
не уместен
|
||
Такой же перенос можно использовать в проверке условий (`if`, `while`). | ||
|
||
```diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется здесь diff
не уместен
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется ```diff не очень уместен
Формализация правил из ESLint'a академии в виде внятных объяснений, почему используется то или иное правило.