Can't get VS Code Stylelint extension to lint in .ts files
Asked Answered
E

1

6

I'm setting up a React project with TypeScript and Styled Components from scratch. I've already done this before and in the previous project the VS Code Stylelint extension worked great.

However, in my new project I can't get it to work in .ts or .tsx files. It still does work in .js files. My setup is exactly the same as my previous project so I'm really confused about why it isn't working.

I've already opened an issue in the VS Code Github repo but it got closed immediately. The extension itself has disabled the possibility of opening any issues.

Some screenshots to illustrate my point:

Stylelint that works in a .js file Stylelint that works in a .js file

Stylelint that doesn't work in a .ts file Stylelint that doesn't work in a .ts file

Stylelint that works in a .ts file in another project Stylelint that works in a .ts file in another project

Please let me know if you need any more information about my configuration or about any stuff. Any help is greatly appreciated

EDIT: it looks like the author has deleted the extension..

Excursus answered 19/11, 2019 at 18:11 Comment(1)
Darn... this sucks. I just came looking for the same thing.Psalmbook
G
4

EDIT: it looks like the author has deleted the extension..

The stylelint VS Code extension is now maintained by the stylelint organisation. It is freely available from the Visual Studio Marketplace and from the extensions sidebar within VSCode.

It supports the language indentifers of:

  • TypeScript (typescript)
  • TypeScript React (typescriptreact)
Gracegraceful answered 6/2, 2020 at 15:27 Comment(1)
To clarify, in VS Code config add: "stylelint.validate": ["typescript", "typescriptreact", ...] The default is: "stylelint.validate": ["css", "postcss"]Catchpole

© 2022 - 2024 — McMap. All rights reserved.