Skip to content

Commit

Permalink
Updated config to Stylelint 13 and based it on stylelint-config-stand…
Browse files Browse the repository at this point in the history
…ard. Added SCSS plugin.
  • Loading branch information
Eugene Fedorenko committed Feb 3, 2021
1 parent fd9b9fe commit ba5d38d
Show file tree
Hide file tree
Showing 3 changed files with 2,102 additions and 95 deletions.
175 changes: 84 additions & 91 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,73 +1,112 @@
module.exports = {
extends: 'stylelint-config-standard',
plugins: [
"stylelint-order"
'stylelint-order',
'stylelint-scss'
],
rules: {
// @ rule
'at-rule-empty-line-before': null,
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': true,

// Color
'color-hex-case': 'upper',
'color-hex-length': 'short',
'color-hex-case': 'upper', // 'lower' in standard
'color-named': 'never',
'color-no-invalid-hex': true,

// Font family
'font-family-name-quotes': 'always-where-recommended',
'font-family-no-duplicate-names': true,

// Function
'function-calc-no-unspaced-operator': true,
'function-comma-space-after': 'always-single-line',
'function-comma-space-before': 'never',
'function-linear-gradient-no-nonstandard-direction': true,
'function-name-case': 'lower',
'function-parentheses-space-inside': 'never-single-line',
'function-url-quotes': 'always',
'function-whitespace-after': 'always',

// Number
'number-leading-zero': null,
'number-no-trailing-zeros': true,
'number-leading-zero': null, // 'always' in standard

// String
'string-no-newline': true,
'string-quotes': 'single',

// Length
'length-zero-no-unit': true,

// Unit
'unit-case': 'lower',
'unit-no-unknown': true,

// Value
'value-keyword-case': null, // 'lower' in standard
'value-no-vendor-prefix': [true, {'severity': 'warning'}],

// Value list
'value-list-comma-newline-after': 'always-multi-line',
'value-list-comma-space-after': 'always-single-line',
'value-list-comma-space-before': 'never',
'value-list-max-empty-lines': 0,

// Property
'property-case': 'lower',
'property-no-vendor-prefix': [true, {'severity': 'warning'}],
'property-no-unknown': [true, {'severity': 'warning'}],

// Declaration
'declaration-bang-space-after': 'never',
'declaration-bang-space-before': 'always',
'declaration-colon-space-after': null,
'declaration-colon-space-before': 'never',
'declaration-colon-space-after': null, // 'always-single-line' in standard
'declaration-colon-newline-after': null, // 'always-multi-line' in standard

// Declaration block
'declaration-block-no-duplicate-properties': true,
'declaration-block-no-shorthand-property-overrides': true,
'declaration-block-no-redundant-longhand-properties': [true, {'severity': 'warning'}],
'declaration-block-semicolon-newline-after': 'always-multi-line',
'declaration-block-semicolon-newline-before': 'never-multi-line',
'declaration-block-semicolon-space-after': 'always-single-line',
'declaration-block-semicolon-space-before': 'never',
'declaration-block-single-line-max-declarations': 1,
'declaration-block-trailing-semicolon': 'always',
'declaration-empty-line-before': null, // 'always' in standard

// Block
'block-closing-brace-space-after': 'always-single-line',
'block-opening-brace-newline-before': 'never-single-line',
'block-no-empty': null, // true in recommended

// Selector
'selector-max-universal': 0,
'selector-no-vendor-prefix': [true, {'severity': 'warning'}],
'selector-attribute-quotes': 'always',

// Selector list
'selector-list-comma-newline-before': 'never-multi-line',
'selector-list-comma-space-after': 'always-single-line',

// Media feature
'media-feature-name-no-vendor-prefix': [true, {'severity': 'warning'}],

// Comment
'comment-empty-line-before': null, // 'always' in standard

// General / Sheet
indentation: null, // 2 in standard
'max-empty-lines': 3, // 1 in standard
'rule-empty-line-before': null, // true in standard
'no-duplicate-selectors': [true, {'severity': 'warning'}], // true in recommended
'no-descending-specificity': null, // true in recommended
'no-unknown-animations': true,


// Plugin stylelint-scss
// ---------------------

// @each
'scss/at-each-key-value-single-line': true,

// @else
'scss/at-else-if-parentheses-space-before': 'always',

// @function
'scss/at-function-parentheses-space-before': 'always',

// @import
'scss/at-import-no-partial-leading-underscore': true,
'scss/at-import-partial-extension-blacklist': ['scss'],

// $ variable
'scss/dollar-variable-colon-space-after': 'at-least-one-space',
'scss/dollar-variable-colon-space-before': 'never',

// Selector
'scss/selector-no-redundant-nesting-selector': true,


// Plugin stylelint-order
// ----------------------

'order/order': [
'custom-properties',
'declarations'
],
'order/properties-order': [
[
// Generated content
Expand Down Expand Up @@ -206,60 +245,14 @@ module.exports = {
],
{'severity': 'warning'}
],

// Block
'block-closing-brace-empty-line-before': 'never',
'block-closing-brace-newline-after': 'always',
'block-closing-brace-newline-before': 'always-multi-line',
'block-closing-brace-space-after': 'always-single-line',
'block-closing-brace-space-before': 'always-single-line',
'block-opening-brace-newline-after': 'always-multi-line',
'block-opening-brace-newline-before': 'never-single-line',
'block-opening-brace-space-after': 'always-single-line',
'block-opening-brace-space-before': 'always',
'block-no-empty': null,

// Selector
'selector-combinator-space-after': 'always',
'selector-combinator-space-before': 'always',
'selector-max-universal': 0,
'selector-no-vendor-prefix': [true, {'severity': 'warning'}],
'selector-pseudo-class-case': 'lower',
'selector-pseudo-class-no-unknown': true,
'selector-pseudo-element-case': 'lower',
'selector-pseudo-element-colon-notation': 'double',
'selector-type-case': 'lower',
'selector-type-no-unknown': [true, {'severity': 'warning'}],
'selector-attribute-quotes': 'always',
'selector-descendant-combinator-no-non-space': true,

// Selector list
'selector-list-comma-newline-after': 'always',
'selector-list-comma-newline-before': 'never-multi-line',
'selector-list-comma-space-after': 'always-single-line',
'selector-list-comma-space-before': 'never',

// Media feature
'media-feature-colon-space-after': 'always',
'media-feature-colon-space-before': 'never',
'media-feature-name-case': 'lower',
'media-feature-name-no-unknown': true,
'media-feature-name-no-vendor-prefix': [true, {'severity': 'warning'}],
'media-feature-range-operator-space-after': 'always',
'media-feature-range-operator-space-before': 'always',
'media-feature-parentheses-space-inside': 'never',

// Comment
'comment-no-empty': true,
'comment-whitespace-inside': 'always',

// General / Sheet
'max-empty-lines': 3,
'no-descending-specificity': null,
'no-eol-whitespace': true,
'no-invalid-double-slash-comments': true,
'no-missing-end-of-source-newline': true,
'no-unknown-animations': true,
'no-extra-semicolons': true
}
}

// font-family-no-missing-generic-family-keyword - recommended
// no-duplicate-at-import-rules - recommended
// keyframes-name-pattern
// no-empty-first-line
// function-calc-no-invalid - recommended
// alpha-value-notation
// color-function-notation
// hue-degree-notation
Loading

0 comments on commit ba5d38d

Please sign in to comment.