Skip to main content

ADR-0048: ESLint for Code Quality

Status

Accepted - 2025-01-26


Context

TypeScript codebase needs consistent style, error prevention, and best practices enforcement.


Decision

ESLint 9.x with TypeScript ESLint plugin.

Rationale

  1. Industry Standard: Most popular JavaScript linter
  2. TypeScript Support: @typescript-eslint/parser
  3. Extensible: 300+ plugins available
  4. Auto-Fixable: Most issues fixable via --fix

Configuration

// eslint.config.js (ESLint 9.x flat config)
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';

export default [
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsparser,
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
// TypeScript
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': 'off',

// Best Practices
'no-console': ['warn', { allow: ['warn', 'error'] }],
'prefer-const': 'error',
'no-var': 'error',

// Code Style (handled by Prettier)
'indent': 'off',
'quotes': 'off',
},
},
];

CI/CD Integration

# GitHub Actions
pnpm lint # Fails if errors

References