-
-
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
Document fix
and output
behaviour for Node.js API usage
#5964
Comments
fix
and output
behaviour for Node.js API usage
@jlarmstrongiv Thanks for the report and for using the template. The autofixed code is available as the value of the For example, the following code: import stylelint from "stylelint";
const result = await stylelint.lint({
code: "a { color: hsl(30 10% 15% / 5%) }",
config: {
rules: {
"hue-degree-notation": "angle",
},
},
});
console.log(result); Gives:
(The default formatter for the Node.js API is JSON.) Whereas: import stylelint from "stylelint";
const result = await stylelint.lint({
code: "a { color: hsl(30 10% 15% / 5%) }",
config: {
rules: {
"hue-degree-notation": "angle",
},
},
fix: true,
});
console.log(result); Gives:
We need to update this part of the docs to reflect that behaviour. I've labelled the issue as ready to implement. Please consider contributing the documentation fix if you have time. |
Describe the documentation issue
I would like to run stylelint to fix styles programmatically with the node api.
To compare, prettier has a node api that will format my code input string and return my prettified code output string:
However, with stylelint, I receive many other objects with no clear path to just get my linted code back. I dug around in
linted.results[0]._postcssResult
, but couldn’t find it. I also tried all the formatters.What solution would you like to see?
I would love to see documentation on how to pass a css string to the stylelint node api and received my fixed css string back
The text was updated successfully, but these errors were encountered: