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
Report disable errors the same way as lint errors #4896
Comments
Sounds good to me. I don't know why we didn't do that originally. |
Rather than returning disables that are considered "invalid" for various reasons (such as --report-needless-disables) as a separate list of objects that formatters must handle individually, stylelint now converts them into standard lint warnings. This allows formatters to automatically format them the same as normal warnings without any extra disable-specific code. Closes #4896
Rather than returning disables that are considered "invalid" for various reasons (such as --report-needless-disables) as a separate list of objects that formatters must handle individually, stylelint now converts them into standard lint warnings. This allows formatters to automatically format them the same as normal warnings without any extra disable-specific code. Closes #4896
Stylelint makes the distinction between "warnings" (displayed with yellow triangles) and "errors" (displayed with red Xs). Normally, lints have a way of configuring which type they'll be reported as, but since these aren't configurable in the same way we had to make a choice—I chose errors, to match the idea that failing one of these requirements would cause the linter to produce a non-zero exit code. |
I get a 0 exit code with these in the command line: $ ./node_modules/stylelint/bin/stylelint.js --rd src/styles/widgets/SelectFileWidget.less
src/styles/widgets/SelectFileWidget.less
21:4 ✖ Needless disable for "plugin/no-unsupported-browser-features" --report-needless-disables
$ echo $?
0 Similarly, using the Node API, the "errored" flag is not set, and these are marked as warnings. |
I'm surprised by that, but I'm afraid you've reached the limit of my stylelint expertise 🤷♀️. Maybe one of the more experienced maintainers could chime in? |
I opened #5046 this morning for the wrong error code. |
As I see regression is here #4973 We need to hit this condition stylelint/lib/prepareReturnValue.js Line 36 in 0fdef35
for https://github.com/stylelint/stylelint/blob/master/lib/cli.js#L563 feel free to send a PR |
Currently, errors caused by
reportNeedlessDisables
,reportInvalidScopeDisables
, and eventuallyreportUnscopedDisables
(#2292) andreportDisables
(#4875) are reported in a format that's inconsistent with (and less visually appealing than) the way normal lints are recorded.I propose that these disable issues instead be converted to the same object structure as lints, and be passed to the standard lint formatter to be reported appropriately. That way they'll automatically play nicely with both default and custom formatters, and look consistent with the most common reports.
The text was updated successfully, but these errors were encountered: