Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable VS Code Stylelint errors in React JavaScript files [duplicate]

enter image description here

[stylelint] Unexpected missing end-of-source newline (no-missing-end-of-source-newline)
[stylelint] Expected "backgroundColor" to be "backgroundcolor" (value-keyword-case)
[stylelint] Expected a trailing semicolon (declaration-block-trailing-semicolon)

How do I stop the VS Code Styleint extension from reporting things like this? It's not particularly useful as you can see :P

UPDATE:

To clarify, I have a .stylelintrc configuration file and my rules are as I want them but I want it to lint my styles and not my JavaScript. The extension description says:

stylelint automatically validates documents with these language identifiers:

...and javascriptreact is one of those language identifiers. I would like to know how to stop the extension from validating javascriptreact documents.

like image 423
jjenzz Avatar asked Dec 04 '22 19:12

jjenzz


1 Answers

TL;DR

Here's a working example of .stylelintrc file which makes VS Code ignore JS/JSX files:

{
  "ignoreFiles": [
    "**/*.js",
    "**/*.jsx"
  ]
}

Don't forget to restart VS Code after changes!


Explanation

Stylelint extension for VS Code reads .stylelintrc, so you can use ignoreFiles key in order to stop VS Code from linting styles on certain file types.

As documentation stands, you could also use .stylelintignore file, but it's not working for me as VS Code seems to ignore that file.

like image 57
Desko27 Avatar answered Dec 27 '22 06:12

Desko27