shaq/typescript icon
public
Published on 5/8/2025
shaq/typescript

Enforce good practice for writing Typescript code

Rules

Typescript

Build & Development Commands

  • Use a strict TypeScript configuration ("strict": true in tsconfig.json).
  • Ensure all dependencies are installed and updated using npm install or yarn install.
  • Favor ES modules over CommonJS unless compatibility requires otherwise.

Testing Guidelines

  • Write unit tests for functions and components using Jest or Vitest.
  • Use type assertions sparingly in tests (as Type<T>).
  • Ensure test coverage remains high with npm test --coverage.

Code Style & Guidelines

  • Always enable ESLint and Prettier to enforce code consistency.
  • Follow the single responsibility principle—each function should do one thing.
  • Prefer explicit types over implicit inference when dealing with complex structures.

Documentation Guidelines

  • Add meaningful JSDoc comments for public functions and classes.