How to lint TypeScript with ESLint

  Рет қаралды 5,787

Kent C. Dodds

Kent C. Dodds

Күн бұрын

Пікірлер: 12
@SidheS
@SidheS 5 жыл бұрын
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. (You can try it in the TS playground here: www.typescriptlang.org/play/#src=console.log(%22hi%22)%0D%0A%5B1%5D.forEach(n%20%3D%3E%20console.log(n))%3B%0D%0A - it's in the options dropdown) 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.
@MerisBahtijaragic
@MerisBahtijaragic 5 жыл бұрын
A great post, thanks for posting the repo aswell.
@jed_fox1
@jed_fox1 5 жыл бұрын
We’re working on finding/making alternatives to all the TSLint rules over at eslint-plugin-typescript: github.com/bradzacher/eslint-plugin-typescript/blob/master/ROADMAP.md
@xWe2s
@xWe2s 5 жыл бұрын
Huh, I finally may jump on that train because of you.
@tomtobac
@tomtobac 5 жыл бұрын
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!
@KentCDodds-vids
@KentCDodds-vids 5 жыл бұрын
I've figured out what happened there and fixed it.
@xWe2s
@xWe2s 5 жыл бұрын
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.
@KentCDodds-vids
@KentCDodds-vids 5 жыл бұрын
If you're using babel's parser then you should be good with whatever babel supports.
@xWe2s
@xWe2s 5 жыл бұрын
@@KentCDodds-vids Kool. I should try it then.
@filipitskov3742
@filipitskov3742 5 жыл бұрын
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
@lavi476
@lavi476 5 жыл бұрын
way not use TSlint ?
@OscarFunes
@OscarFunes 5 жыл бұрын
He explained in the video, they have some internal eslint rules that they didn't want to migrate to tslint
Add Cypress to a gatsby app
35:43
Kent C. Dodds
Рет қаралды 2,2 М.
Why I always use ESLint in my projects
7:55
Web Dev Cody
Рет қаралды 67 М.
Wait for it 😂
00:19
ILYA BORZOV
Рет қаралды 10 МЛН
ЗНАЛИ? ТОЛЬКО ОАЭ 🤫
00:13
Сам себе сушист
Рет қаралды 3,8 МЛН
Configuring ESLint and Prettier for TypeScript
1:10:32
LogRocket
Рет қаралды 17 М.
At Last! Simple details/summary animation with pure CSS
12:36
Kevin Powell
Рет қаралды 18 М.
C Programming Tutorial for Beginners
3:46:13
freeCodeCamp.org
Рет қаралды 14 МЛН
Think Fast, Talk Smart: Communication Techniques
58:20
Stanford Graduate School of Business
Рет қаралды 41 МЛН
Making Minecraft 100x faster (by rewriting it in Rust)
17:02
Theo - t3․gg
Рет қаралды 27 М.
Talk Practice: React and the Vanishing Network
42:36
Kent C. Dodds
Рет қаралды 1,2 М.
Precommit Hooks Are Bad
2:13
Theo - t3․gg
Рет қаралды 59 М.