TypeScript & ESLint Standards

Standard TypeScript and ESLint configuration for projects. Reconciled with CGD-01 and CGD-02 on 2026-10-02; agent-facing versions live in Rules.

TypeScript Configuration

Standard Settings

SettingValueRationale
targetES2022Modern JavaScript features support
stricttrueType safety enforcement
moduleResolutionby archetype (see below)Published code must resolve in raw Node ESM
isolatedModulestrueRequired for esbuild/swc transpilers

Path Aliases

Projects can use a @shared/* alias for shared utilities:

import { fetchWithRetry } from '@shared/utils/fetchWithRetry';

Project-Specific Overrides

Module settings follow the archetype (CGD-01):

ArchetypesmodulemoduleResolutionRelative imports
A4, A7, A8, A14 (TypeScript repos), A17NodeNextNodeNext.js extension needed
A9, A10, A11, A12, A20, A22 (bundled by Vite et al.)ESNextbundlerExtensionless
  • React projects: Add "jsx": "react-jsx" and DOM libs

ESLint Configuration

All projects use ESLint flat config format (eslint.config.js). Legacy .eslintrc.* files are not allowed (CGD-02); ESLint 9 ignores them by default and ESLint 10 removes support.

React + TypeScript Template

import js from '@eslint/js';
import globals from 'globals';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import tseslint from 'typescript-eslint';
 
export default tseslint.config(
  { ignores: ['dist/', 'node_modules/'] },
  {
    extends: [js.configs.recommended, ...tseslint.configs.recommended],
    files: ['**/*.{ts,tsx}'],
    languageOptions: {
      ecmaVersion: 2022,
      globals: globals.browser,
    },
    plugins: { react, 'react-hooks': reactHooks },
    rules: {
      ...react.configs.recommended.rules,
      ...reactHooks.configs.recommended.rules,
      'react/react-in-jsx-scope': 'off',
    },
    settings: { react: { version: 'detect' } },
  }
);

Node.js + TypeScript Template

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
 
export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommended,
  { ignores: ['dist/', 'node_modules/'] },
  {
    files: ['src/**/*.ts'],
    rules: {
      '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
      'no-console': ['warn', { allow: ['warn', 'error'] }],
    },
  }
);

Required Dependencies

React + TypeScript

npm install -D @eslint/js eslint eslint-plugin-react eslint-plugin-react-hooks globals typescript-eslint

Node.js + TypeScript

npm install -D @eslint/js eslint typescript-eslint