News for hackers. Stuff that matters.
Re:Starting a TypeScript Project in 2021 by dtech on Wednesday April 21, 2021 @10:33AM (#26890161)
Linting is not the same as typechecking. Take a look at the default available rules [1]. For example number == NaN is valid Javascript, but 99.9% of the time an error. Or you might want to require always using === over ==.

Generally, linting is things that are valid in the language, but still better to do otherwise.

[1] https://eslint.org/docs/rules/

Re:Starting a TypeScript Project in 2021 by meheleventyone on Wednesday April 21, 2021 @10:38AM (#26890231)
I’m aware of the difference just wondering what benefits people have found. Catching == versus === is a good one.
Re:Starting a TypeScript Project in 2021 by ponyous on Wednesday April 21, 2021 @12:30PM (#26891817)
import order, empty function bodies, leading underscores in different scenarios (if you have such conventions), sort object keys (not just alphabetically, but by use, eg. shorthands last { name: 'Jim', surname }...)

There is some overlap and it's not as crucial to have a good linter as it used to be.

Re:Starting a TypeScript Project in 2021 by GORRILA on Wednesday April 21, 2021 @11:09AM (#26890653)
Two common rules I like to enforce are no nested ternaries and no unused variables.
Re:Starting a TypeScript Project in 2021 by maga on Wednesday April 21, 2021 @11:29AM (#26890944)
tsconfig's noUnusedLocals can help you with the last one.
Re:Starting a TypeScript Project in 2021 by city41 on Wednesday April 21, 2021 @12:57PM (#26892248)
And it allows you to opt out when needed by starting the variable with an underscore, which is much nicer than eslint-disable-next-line...
Re:Starting a TypeScript Project in 2021 by DEiE on Wednesday April 21, 2021 @01:41PM (#26892947)
Re:Starting a TypeScript Project in 2021 by city41 on Wednesday April 21, 2021 @01:49PM (#26893048)
Ah nice, I didn't know that. Thanks.