6 ms·
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
by dtech 5y ago
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/ https://eslint.org/docs/rules/
- meheleventyone 5y agoI’m aware of the difference just wondering what benefits people have found. Catching == versus === is a good one.
- GORRILA 5y agoTwo common rules I like to enforce are no nested ternaries and no unused variables.
- ponyous 5y agoimport 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.