Closed jmpolom closed 4 months ago
@cpof-tea can you double check this? You made the last changes to this linter, and I don't use it.
Looks like at some point stylelint changed from outputting problems to stdout
to stderr
: https://github.com/stylelint/stylelint/blob/main/docs/migration-guide/to-16.md#breaking-changes
@jmpolom indeed. I have stylelint v14.15.0, and it outputs to stdout
@mfussenegger is there any way we can dynamically change stream
property for backward compatibility?
If the linter doesn't output anything in the other stream, setting both
could be an option.
Otherwise the linter could be implemented as function()
that first calls stylelint --version
(if that's supported), parses the version and depending on that returns a different table. But not sure if that's worth it.
stylelint -v
does return a version string. Would it be possible to define the stream
as a function in the linter config as is done for cmd
? Seems like that could work if backwards compatibility is necessary.
Otherwise the linter could be implemented as
function()
I didn't know it is supported, that's why I asked.
first calls
stylelint --version
(if that's supported), parses the version and depending on that returns a different table. But not sure if that's worth it.
Why not. At least it feels more natural, than just pretending we know if other streams used or not.
I will try to implement
Could you first try setting the stream to both
? If that works, it's a much simpler solution.
@mfussenegger okay, it works.
@jmpolom could you please set both
to stream
option?
I think this pr can be merged as is stream = "sterr"
so that it is compatible with the stable version of stylelint.
Personally, to have backward compatibility I inserted:
local stylelint = require("lint").linters.stylelint
stylelint.stream = "both"
It may be correct that the choice to use both
is optional.
It seemed that the change by Stylelint to output errors to stderr
was permanent. Based on that I agree with @albnavarro and this should be merged as-is. This module should support the current stable upstream linter version which outputs lint messages to stderr
.
This seems to and should resolve #500