TypeScript Standard
TypeScript Standard
Non-Negotiables
- Airbnb + typescript-eslint define style and correctness.
strict: trueis the baseline.- Types are documentation. If it’s ambiguous, it’s broken.
- Runtime validation for external inputs is mandatory. Types do not protect you at runtime.
Minimum Requirements (Industry Standard Baseline)
Formatting & Linting
- Format with Prettier.
- Lint with ESLint + @typescript-eslint.
- CI must fail on lint/type errors.
Type Safety
- Enable
strict(and keep it on). - Avoid
any. Preferunknown+ narrowing. - No non-null assertions (
!) unless proven safe and documented.
Error Handling
- Never ignore rejected promises.
- Use explicit error boundaries (API layer, worker handler, job runner).
- Provide stable error codes for API consumers.
API & Data Validation
- Validate external inputs (HTTP payloads, queue messages, env vars).
- Prefer schema validators (e.g. Zod/Yup/Joi) and keep schemas close to boundaries.
Dependency Hygiene
- Pin critical dependencies.
- No unused dependencies; no dead code.
References
- Airbnb JavaScript Style Guide: https://github.com/airbnb/javascript
- typescript-eslint: https://typescript-eslint.io/
- TypeScript
strictmode: https://www.typescriptlang.org/tsconfig/#strict - Prettier: https://prettier.io/docs/en/
- ESLint: https://eslint.org/docs/latest/