-
Notifications
You must be signed in to change notification settings - Fork 334
Выпиливает всю сборку, оставляет только статику #13
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
…е практики в коде
o0
left a comment
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.
Еще где-то видел забытую инструкцию ESLint и вообще надо причесать. Я займусь!
| <ul> | ||
| <li> | ||
| <a href="html-css.html"> | ||
| <img src="img/logo-html.svg" alt="Логотип HTML"> |
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.
HTML?
| </li> | ||
| <li> | ||
| <a href="javascript.html"> | ||
| <img src="img/logo-js.svg" alt="Логотип JavaScript"> |
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.
JavaScript? Это же нужно для читалок, прикинь человек останавливается на ссылке, которая ведет на гайд по JS, а читалка ему «логотип JS»
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.
Что-то мне стало казаться, что надо вообще выкинуть эту страницу. Будет две страницы: кодгайд по HTML/CSS и по Javascript. С обеих страниц будут ссылки друг на друга. Получается разводящей страницы не нужно (по крайней мере пока кодгайдов не стало много).
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.
Не знаю, я б оставил;)
javascript.html
Outdated
| <li>Внутри строки не используется более одного пробела.</li> | ||
|
|
||
| <li>Открывающие скобки блоков кода находятся на одной строке с оператором, которых их использует:<pre class="language-js"><code> | ||
| - if (condition) |
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 из-за встроенной подсветки зелененьким и красненьким. Если у нас получилось что мы просто используем синтаксис js и ---, +++, то я переделаю на блоки с разным цветом.
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.
Не, не надо, я тут подумал, что JS с разным фоном будет лучше. 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.
Окей
javascript.html
Outdated
|
|
||
| <li>В операторе <code>switch</code> запрещено дублировать условия (case)</li> | ||
|
|
||
| <h4>Массивы</h4> |
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.
Ой 🙊 Надо что-то сюда написать или убрать заголовок.
|
@zeckson читани пожалуйста файл |
|
Надо md закилять или синхронизировать |
|
Закилято! |
| @@ -0,0 +1,218 @@ | |||
| # Стиль кода JS | |||
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.
Почему это не удалено?
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.
Потому что это то, что будет основной версией.
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.
Не понял. А остальные md? Или о чем это? Это что-то другое?
|
|
||
| ## Форматирование | ||
| ### Строка не должна быть длиннее 80 символов | ||
| Строки более 80 символов длиной, снижают скорость чтения заставляя читатаеля |
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.
Пруф или не было!
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.
Оке, я поищу
| в разного рода презентациях, что увеличивает требования к читаемости кода | ||
|
|
||
| ### Выравнивание знаков равенства запрещено | ||
| Трудоемкий и очень хрупкий процесс. Если хотя бы одна из переменных |
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.
Если хотя бы одна из переменных что? Аааааа!!! Интрига!
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.
Тут надо просто показать пример.
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.
А дописать предложение? Например, давайте разберем на примере: — нельзя же так обрывать предложение на пол-фразе
| + }, true); | ||
| ``` | ||
|
|
||
| #### Аргументы функций и вызовы через цепчку отделяются четырьмя пробелами |
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.
У нас в eslint двумя. Настало время определиться:
'indent': ['error', 2, {
SwitchCase: 1,
// continuation indent
VariableDeclarator: 1, // indent is multiplier * indent = 1 * 2
MemberExpression: 2, // indent is multiplier * indent = 1 * 2
FunctionDeclaration: {parameters: 2},
FunctionExpression: {parameters: 2},
CallExpression: {arguments: 2}
}],
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.
Как тебе нравится?
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.
Мне, если честно всё равно я нажимаю заветную комбинацию клавиш и просто об этом не думаю. Нужно просто синхронизировать этот документ и eslint
| + 'base-class--collapsed', this.isCollapsed())} /> | ||
| ``` | ||
|
|
||
| #### Альтернативный способ переносить аргументы — выравнивать их с открывающей скобкой |
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.
Хмммм...
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.
Java-Java.
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.
Java-Java.
Автореформаттеры ломают такой способ
| Правила с переносом оператора хорошо работают в языках, где необязательно | ||
| удалять забытые запятые в конце спиков. Но даже в этом случае быстрое удаление | ||
| и сортировка строк не будут работать, потому у списков будет отличаться первая | ||
| строка, а у чейнов — последняя и после сортировки и удаления нужно перепроверить |
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.
последняя и после сортировки и удаления нужно перепроверить получившийся список на валидность.
это про что?
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.
я когда писал так ощущал, а теперь не думаю вообще, что перенос точки проблема. Даже грешным делом начал подумывать удалить и разрешить все это безобразие. Как ты думаешь?
| + template.chilren[0].cloneNode(true); | ||
| ``` | ||
|
|
||
| ## Правила языка |
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.
Уточнить — для ES без модулей
| объявляется в локальной области видимости и в этом случае ее объявление | ||
| не должно затрагивать всю область видимости. | ||
|
|
||
| Положительный побочный эффект такого стиля заключается в том, |
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.
Мне кажется это лишнее для стайлгайда. Это же не методическое пособие.
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.
Мне кажется, что почему бы и нет.
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.
Ну тогда добавь такие пояснения везде. Почему так выборочно?
| + } | ||
| ``` | ||
|
|
||
| ### Замыкания |
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.
Это чё?
|
Очень плохой пулл-реквест — в нём свалено всё и изменения и рефакторинги и правки и черт в ступе. Пожалуйста не делайте так. Никакого хорошего ревью не получится |
Давай не будет добавлять такую строчку. |
|
Я согласен с @zeckson. Сейчас это не вмёржить уже. Можно было сделать ветку от этой ветки. |
|
Ну если только по тексту то надо было обсуждать в другой ветке, это уже версия, которую @juwain готовит к публикации. Может быть да, можно было сделать в несколько шагов, но сейчас уже PR какой есть, надо что-то делать. Ок, плохо, выход какой? Никаких альтернатив не предложено. Повздыхали и разошлись. |
Аргументы и альтернатива. Давай не добавлять такую строку |
javascript.html
Outdated
|
|
||
| <li>Блоки кода отделяются друг от друга не более чем двумя пустыми строками</li> | ||
|
|
||
| <li>В качестве символа строки используется стандартный символ, который используется в системе</li> |
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.
Это чё?
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.
EOL. LF/CRLF и вот это все.
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.
Тогда нужно написать в качестве символа переноса строки
javascript.html
Outdated
|
|
||
| <li>В блоках кода первая и последняя строка не должны быть пустыми (код не отбивается от начала блока кода)</li> | ||
|
|
||
| <li>После двоеточий и точек с запятым ставятся пробелы. Перед ними — не ставятся.</li> |
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.
Где-то есть точки в конце, где-то нет — лучше определиться
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.
Долой точки в конце
javascript.html
Outdated
|
|
||
| <li>При объявлении вычисляемых ключей в объектах с помощью синтаксиса ES2016 в квадратных скобках не используются пробелы</li> | ||
|
|
||
| <li>Оператор вызова функции () не отделяется круглыми скобками от названия функции</li> |
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.
Имется ввиду вот это: (callFun)()
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.
Забыл вопрос задать =)
Имется ввиду вот это: (callFun)()?
javascript.html
Outdated
|
|
||
| <li>Перед скобками начинающими новый блок кода должен ставиться пробел.</li> | ||
|
|
||
| <li>при объявлении анонимных функций, скобки с параметрами ставятся непосредственно после ключевого слова function. Если функция именована, перед названием ставится пробел, после — нет.</li> |
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.
С большой буквы
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.
В нашем eslint это не так.
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.
@zeckson давай договоримся, что если ты что-то отрицаешь, то ты делаешь противопоставление, так удобней. Да, я мог ошибиться, но я не в контексте. Будет конструктивней, если ты напишешь: у нас не так, а вот так.
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.
@o0 хорошо, у нас вот так:
'space-before-function-paren': ['error', {named: 'never', anonymous: 'always'}],
javascript.html
Outdated
|
|
||
| <li>В spread-операторе точки не отделяются от названия коллекции</li> | ||
|
|
||
| <li>Звездочка после ключевого слова yield не отбивается пробелом. После звездочки проблел ставится всегда.</li> |
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.
проблел
|
|
||
| <article class="chapter-part"> | ||
| <div class="chapter-part-col chapter-part-col--full-width"> | ||
| <h3 id="">Неиспользуемый код</h3> |
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.
Закомментированный код?
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.
А?
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.
Ну про закомментированный код или это не сюда?
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.
Не, про закомментированный код у нас нет ничего в этом гайде. ESLint же не умеет его проверять.
javascript.html
Outdated
| </ul> | ||
|
|
||
| <ul> | ||
| <li>В конструкции <code>try..catch</code> запрещен пустой блок <code>try</code></li> |
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.
Пустой блок catch
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.
try
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.
javascript.html
Outdated
| <ul> | ||
| <li>При итерировании по объектам через <code>for..in</code> при работе со свойствами используется конструкция <code>hasOwnProperty</code></li> | ||
|
|
||
| <li>В функциях не используются обращения к <code>caller</code> и <code>callee</code></li> |
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.
Перенести в запрещенное
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.
Где у нас запрещенное?
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.
javascript.html
Outdated
| <article class="chapter-part"> | ||
| <div class="chapter-part-col chapter-part-col--full-width"> | ||
| <ul> | ||
| <li>При итерировании по объектам через <code>for..in</code> при работе со свойствами используется конструкция <code>hasOwnProperty</code></li> |
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.
for..in не используется
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.
Правило?
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.
увы в eslint нет такого правила, но я бы запретил совсем
| <pre class="language-js language-correct"><code>const result = 2; | ||
| </code></pre> | ||
| <br> | ||
| <pre class="language-js language-incorrect"><code>switch (val = getVal(), val) {} |
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.
это и так запрещено выше
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.
Потерял контекст
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.
нельзя присваивать и использовать одновременно
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.
Это немного не то!
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.
Разные правила, каждый пример взят по отдельному правилу, я не вспомню сейчас названия обоих. Это правило не про присвоение и использование, а про оператор запятая в условиях.
Без аргументов и альтернативы, просто предложение. Т.к. добавление такой строки приведет к дальнейшему бесконечному рефакторингу многочисленных мест. |
Я отревьюил как смог, но |
|
@zeckson согласен. |
| <h3 id="">Операторы</h3> | ||
| <ul> | ||
| <li>В конструкторе классов-наследников обязательно вызывается <code>super()</code></li> | ||
| <p>В конструкторе классов-наследников обязательно вызывается <code>super()</code></p> |
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.
Я повторю свой вопрос — нужно ли дублировать синтаксические ошибки в стайлгайде?
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.
Хотя ладно, пусть будет
|
|
||
| <li>В конструкторе нет обращения к <code>this</code> до того, как будет вызван <code>super()</code></li> | ||
| </ul> | ||
| <p>В конструкторе нет обращения к <code>this</code> до того, как будет вызван <code>super()</code></p> |
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.
Я повторю свой вопрос — нужно ли дублировать синтаксические ошибки в стайлгайде?
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.
Хотя ладно, пусть будет
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.
Правило ESLint! Тулза проверяет, хороший ли синтаксис, у них есть такие правила, например проверка валидности регулярки. Если регулярка невалидна, то код упадет, но ESLint не позволяет до этого дойти, так что, я считаю, что это хорошо.

No description provided.