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 reportDescriptionlessDisables option #4868

Closed
nex3 opened this issue Jul 16, 2020 · 2 comments · Fixed by #4907
Closed

Add reportDescriptionlessDisables option #4868

nex3 opened this issue Jul 16, 2020 · 2 comments · Fixed by #4907
Labels
status: ready to implement is ready to be worked on by someone type: enhancement a new feature that isn't related to rules

Comments

@nex3
Copy link
Contributor

nex3 commented Jul 16, 2020

What is the problem you're trying to solve?

Within Google, we want to require that all exceptions to stylelint rules are documented.

What solution would you like to see?

As I understand it, stylelint-disable-reason (#2227) was deprecated because there was no inherent connection between a comment existing immediately before a /* stylelint-disable */ tag and that comment actually providing a reason for the disabled lint. Now that #4840 is implemented, there's a more explicit way to provide a description for a disable tag, but there's still no way to enforce it.

Judging by issues like #2292, it seems like the best way to model this would be as a flag rather than as a rule. So I propose a reportDisablesWithoutDescriptions flag that flags any disable tag that doesn't have an associated reason as a violation.

If this is something you'd be amenable to, my team can probably implement it.

@mattxwang
Copy link
Member

Hey @nex3, thank you for using the issue template!

Overall, I agree, I think this is a good feature to add, and a flag seems like the appropriate way to add it. I'm still pretty new to the project, so would like to defer to someone on @stylelint/core for a second look-over!

@mattxwang mattxwang added status: needs discussion triage needs further discussion type: enhancement a new feature that isn't related to rules labels Jul 17, 2020
@jeddy3
Copy link
Member

jeddy3 commented Jul 18, 2020

@nex3 Thanks for the request. Sound good to me.

Let's go with a reportDescriptionlessDisables option. It'll be similar to the existing reportNeedlessDisables one.


CLI flags: --report-descriptionless-disables, --rdd

Produce a report of the stylelint-disable comments that are without descriptions.

If needless disables are found, the:

  • CLI process exits with code 2
  • Node.js API adds a descriptionlessDisables property to the returned data

If this is something you'd be amenable to, my team can probably implement it.

That would be fantastic!

@jeddy3 jeddy3 changed the title Add a way to require descriptions in stylelint comments Add reportDescriptionlessDisables option Jul 18, 2020
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone and removed status: needs discussion triage needs further discussion labels Jul 18, 2020
jathak added a commit that referenced this issue Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone type: enhancement a new feature that isn't related to rules
Development

Successfully merging a pull request may close this issue.

3 participants