Add support for enabling a rule with stylelint-command comments
See original GitHub issueWhat is the problem you’re trying to solve?
Enabling a rule (with options) using stylelint-commands.
What solution would you like to see?
Being possible to write e.g.
/* stylelint declaration-no-important: [ true, { severity: 'warning' } ] */
to enable declaration-no-important
with warning severity for a single file.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Command Line Interface (CLI) - Stylelint
Produce a report of the stylelint-disable comments that used for rules that don't exist within the configuration object. More info.
Read more >Configuration | Stylelint
Rules determine what the linter looks for and complains about. There are over 170 rules built into Stylelint. No rules are turned on...
Read more >Options | Stylelint
Report stylelint-disable comments that don't match rules that are specified in the configuration object. reportNeedlessDisables . CLI flags: --report-needless- ...
Read more >Working on rules | Stylelint
add secondary ignore options to make the rule more permissive; not include code specific to language extensions, e.g. SCSS. You should make use...
Read more >Ignoring code - Stylelint
You can temporarily turn off rules using special comments in your CSS. ... Stylelint supports complex, overlapping disabling & enabling patterns:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This feature SGTM. It’s likely related to https://github.com/stylelint/stylelint/issues/2643 as files are linted first and then errors within disable ranges are removed. Feel free to investigate how the stylelint-commands code can be rearchitected to facilitate a new
/* stylelint .. */
command comment, as it’ll involve gathering the stylelint-commands before any linting happens so that the final configuration is known beforehand.Now is a good time to look into this as the internals have been improved as we move towards releasing 14.0.0 (see https://github.com/stylelint/stylelint/pull/5542 & https://github.com/stylelint/stylelint/pull/5521, in particular).
These command comments should take the highest precedence, over
overrides
and (the yet to be added)--rules
flag.I’ve labelled the issue as ready to implement. Please consider contributing if you have time.
Not sure what you mean @stof. You can enable/disable/customize ESLint rules through comments anywhere in a file. The rules also don’t have to be configured in
eslintrc
beforehand, so they can be ‘enabled from scratch’ so to say. This issue is not about enabling unknown rules, it’s about improving the Stylelint comments to allow for customizing of available rules. 🙂