Fix extending rules within overrides
See original GitHub issueClearly describe the bug
When using extends
within the overrides
property, the rules don’t seem to override.
Which rule, if any, is the bug related to?
None.
What code is needed to reproduce the bug?
input.scss
:
@mixin {}
What Stylelint configuration is needed to reproduce the bug?
.stylelintrc.json
:
{
"rules": {
"at-rule-no-unknown": true
},
"overrides": [
{
"files": "**/*.scss",
"extends": ["./scss.json"]
}
]
}
scss.json
:
{
"customSyntax": "postcss-scss",
"rules": {
"at-rule-no-unknown": null
}
}
Which version of Stylelint are you using?
14.0.0
How are you running stylelint: CLI, PostCSS plugin, Node.js API?
CLI with npx stylelint input.scss
Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?
N/A
What did you expect to happen?
No warnings to be flagged.
What actually happened (e.g. what warnings or errors did you get)?
The following warnings were flagged:
input.scss
1:1 ✖ Unexpected unknown at-rule "@mixin" at-rule-no-unknown
What do we think should be the intended behaviour here? I was expecting the rule to be overridden for scss
files, i.e. to have the following resolved config:
{
"rules": {
"at-rule-no-unknown": [
null
]
},
"customSyntax": "postcss-scss"
}
But npx stylelint input.scss --print-config
gives me:
{
"rules": {
"at-rule-no-unknown": [
true
]
},
"customSyntax": "postcss-scss"
}
I’m running into this issue while looking into https://github.com/twbs/stylelint-config-twbs-bootstrap/issues/128, where I’d like to write the following:
{
"extends": ["stylelint-config-standard"],
"overrides": [
{
"files": "**/*.scss",
"extends": ["stylelint-config-standard-scss"]
}
]
}
At-mentioning @ota-meshi because of https://github.com/stylelint/stylelint/pull/5603.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
@ota-meshi Thank you for the clear explanation.
I had it in my head that
extends
was resolved beforeoverrides
, but I think you’re right. Users would expect a top-levelrules
property to take precedence over anyoverrides
define in a config that they extend.Expected behavior seems correct to me. Rule should be disabled for
*.scss
files.