- Use the guidelines for JavaScript
- Use TypeScript in strict mode
- Use ESLint and Prettier for auto-formatting and auto-fixing
- Use Jest for unit testing
- Prefer Functions over Classes
- Prefer functional style (map/filter/reduce) over iteration (for/while/.each)
- Prefer arrow functions
=>
, over thefunction
keyword except when using Generics - Use Generic Constraints when possible
- Use
PascalCase
for Interfaces and Type Aliases - Use readonly properties where applicable
- Use Const Assertions where applicable to avoid type widening
- Avoid complex conditionals inside TSX
- Avoid Mixins
- Avoid Decorators
- Avoid Overloading Functions
- Prefer async/await over traditional promise syntax
- Prefer Optional Properties in an interface rather than declaring the
property type as
T | undefined
- Prefer explicitly defining interfaces over Extending Interfaces
- Avoid the use of the any type
- Avoid the Non-null assertion operator
- Avoid Type Assertions
- Prefer the
as
-syntax for Type Assertions over the angle-bracket syntax - Use the Nullish coalescing operator
- Prefer Type Guards over Type Assertions
- Prefer Union Types, Lookup Types, Mapped Types and Const Assertions over Enums