Skip to content

Commit

Permalink
fix(stylelint-config): extend @exadel/stylelint-config-esl defaults w…
Browse files Browse the repository at this point in the history
…ith the primary rules
  • Loading branch information
ala-n committed Mar 6, 2025
1 parent 68d7be9 commit 5f53cb8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 60 deletions.
63 changes: 4 additions & 59 deletions .stylelintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,18 @@ extends:
- '@exadel/stylelint-config-esl'

rules:
# Disallow unknown at-rules
at-rule-no-unknown: true
# Warn about empty selectors
block-no-empty:
- true
- severity: warning
# Disallow invalid hex colors
color-hex-length: short
# Disallow invalid hex colors
color-no-invalid-hex: true
# Disallow empty comments
comment-no-empty: true
# Disallow duplicate properties within declaration blocks
declaration-block-no-duplicate-properties: true
# Disallow absolute paths for imports in bounds of library files
esl-less/import-root: never
# Disallow duplicated font family reverencing
font-family-no-duplicate-names: true
# Disallow missing font family keyword
font-family-no-missing-generic-family-keyword: true
# Disallow an unspaced operator within `calc` functions
function-calc-no-unspaced-operator: true
# Disallow direction values in `linear-gradient()` calls that are not valid according to the standard syntax
function-linear-gradient-no-nonstandard-direction: true
# Disallow !important within keyframe declarations
keyframe-declaration-no-important: true
# Disallow duplicated at-rules
no-duplicate-at-import-rules: true
# Warn if empty sources
no-empty-source:
- true
- severity: warning
# Disallow double-slash comments `(//...)` for clear CSS, as they are not supported by CSS
# and could lead to unexpected results
no-invalid-double-slash-comments: true
# Disallow unknown properties
property-no-unknown: true
# Use double colon notation for applicable pseudo-elements
selector-pseudo-element-colon-notation: double
# Disallow unknown pseudo-class selectors
selector-pseudo-class-no-unknown: true
# Disallow unknown pseudo-element selectors
selector-pseudo-element-no-unknown:
- true
- ignorePseudoElements:
- /^-webkit-/
- /^-moz-/
# Disallow unknown type selectors
selector-type-no-unknown:
- true
- ignore:
- custom-elements
# Warn about newlines (unescaped) in strings
string-no-newline:
- true
- severity: warning
# Disallow unknown units
unit-no-unknown: true

# Disallow duplicate properties within declaration blocks
declaration-block-no-duplicate-properties: true

overrides:
# Demo site pages sources
- files: ['site/**/*.{css,less}']
rules:
# No import restrictions
esl-less/import-root: off
# Warn about duplicate properties within declaration blocks
declaration-block-no-duplicate-properties:
- true
- severity: warning
# No import restrictions
esl-less/import-root: off
58 changes: 57 additions & 1 deletion packages/stylelint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,67 @@ export default {
plugins: ['@stylistic/stylelint-plugin'],
extends: ['@stylistic/stylelint-config'],
rules: {
// --- Stylistic overrides ---
'@stylistic/string-quotes': 'single',
'@stylistic/declaration-colon-newline-after': null,
'@stylistic/max-line-length': null,
'@stylistic/indentation': [2, {
ignore: ['value', 'inside-parens']
}]
}],

// --- EditorConfig overrides ---
'@stylistic/unicode-bom': 'never',
'@stylistic/no-eol-whitespace': true,

// --- Main rules ---
// Disallow unknown at-rules
'at-rule-no-unknown': true,
// Warn about empty selectors
'block-no-empty': [true, {severity: 'warning'}],
// Disallow invalid hex colors
'color-hex-length': ['short', {severity: 'warning'}],
// Disallow invalid hex colors
'color-no-invalid-hex': true,
// Disallow empty comments
'comment-no-empty': [true, {severity: 'warning'}],
// Disallow duplicated font family reverencing
'font-family-no-duplicate-names': true,
// Disallow missing font family keyword
'font-family-no-missing-generic-family-keyword': [true, {severity: 'warning'}],
// Disallow an unspaced operator within `calc` functions
'function-calc-no-unspaced-operator': true,
// Disallow direction values in `linear-gradient()` calls that are not valid according to the standard syntax
'function-linear-gradient-no-nonstandard-direction': true,
// Disallow !important within keyframe declarations
'keyframe-declaration-no-important': true,
// Disallow duplicated at-rules
'no-duplicate-at-import-rules': [true, {severity: 'warning'}],
// Warn if empty sources
'no-empty-source': [true, {severity: 'warning'}],
// Disallow double-slash comments `(//...)` for clear CSS, as they are not supported by CSS
// and could lead to unexpected results
'no-invalid-double-slash-comments': [true, {severity: 'warning'}],
// Disallow unknown properties
'property-no-unknown': [true, {severity: 'warning'}],
// Use double colon notation for applicable pseudo-elements
'selector-pseudo-element-colon-notation': 'double',
// Disallow unknown pseudo-class selectors
'selector-pseudo-class-no-unknown': [true],
// Disallow unknown pseudo-element selectors
'selector-pseudo-element-no-unknown': [true, {
ignorePseudoElements: [
'/^-webkit-/',
'/^-moz-/'
],
severity: 'warning'
}],
// Disallow unknown type selectors
'selector-type-no-unknown': [true, {
ignore: ['custom-elements']
}],
// Warn about newlines (unescaped) in strings
'string-no-newline': [true, {severity: 'warning'}],
// Disallow unknown units
'unit-no-unknown': true
}
};

0 comments on commit 5f53cb8

Please sign in to comment.