Commit d85ff257 authored by Nikolay Gromov's avatar Nikolay Gromov

Рефакторинг: добавил новые правила стайллинта

parent 8e94312c
......@@ -3,8 +3,8 @@
# http://stylelint.io/user-guide/rules/
"rules": {
"color-hex-case": ["lower", {
"message": "HEX цвета буквами строчными указывать следует",
"severity": "warning"
"severity": "warning",
"message": "HEX цвета буквами строчными указывать следует"
}],
"color-named": ["never", {
"message": "Цвета ключевыми словами нельзя писать"
......@@ -15,21 +15,39 @@
"font-family-name-quotes": ["always-where-recommended", {
"message": "В кавычки шрифта название брать следует"
}],
"font-family-no-duplicate-names": [true, {
"message": "Шрифтов название повторять не следует"
}],
"font-family-no-missing-generic-family-keyword": [true, {
"message": "Указанием sans-serif/serif... это заканчиваться должно"
}],
"font-weight-notation": ["numeric", {
"message": "Плотность — цифрой: https://goo.gl/58eKi7",
ignore: ["relative"]
}],
# "function-calc-no-invalid": [true, {
# "message": "Для calc() некорректен синтаксис этот"
# }],
"function-calc-no-unspaced-operator": [true, {
"message": "Для calc() пробелы вокруг операторов нужны"
}],
"function-linear-gradient-no-nonstandard-direction": [true, {
"message": "Синтаксис градиентов стандартен: https://goo.gl/ba4HEc"
}],
"function-comma-space-after": ["always", {
"message": "После запятой пробел необходим"
}],
"function-comma-space-before": ["never", {
"message": "Перед запятой пробела быть не должно"
}],
"function-linear-gradient-no-nonstandard-direction": [true, {
"message": "Синтаксис градиентов стандартен: https://goo.gl/ba4HEc"
"function-comma-newline-before": ["never-multi-line", {
"message": "Переноса перед запятой быть не должно"
}],
"function-comma-newline-after": ["never-multi-line", {
"message": "Переноса после запятой быть не должно"
}],
"function-parentheses-newline-inside": ["never-multi-line", {
"message": "Переноса после скобки быть не должно"
}],
"function-max-empty-lines": [0, {
"message": "Пустые строки в функциях нужно убрать"
......@@ -40,6 +58,9 @@
"function-whitespace-after": ["always", {
"message": "Всегда нужны пробелы между функциями"
}],
"function-url-scheme-whitelist": [["data", "/^https/"], {
"message": "Картинки фоновые только data: URL и по https хочешь ты"
}],
"number-leading-zero": ["always", {
"message": "Нуль перед точкой явно указать следует"
}],
......@@ -64,11 +85,18 @@
"unit-case": ["lower", {
"message": "Измерения единицы буквами строчными надобно"
}],
"value-keyword-case": ["lower", {
"message": "Значения свойств буквами строчными надобно",
"ignoreProperties": ["/font-/", ]
}],
"unit-no-unknown": [true, {
"message": "Нет единиц измерения таких"
}],
"value-no-vendor-prefix": [true, {
"message": "Вендорные префиксы использовать не следует"
"message": "Вендорные префиксы в значениях использовать не следует"
}],
"property-no-vendor-prefix": [true, {
"message": "Свойства с вендорными префиксами использовать не следует"
}],
"value-list-comma-newline-after": ["always-multi-line", {
"message": "Значения свойств переносов иметь не должны"
......@@ -82,18 +110,15 @@
"value-list-comma-space-before": ["never", {
"message": "В значениях перед запятой пробел запрещен"
}],
# "property-blacklist": [["text-rendering", "float"], {
# "message": "Свойство из чёрного списка"
# }],
"property-blacklist": [["text-rendering", ], {
"message": "Свойство из чёрного списка"
}],
"property-case": ["lower", {
"message": "Свойств значение буквами строчными указывать следует"
}],
"property-no-unknown": [true, {
"message": "Такого свойства нет"
}],
"property-no-vendor-prefix": [true, {
"message": "Вендорные префиксы тут лишние, используем Autoprefixer"
}],
"declaration-bang-space-after": ["never", {
"message": "После знака восклицательного пробел убрать следует"
}],
......@@ -110,15 +135,26 @@
"message": "Правило задавая, пробел перед двоеточием не используй"
}],
"declaration-no-important": [true, {
"message": "!important с опаской применять следует",
"severity": "warning"
# "severity": "warning",
"message": "!important с опаской применять следует"
}],
"declaration-property-unit-blacklist": [{
"font-size": ["pt"],
"/^animation/": ["ms"]
"/^animation/": ["ms"],
"/^padding/": ["%"]
}, {
"message": "Для этого свойства данные единицы измерения в чёрном списке"
}],
# "declaration-property-value-blacklist": [{
# "transform": ["/scale3d/", "/rotate3d/", "/translate3d/"],
# "position": ["fixed"],
# "color": ["/^green/"],
# }, {
# "message": "Для этого свойства значение это в чёрном списке"
# }],
"unit-blacklist": [["mm","cm","in","pc",], {
"message": "Запрещены единицы измерения эти"
}],
"declaration-block-no-duplicate-properties": [true, {
"message": "Правила повторять не следует"
}],
......@@ -144,6 +180,7 @@
"message": "Перед «}» переносу строки быть должно"
}],
# "block-no-empty": [true, {
# "severity": "warning",
# "message": "Пустые блоки писать не следует"
# }],
"block-opening-brace-newline-after": ["always", {
......@@ -174,13 +211,13 @@
"message": "По ID джедай стилизовать не должен"
}],
"selector-max-compound-selectors": [3, {
"message": "Селектор более чем 3-составной не хочешь ты",
"severity": "warning"
"severity": "warning",
"message": "Селектор более чем 3-составной не хочешь ты"
}],
"selector-no-qualifying-type": [true, {
"severity": "warning",
"message": "Возможно, перенасыщенный селектор (использован селектор типа)",
ignore: ["attribute"],
"severity": "warning"
ignore: ["attribute"]
}],
"selector-pseudo-class-case": ["lower", {
"message": "Псевдоклассы набирать буквами строчными надо"
......@@ -232,8 +269,8 @@
"message": "Строчные буквы использовать следует"
}],
"media-feature-name-no-vendor-prefix": [true, {
"message": "Использовать вендорные префиксы не следует",
"severity": "warning"
"severity": "warning",
"message": "Использовать вендорные префиксы не следует"
}],
"media-feature-parentheses-space-inside": ["never", {
"message": "Пробелы после «(» и перед «)» нельзя использовать"
......@@ -244,7 +281,7 @@
"media-feature-range-operator-space-before": ["always", {
"message": "Пробел перед оператором диапазона ставить следует"
}],
"at-rule-blacklist": [["extend"], {
"at-rule-blacklist": [["extend", ], {
"message": "В чёрном списке @-правило это"
}],
"at-rule-empty-line-before": ["always", {
......@@ -278,6 +315,9 @@
"at-rule-semicolon-newline-after": ["always", {
"message": "В @-правилах после ; новая строка быть должна"
}],
"at-rule-semicolon-space-before": ["never", {
"message": "В @-правилах перед ; пробелов быть не должно"
}],
"comment-empty-line-before": ["always", {
"message": "Перед комментом пустая строка требуется",
except: ["first-nested"],
......@@ -286,6 +326,9 @@
"comment-no-empty": [true, {
"message": "Пустой коммент убрать нужно"
}],
"comment-whitespace-inside": ["always", {
"message": "В комменте пробелы в начале о конце нужны"
}],
"comment-word-blacklist": [ [/((Х|х)+уй|(Х|х)уе|(Х|х)уё|(Б|б)ляд|(М|м)уда|(П|п)идо|(П|п)еди|(П|п)еде|(^|\s)+(Б|б)ля)/], {
"message": "Комментарий херовый, при себе оставь его"
}],
......@@ -297,8 +340,8 @@
}],
"max-nesting-depth": [3, {
"message": "Вложения боле 3 уровней — на тёмную сторону путь",
"ignore": ["blockless-at-rules"],
"severity": "warning"
"severity": "warning",
"ignore": ["blockless-at-rules"]
}],
"no-duplicate-selectors": [true, {
"message": "Селекторы дублировать не хочешь ты"
......@@ -312,5 +355,62 @@
"no-missing-end-of-source-newline": [true, {
"message": "Файл пустой строкой кончаться должен: https://goo.gl/Co2tZ8"
}],
"media-feature-name-no-unknown": [true, {
"message": "Медиаусловия такого на светлой стороне силы нет"
}],
"keyframe-declaration-no-important": [true, {
"message": "!important в keyframe некоторыми браузерами игнорируется"
}],
# "no-descending-specificity": [true, {
# "message": "Менее специфичный селектор, чем написанный выше"
# }],
"no-duplicate-at-import-rules": [true, {
"message": "Повторный импорт файла не хочешь ты"
}],
"no-empty-source": [true, {
"message": "Пустые файлы не хочешь ты"
}],
"shorthand-property-no-redundant-values": [true, {
"message": "В значении свойства избыточность лишняя, короче можно написать"
}],
"selector-combinator-blacklist": [[">", ], {
"severity": "warning",
"message": "Комбинатор > опасно связывает CSS с DOM"
}],
"selector-max-attribute": [1, {
# "severity": "warning",
"message": "Атрибутов в селекторе более одного использовать не стоит"
}],
"selector-max-type": [2, {
# "severity": "warning",
"message": "Селекторов по тегу более двух использовать не стоит"
}],
"selector-max-class": [2, {
# "severity": "warning",
"message": "Классов в селекторе более двух использовать не стоит"
}],
"selector-max-combinators": [2, {
# "severity": "warning",
"message": "Комбинаторов в селекторе более двух использовать не стоит"
}],
# "selector-nested-pattern": ["^(&|\\.\\w+\\s+&)(__\\w|--\\w)?", {
# "message": "Вкладывать такой селектор нельзя"
# }],
"selector-pseudo-class-blacklist": [["/^nth-/", ], {
# "severity": "warning",
"message": "Псевдокласс такой использовать не стоит"
}],
"value-list-max-empty-lines": [0, {
"message": "Пустые строки в значениях свойств недопустимы"
}],
"declaration-block-semicolon-newline-before": ["never-multi-line", {
"message": "Перенос перед символом ; недопустим"
}],
"declaration-block-semicolon-space-before": ["never", {
"message": "Пробел перед символом ; недопустим"
}],
"selector-descendant-combinator-no-non-space": [true, {
"message": "Комбинированные селекторы одним пробелом разделять следует"
}],
}
}
......@@ -11,12 +11,12 @@
color: $text-color;
background-color: lighten($color-warning, 30%);
& > * {
& > * { // stylelint-disable-line selector-combinator-blacklist
margin-top: 0;
margin-bottom: 0;
}
& > * + * {
& > * + * { // stylelint-disable-line selector-combinator-blacklist
margin-top: $typo-margin-vertical;
}
......
......@@ -14,7 +14,7 @@
user-select: none;
cursor: pointer;
> span {
> span { // stylelint-disable-line selector-combinator-blacklist
position: relative;
display: inline-block;
vertical-align: middle;
......@@ -48,7 +48,7 @@
&--close {
> span {
> span { // stylelint-disable-line selector-combinator-blacklist
transition: background $transition-time 0s;
background: transparent;
......
......@@ -14,7 +14,7 @@
user-select: none;
cursor: pointer;
> span {
span {
position: relative;
display: inline-block;
vertical-align: middle;
......@@ -52,7 +52,7 @@
width: 30px;
line-height: 30px;
> span {
span {
width: 60%;
&:before,
......
......@@ -12,7 +12,7 @@
padding-left: calc(60px + 1em);
}
& & & & {
& & & & { // stylelint-disable-line selector-max-compound-selectors, selector-max-class, selector-max-combinators
padding-left: 0;
}
}
......@@ -45,7 +45,7 @@
&__body {
& > *:last-child {
& > *:last-child { // stylelint-disable-line selector-combinator-blacklist
margin-bottom: 0;
}
}
......
......@@ -52,7 +52,7 @@
&--active {
& > #{$block-name}__link {
& > #{$block-name}__link { // stylelint-disable-line selector-combinator-blacklist
color: #000;
}
}
......@@ -101,12 +101,12 @@
overflow: hidden;
transition: opacity $transition-time;
// stylelint-disable max-nesting-depth
// stylelint-disable
#{$block-name}__item--show-child > &,
#{$block-name}__item:hover & {
opacity: 1;
height: auto;
overflow: visible;
opacity: 1;
}
// stylelint-enable
}
......@@ -124,12 +124,12 @@
overflow: hidden;
transition: opacity $transition-time;
// stylelint-disable max-nesting-depth
// stylelint-disable
#{$block-name}__item--show-child > &,
#{$block-name}__item--lvl-2:hover & {
opacity: 1;
height: auto;
overflow: visible;
opacity: 1;
}
// stylelint-enable
}
......
// Демка для библиотеки блоков
img.ofp-demo {
img.ofp-demo { // stylelint-disable-line
object-fit: cover;
}
......@@ -88,7 +88,7 @@
display: none;
}
& > *:last-child {
& > *:last-child { // stylelint-disable-line selector-combinator-blacklist
margin-bottom: 0;
}
......
......@@ -17,7 +17,7 @@ $transition-time: 0.3s !default;
border-radius: 50%;
background-color: #000;
color: transparent;
font: 0/0 a;
font: 0/0 a; // stylelint-disable-line
// см. bg-img/to-up.svg
// http://yoksel.github.io/url-encoder/ru/
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 11' width='17' height='11'%3E%3Cpath fill='%23fff' d='M.202 1.97L1.956.204A.61.61 0 0 1 2.43 0a.61.61 0 0 1 .47.204L8.5 5.84 14.1.204A.61.61 0 0 1 14.57 0a.61.61 0 0 1 .474.204l1.754 1.766a.618.618 0 0 1 .202.473.62.62 0 0 1-.202.476l-7.826 7.875A.61.61 0 0 1 8.5 11a.61.61 0 0 1-.472-.204L.202 2.92A.618.618 0 0 1 0 2.444c0-.203.067-.34.202-.475z'/%3E%3C/svg%3E");
......
......@@ -123,7 +123,7 @@ $grid-gutter-width: 30px !default;
display: flex;
flex-wrap: wrap;
& > * {
& > * { // stylelint-disable-line selector-combinator-blacklist
flex-basis: 100%;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment