question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for enabling a rule with stylelint-command comments

See original GitHub issue

What 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:open
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jeddy3commented, Sep 25, 2021

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.

0reactions
AndreasNasmancommented, Nov 27, 2021

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. 🙂

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found