-
-
Notifications
You must be signed in to change notification settings - Fork 927
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
Make --report-needless-disables CLI flag respect stylelint-disable commands #4203
Comments
Thank you for clarification! |
|
Right now it is required ( |
So, just to clarify, there's not a way to run stylelint normally (ie respecting disables) while also reporting disables that are needless? |
stylelint can't handle the flag with linting stylelint/stylelint#4203 . I kept it for fixing, since that ignored disables anyway stylelint/stylelint#2643 .
stylelint can't handle the flag with linting stylelint/stylelint#4203 . I kept it for fixing, since that ignored disables anyway stylelint/stylelint#2643 .
This is how eslint works. The behavior should probably be matched. I expect it to work like above |
|
Came back to report the same thing, thought v11 would have the desired behavior but it still ignores my disabled-comments. Right now I have to run stylelint twice like @maxmilton suggested |
This makes sense. Labeling as "help wanted" and "enhancement" (rather than future-next milestone) as the change will result in fewer warnings. |
I think I would be keen to implement this, but looking around the code I’m not quite sure where to start – can anyone offer some guidance? This seems like quite a big change if the current implementation relies on the commands being disregarded in order to produce the report. |
Yes, I think it'll require some architectural changes. The author of the majority of the engine code is no longer active. However, I can provide a potted history of our design decisions. In the beginning stylelint was solely a PostCSS plugin. We used PostCSS's Hopefully, this gives you a sense of the parts involved. The set of features grew organically, and only now are we in a position to see the complete picture. I believe we need to reassess how we report violations. One idea could be changing You're welcome to create a proof of concept pull request to see if this approach is viable. It's just an idea, though. Investigating how ESLint does it is another option. Having someone champion the engine code would be fantastic, and it's an opportunity to make it your own. |
Thank you @jeddy3, since this requires quite in-depth changes your input is invaluable. I’ve had a brief look at how ESLint did it and was able to make some sense of it (I think!). It’s hard to judge which is the best way forward for this in stylelint though. So it does sound like a proof of concept PR is a good plan. I can’t commit to doing this just because of how much time this is going to take, but will try to at least have another look at this from an architectural standpoint and report back. |
No worries.
Yes, I'm not sure how much the underlying architectures differ.
That's understandable. It's a sizable piece of work. I believe everyone who contributes to stylelint does so in their spare time, so we rarely work on these time-consuming issues. Hopefully, a corporation will back someone to work on them in the future. |
When using
--report-needless-disables
, it ignores all of mystylelint-disable
s.all
e.g.
Commit
d3a6cb47fc2d5c59e61f6fac618c6121b316b97c
(it comes with some--report-needless-disables
fix that I need since the last release)stylelint --report-needless-disables
The problem applies to both
For it to disable the rules
They were not disabled, receive these errors:
Without the flag, these errors do not appear.
I messed up reporting #4190, it happens even without
--fix
.The text was updated successfully, but these errors were encountered: