stylelint and stylelint-config-wordpress are linting JS files.
cagross opened this issue · comments
Hello. I have installed both stylelint
and stylelint-config-wordpress
, and when I open a CSS file, it is linted by stylelint, with the WordPress rule set. That is great--thanks for the previous assistance. But should the same occur if I open a JavaScript file? I ask because stylelint
is indeed linting such files (screenshot). I was under the impression installing stylelint
and stylelint-config-wordpress
would result in only CSS files being linted (and maybe related CSS files, like SCSS). If not, what am I misunderstanding?
Thanks.
Yes, as you can see it only lints the "CSS inside JavaScript", looking at the warningss it looks like there might be an indentation issue of those 4 lines, make sure there are no spaces in that indentation, if correct try 6 tabs, 4 tabs etc to test to find the root cause of the warnings
OK right, CSS inside JS makes sense. And now that I disable my other JS linter (ESLint), I can clearly see that stylelint is linting the CSS in this document. Thanks for the clarification.
What about other file types that might include CSS, like PHP or HTML? Will stylelint lint those as well? I guess from the page you linked, these are the file types it lints:
"css-in-js"|"html"|"less"|"markdown"|"sass"|"scss"|"sugarss"
So CSS in PHP would not be linted. Am I understanding that correctly?
It will also lint CSS in PHP via the HTML syntax component, though it will only pick up the CSS in PHP when it sees the style=
element in the PHP
OK interesting--I'll keep that in-mind. Thanks for all that.