Linting Best Practices
Quality gates that keep TypeScript Node codebases consistent, strict, and CI-enforced.
Search across all documentation pages
Quality gates that keep TypeScript Node codebases consistent, strict, and CI-enforced.
eslint.config.js). Legacy .eslintrc is deprecated path for new repos.typescript-eslint recommended or recommendedTypeChecked. Type-aware rules catch async mistakes.ignores for dist/, node_modules/, coverage. Generated output should never be linted.no-explicit-any in tests only.eslint-config-prettier prevents conflicts.format:check in CI. Read-only verify on every PR.--no-verify must not bypass quality..prettierignore excludes generated OpenAPI and dist. Avoid meaningless format churn.npm run typecheck (tsc --noEmit) on every PR. Types are not optional for TS backends.npm run lint -- --max-warnings 0 for zero-warning policy. Warnings become debt quickly.turbo run lint typecheck with cache. Per-package tasks stay in graph order.console.log in src/ via no-console. Use structured logger (Pino) in application code.eslint-plugin-import-x or Nx. Apps do not import sibling apps.no-extraneous-dependencies on production code. Phantom hoisted deps hide missing declarations.@ts-ignore without comment and ticket. Prefer @ts-expect-error with explanation.packages/eslint-config in monorepos. One source of truth for all services.npm ci ensures CI and local parity.Warnings are ignored in busy weeks and become thousands deep. --max-warnings 0 keeps the bar clear.
Strongly recommended for async Node code. If too slow, scope type-aware config to src/ only.
Prettier first, then ESLint --fix - matches pre-commit and avoids fighting fixes.
One PR enabling rules at warn, fix or suppress with tickets, then flip to error per directory.
Add @nestjs/eslint-plugin or recommended patterns for injectable classes and module boundaries.
Path filters can skip lint when only *.md changes; default should lint on any TS change.
Out of scope for ESLint; add dedicated tools but keep TS gates unchanged.
Relax any and console; keep no-unused-vars and import hygiene.
Platform or architecture team reviews changes; services consume versioned releases.
Same gates apply. Generated code must pass lint, typecheck, and test before merge.
tsc --noEmit gateStack versions: This page was written for Node.js 24.18.0 (Active LTS), npm 10+, TypeScript 5.6+, Express 5, Fastify 5, and NestJS 11.
Reviewed by Chris St. John·Last updated Jul 18, 2026