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

Fix custom formatters access to needless disables results #4136

Closed
shawnbot opened this issue Jun 26, 2019 · 1 comment · Fixed by #4393
Closed

Fix custom formatters access to needless disables results #4136

shawnbot opened this issue Jun 26, 2019 · 1 comment · Fixed by #4393
Labels
status: wip is being worked on by someone type: enhancement a new feature that isn't related to rules

Comments

@shawnbot
Copy link
Contributor

shawnbot commented Jun 26, 2019

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

I'm using a custom formatter to output logs so that our CI system can automatically create check annotations on GitHub. This works great for linting errors, but because the needless disables results are generated after the formatter is called, there's no way to access it without calling the underlying needlessDisables() function in the custom formatter.

(Side note: when I require('stylelint/lib/needlessDisables') and call it on the results in my custom formatter, things get really weird: the first (and/or last??) rule listed in my stylelint-disable comment is always reported as unused, but when I delete it the rule is applied and throws an error. 🙃)

Which version of stylelint are you using?

10.1.0

How are you running stylelint: CLI, PostCSS plugin, Node API?

CLI with stylelint --custom-formatter path/to/my/formatter.js

What did you expect to happen?

I expected the formatting function to get needlessDisables in one or more of its result objects, or as a second argument.

@alexander-akait
Copy link
Member

Yep, looks like bad design, PR welcome

@hudochenkov hudochenkov added status: wip is being worked on by someone type: enhancement a new feature that isn't related to rules labels Jul 19, 2019
@jeddy3 jeddy3 changed the title Custom formatters can't access needless disables Fix custom formatters access to needless disables results Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: enhancement a new feature that isn't related to rules
3 participants