Skip to content
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

fix(stylelint-config): extend @exadel/stylelint-config-esl defaults with the primary rules #2971

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
};