How to lint TypeScript with ESLint

preview_player
Показать описание
A lot of people have been asking me about this.

Рекомендации по теме
Комментарии
Автор

Hi Kent! Thanks for the helpful video - I'm definitely going to stick with tslint!

Btw, TypeScript does know that console.log returns void, but I think you need to turn on `noImplicitAny` (in `tsconfig.json`) to get it to complain.

Absolutely with you about using prettier to *fix* formatting issues rather than a linter to *spot* formatting issues. My team takes that a step further and uses prettier to insert the semicolons automatically; using our configuration prettier would combine those two statements into a single line, making it obvious to any developer how it's being interpreted (even if they don't understand the awful ASI rules) and then TypeScript comes and complains about the types.

SidheS
Автор

Hey Kent! Great job! Just a small detail, the text in the video I can barely read it. I mean it hurt to read any text, it's like is coded with a low-graphic even if I put in 720p HD. Could you improve it? Thanks!

tomtobac
Автор

Seems like after adding these parser options you have to restart VScode Eslint extension (by restarting VScode), or else the changes are not getting picked by extension

filipitskov
Автор

A great post, thanks for posting the repo aswell.

MerisBahtijaragic
Автор

Btw, I'm on the 6th minute, but to note. (edit: yea you said it)
What I'm doing is using the babel-eslint and put the .ts and .tsx extensions to the import resolver settings (I think, eslint-plugin-import-resolver is called, both Airbnb and Standard has it). I really don't want to trust typescript-eslint-parser. BUT, using that approach, I'm not sure what happens if you want to use features that TS is not supporting, but because you are using Babel to compile TS, and you want lets say stage 2 things (as far as i know TS support only >= stage 3+? )? So not sure what happens.

xWes
Автор

Huh, I finally may jump on that train because of you.

xWes
join shbcf.ru