ESLint Config Typed
raw JSON → 4.9.6 verified Fri May 01 auth: no javascript
eslint-config-typed (v4.9.6) is a comprehensive, fully typed ESLint configuration package for the modern flat config system. It provides strongly-typed rule definitions, pre-configured setups for TypeScript, React, Preact, Vitest, Jest, and Playwright, and custom ESLint plugins (ts-restrictions, vitest-coding-style, react-coding-style). Requires ESLint >=9 and TypeScript >=5. Actively maintained with weekly releases. Differentiators: type-safe rule options, TypeScript config support, and built-in custom rules not found in other config packages.
Common errors
error Cannot find module 'eslint-config-typed' or its corresponding type declarations. ↓
cause Missing peer dependencies or incorrect module resolution.
fix
Install eslint-config-typed with its peer dependencies: npm add -D eslint eslint-config-typed typescript
error Error: Failed to load config "eslint-config-typed" to extend from. ↓
cause Using legacy eslintrc format instead of flat config.
fix
Create an eslint.config.js file and use flat config. Remove .eslintrc files.
error TypeError: defineConfig is not a function ↓
cause Using default import incorrectly; defineConfig is a named export.
fix
Use import { defineConfig } from 'eslint-config-typed' instead of import defineConfig from '...'
error ERR_REQUIRE_ESM: require() of ES Module not supported. ↓
cause Package is ESM-only, but you are using require().
fix
Switch to ESM by adding "type": "module" to package.json and use import declarations.
Warnings
breaking Package is ESM-only since v4. CommonJS require() will throw an error. ↓
fix Switch to ESM (type: "module" in package.json) and use import statements.
breaking Requires ESLint 9+ flat config. Legacy .eslintrc format is not supported. ↓
fix Migrate to eslint.config.js with flat config. See ESLint migration guide.
breaking Requires TypeScript >=5.0.0. Older TypeScript versions are not compatible. ↓
fix Upgrade TypeScript to version 5 or later.
deprecated Some configuration functions from v3 are replaced by new functions in v4. Old imports may break. ↓
fix Check the API reference and replace old function names.
gotcha TypeScript config files (eslint.config.ts) require tsx or ts-node to execute. Ensure your Node version and loader support TypeScript. ↓
fix Use tsx (npm i -D tsx) and run eslint with node --loader tsx/esm.
gotcha If using import-x/no-unused-modules, you must enable the 'unusedImports' option in tsconfig.json or provide a separate config. ↓
fix Set compilerOptions.unusedLocals to false or configure import-x/no-unused-modules correctly.
gotcha Performance can degrade on large monorepos. Consider caching and ignoring node_modules. ↓
fix Add ignorePatterns: ['node_modules'] and use ESLint cache (--cache).
Install
npm install eslint-config-typed yarn add eslint-config-typed pnpm add eslint-config-typed Imports
- defineConfig wrong
const defineConfig = require('eslint-config-typed')correctimport { defineConfig } from 'eslint-config-typed' - eslintConfigForTypeScript
import { eslintConfigForTypeScript } from 'eslint-config-typed' - eslintConfigForVitest
import { eslintConfigForVitest } from 'eslint-config-typed' - defineKnownRules wrong
import defineKnownRules from 'eslint-config-typed'correctimport { defineKnownRules } from 'eslint-config-typed' - withDefaultOption
import { withDefaultOption } from 'eslint-config-typed'
Quickstart
// eslint.config.js
import {
defineConfig,
eslintConfigForTypeScript,
eslintConfigForVitest,
} from 'eslint-config-typed';
export default defineConfig([
// TypeScript config for source files
...eslintConfigForTypeScript({
tsconfigRootDir: import.meta.dirname,
tsconfig: 'tsconfig.json',
files: ['src/**/*.ts', 'src/**/*.tsx'],
}),
// Vitest config for test files
...eslintConfigForVitest({
files: ['src/**/*.test.ts', 'src/**/*.spec.ts'],
}),
// Custom overrides
{
rules: {
'no-console': 'warn',
},
},
]);