-
Notifications
You must be signed in to change notification settings - Fork 95
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
at-rule-no-unknown errors #86
Comments
The list of known rules is defined in stylelint's code. This project loads stylelint as a dependency, thus we can use its code in our code, but can not alter the rules from a standalone stylelint users define in their configs. ... or can we @davidtheclark ? Is it possible to give a plugin set the ability to redefine things like objects in keywordSets? Alternatively something like |
@neverfox I'm in the same boat, but what I realized is that because What we really need to make the linter "scss aware" is a scss lint config that we can tell stylelint to I did a quick search online for "stylelint scss config" but it isn't turning up anything, perhaps this is a perfect moment for me to attempt to write one myself! |
Here we go, there actually is one: https://github.com/bjankord/stylelint-config-sass-guidelines/blob/master/index.js. See how he's using |
@eriklharper Cool. Makes sense. Thanks for doing the leg work. |
Another possibility would be to write a new rule for var sassAtRules = [
'extend', 'at-root', 'debug',
'warn', 'error', 'if', 'else',
'for', 'each', 'while', 'mixin',
'include', 'content', 'return', 'function'
];
function atRuleNoUnknownSassy(on, options) {
return function (root, result) {
const defaultedOptions = Object.assign({}, options, {
ignoreAtRules: sassAtRules.concat(options.ignoreAtRules || [])
});
stylelint.rules['at-rule-no-unknown'](on, defaultedOptions)(root, result);
};
}; This solution means your rule is easy to maintain, without duplicating code and at-rule lists in stylelint. This ability to manually invoke stylelint rules within plugin rules opens a lot of doors! |
@davidtheclark awesome! Will give it a shot a bit later. |
@dryoma FYI, this is documented in this section of the developer guide. It's also worth keeping an eye on stylelint/stylelint#2173 in case it impacts on how wrapping rules might work going forward. |
Implements #86. Needed to consider SCSS-specific @-directives as known rules while being able to disallow all the other non-standard unknown at-rules
This is implemented in version 1.5 |
thank you! |
I get at-rule-no-unknown errors for things like @extend, @mixin etc. with this plugin installed. I could be mistaken, but I assumed this plugin would cover those cases, but right now I have to use a custom ignore rule:
The text was updated successfully, but these errors were encountered: