vscode-stylelint: [Bug]: Unknown word (CssSyntaxError)Stylelint(CssSyntaxError)

How did you encounter this bug?

“Unknown word” on JavaScript file imports

error image

Code Snippet

No response

Stylelint Configuration

{ “extends”: [ “stylelint-config-recommended”, “stylelint-config-styled-components” ], “plugins”: [“stylelint-order”], “rules”: { “at-rule-no-unknown”: [ true, { “ignoreAtRules”: [ “extend”, “at-root”, “debug”, “warn”, “error”, “if”, “else”, “for”, “each”, “while”, “mixin”, “include”, “content”, “return”, “function” ] } ], “color-hex-length”: “long”, “order/order”: [“custom-properties”, “declarations”], “order/properties-alphabetical-order”: true } }

Extension Configuration

{
  "css.validate": false,
  "less.validate": false,
  "scss.validate": false,
  "stylelint.snippet": ["css", "scss", "less", "postcss", "javascript"],
  "stylelint.validate": ["css", "scss", "less", "postcss", "javascript"],
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.fixAll.stylelint": true
  }
}

Actual Behaviour

I need to lint my javascript files writing for styled-components, but always failed.

VS-Code version: Version: 1.67.1 for Apple Silicon

Stylelint version: v1.2.2

Expected Behaviour

I hope I can lint my styled-component’s files.

Logs

No response

Stylelint Version

1.2.2

vscode-stylelint Version

1.6.71

Node.js Version

14.16.0

Operating System

macOS 12.3.1

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint’s Code of Conduct

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 11
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Screenshot 2024-03-27 214048 Screenshot 2024-03-27 214109 Screenshot 2024-03-27 214158 Check if you have any other stylelint extensions installed like stylelint-plus. Uninstall it and install the official stylelint. That worked for me.

In VSCode go to settings > type ‘Stylelint’ > Stylelint + config > unchecked Stylelint: Enable.

I had the same problem and found I had 2 different Stylelint extension installed in VS Code. I uninstalled both and then installed just one, the error went away.

Disabling stylelint does fix the error but then you don’t get any benefit of having Stylelint there at all…

@shubhamrawat090 Thanks Man. Saved a Ton 🙏🤝. This problem was frustrating a lot. The style-lint extension was causing the issue.

No problem. I can understand the pain bro.

I am getting this error in html and md files in vs code.

Th

Screenshot 2024-03-27 214048 Screenshot 2024-03-27 214109 Screenshot 2024-03-27 214158 Check if you have any other stylelint extensions installed like stylelint-plus. Uninstall it and install the official stylelint. That worked for me.

Thankyou man, this was a very frustrating error

@shubhamrawat090

Thank you so much.


First of all, thank you for building the extension but I want to tell the team that facing this issue was really really frustrating, and pain. I wasted two work days by causing this issue. When I work to a Nuxt or Vue project I get this issue EVERY SINGLE TIME. Despite of 2025 why this extension cause this kind of error?

@shubhamrawat090 Thanks Man. Saved a Ton 🙏🤝. This problem was frustrating a lot. The style-lint extension was causing the issue.