Can I stop stylelint extension from validating JavaScript file?
Asked Answered
I

3

11

Good day,

enter image description here

In above picture, stylelint prompt a CSS error in a JS file. Is there a way to stop stylelint from validating javascript file, I coundn't find such option in their official configuration guide.

Thanks a lot.

Inhalant answered 1/6, 2018 at 8:56 Comment(0)
B
18

The linter can be configured to ignore specific files using the ignoreFiles property of the stylelint configuration object.

You can try ignoring JavaScript files with:

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

I believe the stylelint Visual Studio Code extension will respect this property.

Bukovina answered 12/6, 2018 at 7:43 Comment(3)
I can't get this to work. Seriously, why does it even do this? Only option that works for me is to disable stylelintHarriman
Now it works after removing old extension from VSCode and installing up to date one.Harriman
Worked for me, I had to restart vscode for some reason.Auvergne
M
1

Look at this part in the documentation.

You can specify /* stylelint-disable */ at the top of a file to disable the whole file from being lint.

Or, better, juste specify /* stylelint-disable-line */ to disable for a single line.

Milurd answered 7/6, 2018 at 9:3 Comment(2)
In this case, we need to manually disable the linting for all js files. Normally we shouldn't have any styling clauses in js file, right? Except for JSX.Inhalant
This solution requires this comments to be placed in each and every JS file.Limacine
I
1

stylelint:validate You can stop style-lint from VScode to ignore the javascript file too.

In settings search for stylelint -> at the bottom you can see Stylelint:Validate part. Select javascript and delete. It should fix your problem

Indamine answered 8/12, 2020 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.