Testing & Code Quality

ESLint & typescript-eslint

ESLint catches code-quality and correctness issues through configurable rules. typescript-eslint lets ESLint parse TypeScript and run TypeScript-aware rules that use compiler type information.
  • Linting is automated code review for repeatable concerns
  • Typed rules are more powerful and more expensive
  • Rule severity should reflect real risk
  • Flat config is the modern ESLint configuration direction
  • Linting should support project style, not become the project
Typed linting shape
export default [
  {
    files: ["**/*.ts", "**/*.tsx"],
    languageOptions: {
      parserOptions: {
        projectService: true,
      },
    },
    rules: {
      "@typescript-eslint/no-floating-promises": "error",
      "@typescript-eslint/no-explicit-any": "warn",
    },
  },
]
Typed linting can catch issues the TypeScript compiler alone may not report.
Lint rule categories
CategoryExample
Correctnessno-floating-promises
Safetyno-explicit-any / no-unsafe-assignment
Maintainabilityno-unused-vars, complexity
Style consistencynaming conventions
Framework rulesReact hooks, testing-library rules
Sources
  • ESLint DocumentationESLint configuration and rules
  • typescript-eslint DocumentationTyped linting
  • The TypeScript HandbookTypeScript tooling