Paris Qian Sen
Paris Qian Sen

Reputation: 1099

Can I stop stylelint extension from validating JavaScript file?

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.

Upvotes: 11

Views: 5460

Answers (3)

Sumitha
Sumitha

Reputation: 11

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

Upvotes: 1

jeddy3
jeddy3

Reputation: 3959

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.

Upvotes: 18

ChrisR
ChrisR

Reputation: 4008

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.

Upvotes: 1

Related Questions