Skip to content
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

Add meta data for type of rule #7362

Open
slalomzacharyd opened this issue Dec 1, 2023 · 2 comments
Open

Add meta data for type of rule #7362

slalomzacharyd opened this issue Dec 1, 2023 · 2 comments
Labels
status: needs discussion triage needs further discussion

Comments

@slalomzacharyd
Copy link

What is the problem you're trying to solve?

As a user, I want to be able to not see errors for rules that are fixable by stylelint. eslint finally supports this more out of the box with newer versions and stylelint should follow the same pattern.

While stylelint supports manually changing warnings levels, its a bit abusive. In order to do so, you need to copy all of the rules from either standard or recommened, then individually check which ones are fixable on the website. There is no metadata to find fixable rules which are almost always stylistic.

What solution would you like to see?

  • Either a solution similar to eslint -> https://eslint.style/
  • Or at least some kind of supported metadata to programmically find the fixable rules.

A lot of linters have a pattern of making a wall of busy work errors when the majority are auto fixable by the app. There is no reason to create busy work or try to distract engineers.

@ybiquitous
Copy link
Member

ybiquitous commented Dec 1, 2023

@slalomzacharyd Thanks for using the template. I understand your motivation well. But your expectation seems to have been realized. See this online demo on StackBlitz.

image

You expect Stylelint doesn't output anything when using --fix, right?

Code

Using Stylelint 15.11.0:

@import url('foo.css');
module.exports = {
  rules: {
    'import-notation': 'string',
  },
};

@jeddy3 jeddy3 added the status: needs discussion triage needs further discussion label Dec 2, 2023
@jeddy3
Copy link
Member

jeddy3 commented Dec 17, 2023

@slalomzacharyd Thanks for the request.

I want to be able to not see errors for rules that are fixable by stylelint

As @ybiquitous said, this is current behaviour when --fix is used. There's the related #7338 to signpost this better when it's not.


Am I right in thinking that the crux of the issue is?:

There is no metadata to find fixable rules which are almost always stylistic [emphasis mine].

We currently split our rules into two:

  • avoid errors
  • enforce conventions

(For reference, ESLint does three: Possible Problems, Suggestions, and Layout & Formatting.

We currently have meta.fixable, but there is no way to programmatically know what category a rule belongs.

eslint finally supports this more out of the box with newer versions

Are you referring to the type metadata and --fix-type option?

We can discuss adding something similar to Stylelint. If we do, we'll want to lock down the types as they'll become part of our public API rather than just for documentation.

@jeddy3 jeddy3 changed the title Split out stylistic roles similar to eslint Add meta data for type of rule Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs discussion triage needs further discussion
Development

No branches or pull requests

3 participants