Enabling Eslint on typescript files
--ext
allows using custom javascript extensions, you can't force ESLint to work for languages other than JavaScript by passing a different file extension to it.
You can try using typescript-eslint-parser to enable ESLint for Typescript - it allows building a syntax tree from typescript code that can be passed to ESLint for linting.
But I'd suggest using Typescript linters for inspecting TypeScript code. You can try TSLint, for example.
Update: since 2017.1.3, WebStorm supports ESLint + typescript-eslint-parser; you just need to install both typescript
plugin and typescript-eslint-parser
and modify your ESLint config accordingly:
"parser": "typescript-eslint-parser",
"plugins": ["typescript"]
2020 answer:
My problem was ESLint errors/warnings weren't showing up in the Problems tab in WebStorm (this also works for Rider) for .ts files, even though VS Code was working fine (showing warnings/errors) for the very same file.
Solution:
- Press CTRL+SHIFT+A
- Search for "Registry..."
- Start typing
eslint.additional.file.extensions
to find that registry entry
- Set value of
eslint.additional.file.extensions
tojs,ts
(like in screenshot above)
Probably you should restart editor just to be sure. This worked for me (errors/warnings started appearing in Problems section just like in VS Code) and I'm using @typescript-eslint/[somethinghere]
rules etc.