VS Code style-lint ignore directories
Asked Answered
U

3

6

Is it possible to ignore my CSS path, beacuse I only use stylelint for SCSS validation?

e.g. - I have the following structure:

assets/
    css/
    scss/

How can I disable the css/ folder from being indexed, trough the settings.json file of VSCode?

I found this in the docs, but I don't know how to implement it in VSCode.

Unruffled answered 6/2, 2017 at 14:56 Comment(0)
B
14

If you're using the VS Code stylelint extension, you can specify ignore paths via the stylelint.configOverrides setting.

Add the following to your VS Code settings.json file:

"stylelint.configOverrides": {
    "ignoreFiles": "assets/css/**"
}

Alternatively you can add a .stylelintignore file to the root folder of your project and add the ignore paths there:

assets/css/**
Ballenger answered 7/2, 2017 at 22:6 Comment(2)
For anyone who reaches here, stylelint.configOverrides is not deprecated. However there is a PR to support ignoreFilePath.Cauley
^ IS NOW DEPRECATED* :)Cauley
S
8

I'm using [email protected] with [email protected], and for me the .stylelintignore file is not being respected. If i use the CLI it is respected but the vscode plugin does not seem to do this correctly.

Sawfly answered 9/4, 2018 at 1:34 Comment(1)
I found that it seemed like my .stylelintrc.js was not being respected, even if I restarted VSCode, the ignored files still showed errors. However I had to change the ignored files, and then save them (saving without modifying them didn't work) and then it seemed to pickup they were ignored and all the errors went away. Something a little odd going on there.Cyd
D
1

Similar to Jack Russell, I found that the VS Code stylelint plugin currently seems to ignore the .stylelintignore file.

To get around this limitation, I removed the .stylelintignore entirely and moved its settings into .stylelintrc instead. I.e. from something like this in .stylelintignore:

ignorethisfolder/**/*
path/to/ignorethisfile.css

To something like this in .stylelintrc:

  "ignoreFiles": [
    "ignorethisfolder/**/*",
    "path/to/ignorethisfile.css",
  ]
Demibastion answered 18/3, 2021 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.