Stylelint plugin to enforce usage of cascade layers.
This plugin is built to work with both Stylelint v15 and v16.
Add stylelint-cascade-layers
and stylelint
itself to your project:
npm install -D stylelint stylelint-cascade-layers
{
plugins: ["stylelint-cascade-layers"],
rules: {
"cascade-layers/require-layers": true,
},
}
{
plugins: ["stylelint-cascade-layers"],
rules: {
"cascade-layers/require-layers": [true, {
ignoreAtRules: [
"@charset",
"@font-face",
"@font-feature-values",
"@font-palette-values",
"@import",
"@keyframes",
"@property",
"@styleset",
],
ignoreSelectors: [],
}],
},
}
Option | Type | Default | Description |
---|---|---|---|
ignoreAtRules |
string[] |
["@charset", "@font-face", "@font-feature-values", "@font-palette-values", "@import", "@keyframes", "@property", "@styleset"] |
List of at-rules to ignore. |
ignoreSelectors |
string[] |
[] |
List of selectors to ignore. |
Default options will be overridden, not merged with the provided options.