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
| Setting | Value | Rationale |
|---|---|---|
target | ES2022 | Modern JavaScript features support |
strict | true | Type safety enforcement |
moduleResolution | by archetype (see below) | Published code must resolve in raw Node ESM |
isolatedModules | true | Required 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):
| Archetypes | module | moduleResolution | Relative imports |
|---|---|---|---|
| A4, A7, A8, A14 (TypeScript repos), A17 | NodeNext | NodeNext | .js extension needed |
| A9, A10, A11, A12, A20, A22 (bundled by Vite et al.) | ESNext | bundler | Extensionless |
- 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-eslintNode.js + TypeScript
npm install -D @eslint/js eslint typescript-eslint