Stylistic choices
No classesโ
- red-javascript-style-guide - why disallow class
- Sheriff is trying to promote a "light functional" approach. Javascript classes don't fit such design
No reduceโ
info
Sheriff actually allows using reduce
for very simple operations like summing up numbers. Complex operations are banned.
No enumsโ
- eslint-plugin-typescript-enum - README
- Enums considered harmful
- How to use TypeScript Enums and why not to, maybe
- Let's Talk About TypeScript's Worst Feature
- Effective Typescript book explicitly warn against this, saying that
enums
belong to a legacy design choice of Typescript.
No overloadsโ
- generics supersedes them. Overloads are a legacy feature that was made available in Typescript before generics were a thing. Overloads are mostly a C#/Angular leftover. Simply put: there are no problems that function overloads solve better than generics
- overloads clutter the code and make it more verbose and harder to read, which increase the cognitive overload
- overloads clutter the VScode tooltips
- overloads force you to write non-standard javascript syntax
- overloads are a bad practice. The flexibility that they enable also enable your team to write inconsistent code. Which is exactly the problem that ESLint is designed to solve
- Effective Typescript book explicitly warn against this, saying that "conditional types" are preferrable.