{"id":13139,"library":"eslint-config-typescript-tc","title":"ESLint Configuration for TypeScript Projects","description":"eslint-config-typescript-tc is a shareable ESLint configuration designed specifically for TypeScript projects, building upon the foundational ruleset provided by eslint-config-tc. It aims to enforce consistent code quality and style across TypeScript codebases, integrating seamlessly with Prettier to handle formatting conflicts. The package is currently at version 12.1.0 and receives regular updates, typically aligning with major releases of typescript-eslint, TypeScript itself, and Node.js LTS versions. A key differentiator is its layered approach, requiring eslint-config-tc as a base, which ensures a cohesive linting experience for both JavaScript and TypeScript files within a monorepo or project. It supports both traditional .eslintrc.js CommonJS configurations and the newer ESLint Flat Config introduced with ESLint v9/v10, requiring Node.js >=22.0.0 and npm >=10.0.0 for the latest versions.","status":"active","version":"12.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/tclindner/eslint-config-typescript-tc","tags":["javascript","eslintconfig","code","quality","style","lint","linter","eslint","code style"],"install":[{"cmd":"npm install eslint-config-typescript-tc","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-typescript-tc","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-typescript-tc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for disabling ESLint rules that conflict with Prettier.","package":"eslint-config-prettier","optional":false},{"reason":"Provides the base JavaScript ESLint configuration this package extends.","package":"eslint-config-tc","optional":false},{"reason":"Required for TypeScript parsing and type-aware linting rules.","package":"typescript","optional":false},{"reason":"Provides the ESLint parser and plugins for TypeScript.","package":"typescript-eslint","optional":false}],"imports":[{"note":"This configuration is designed to be extended within an `.eslintrc.js` file using CommonJS syntax, and explicitly requires `eslint-config-tc` as a preceding extend. Ensure `parserOptions.project` and `tsconfigRootDir` are correctly set for type-aware rules.","wrong":"extends: ['plugin:@typescript-eslint/recommended']","symbol":"ESLint Configuration (CJS)","correct":"module.exports = {\n  extends: ['eslint-config-tc', 'eslint-config-typescript-tc'],\n  parserOptions: {\n    project: './tsconfig.json',\n    tsconfigRootDir: __dirname,\n  },\n};"},{"note":"For ESLint v9+ and Node.js ESM projects, `eslint.config.js` should use Flat Config. `eslint-config-typescript-tc` v12.0.0+ supports this. Note the use of `import.meta.dirname` for `tsconfigRootDir` in ESM contexts.","wrong":"module.exports = { extends: [...] }","symbol":"ESLint Configuration (Flat Config)","correct":"import tcConfig from 'eslint-config-tc';\nimport typescriptTcConfig from 'eslint-config-typescript-tc';\n\nexport default [\n  ...tcConfig,\n  ...typescriptTcConfig,\n  {\n    files: ['**/*.ts', '**/*.tsx'],\n    languageOptions: {\n      parserOptions: {\n        project: './tsconfig.json',\n        tsconfigRootDir: import.meta.dirname,\n      },\n    },\n  },\n];"},{"note":"Specific rules can be overridden directly in your project's ESLint configuration file after extending `eslint-config-typescript-tc`. This allows for project-specific adjustments while maintaining the base style.","symbol":"Overriding Rules","correct":"module.exports = {\n  extends: ['eslint-config-tc', 'eslint-config-typescript-tc'],\n  parserOptions: {\n    project: './tsconfig.json',\n    tsconfigRootDir: __dirname,\n  },\n  rules: {\n    \"@typescript-eslint/array-type\": \"off\"\n  }\n};"}],"quickstart":{"code":"{\n  \"name\": \"my-ts-project\",\n  \"version\": \"1.0.0\",\n  \"description\": \"My TypeScript project with ESLint\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"lint\": \"eslint . --ext .ts,.tsx,.js,.jsx\"\n  },\n  \"devDependencies\": {\n    \"eslint\": \"^10.0.0\",\n    \"eslint-config-prettier\": \"^10.1.8\",\n    \"eslint-config-tc\": \"^28.0.3\",\n    \"eslint-config-typescript-tc\": \"^12.1.0\",\n    \"typescript\": \"^5.0.0\",\n    \"typescript-eslint\": \"^8.35.0\"\n  }\n}\n\n// .eslintrc.js\nmodule.exports = {\n  extends: ['eslint-config-tc', 'eslint-config-typescript-tc'],\n  parserOptions: {\n    project: './tsconfig.json',\n    tsconfigRootDir: __dirname,\n  },\n};\n\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true\n  },\n  \"include\": [\"src/**/*.ts\"],\n  \"exclude\": [\"node_modules\"]\n}\n\n// src/index.ts\nconst greeting: string = 'Hello, TypeScript and ESLint!';\nconsole.log(greeting);\n\ninterface User {\n  id: number;\n  name: string;\n  email?: string;\n}\n\nconst users: User[] = [\n  { id: 1, name: 'Alice' },\n  { id: 2, name: 'Bob', email: 'bob@example.com' },\n];\n\nusers.forEach(user => {\n  console.log(`User: ${user.name}${user.email ? ` (${user.email})` : ''}`);\n});\n","lang":"typescript","description":"This quickstart demonstrates how to install `eslint-config-typescript-tc` and configure it in a basic TypeScript project using an `.eslintrc.js` file, along with a minimal `tsconfig.json` and a sample TypeScript file to lint."},"warnings":[{"fix":"Upgrade Node.js to >=22.0.0 and ESLint to >=10.0.0, then migrate your ESLint configuration to the Flat Config format (e.g., `eslint.config.js`).","message":"Version 12.0.0 dropped support for Node.js 20 and introduced compatibility with ESLint 10, including support for the new Flat Config system. Projects on older Node.js versions or ESLint 8 must remain on `eslint-config-typescript-tc` v11 or earlier.","severity":"breaking","affected_versions":">=12.0.0"},{"fix":"Ensure your `typescript-eslint` peer dependency is updated to the corresponding major version required by `eslint-config-typescript-tc`. Consult the `typescript-eslint` changelog for migration guides between major versions (e.g., v6 to v7, v7 to v8).","message":"Version 10.0.0 requires `typescript-eslint` v8, which itself introduced several breaking changes and updated rules. Similarly, v9.0.0 requires `typescript-eslint` v7 and v8.0.0 requires `typescript-eslint` v6. Each major update aligns with a new major `typescript-eslint` release.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Upgrade your Node.js runtime to meet the minimum requirements of the installed `eslint-config-typescript-tc` version. For v12.x.x, Node.js 22 is required.","message":"Node.js minimum version has incrementally increased. V12.0.0 requires Node.js >=22.0.0, v11.0.0 dropped Node.js 18, and v9.0.0 dropped Node.js 16 (requiring `>=18.18.0`).","severity":"breaking","affected_versions":">=9.0.0"},{"fix":"Ensure your `typescript-eslint` dependency is updated to at least v8.58.0 when using `eslint-config-typescript-tc` v12.1.0 or newer with TypeScript 6.x.x.","message":"For TypeScript 6.x.x support (introduced in v12.1.0), `typescript-eslint` v8.58.0+ is explicitly required. Older `typescript-eslint` versions may not correctly parse or lint TypeScript 6 code.","severity":"gotcha","affected_versions":">=12.1.0"},{"fix":"Verify that `parserOptions.project` points to the correct `tsconfig.json` file relative to `tsconfigRootDir`. Use `__dirname` for CommonJS or `import.meta.dirname` for ESM in `tsconfigRootDir` to ensure correct resolution.","message":"Incorrect `parserOptions.project` or `tsconfigRootDir` configuration can lead to ESLint not being able to find your `tsconfig.json`, resulting in errors like 'Parsing error: \"parserOptions.project\" has been set for the parser' or type-aware rules failing.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the path in `parserOptions.project` (e.g., `'./tsconfig.json'`) is correct relative to `tsconfigRootDir`, and that `tsconfigRootDir: __dirname` (or `import.meta.dirname` for ESM) is also specified and correct.","cause":"ESLint could not find or load the `tsconfig.json` file specified in `parserOptions.project`.","error":"Parsing error: \"parserOptions.project\" has been set for the parser"},{"fix":"Double-check your `parserOptions` in your ESLint config. Make sure `project` is correctly pointing to your `tsconfig.json` and that `tsconfigRootDir` is set to the directory containing your ESLint config file.","cause":"This error often occurs when `typescript-eslint` rules that require type information are enabled, but `parserOptions.project` is not configured correctly or points to a non-existent `tsconfig.json`.","error":"TypeError: Cannot read properties of undefined (reading 'getTypeChecker')"},{"fix":"Verify the `tsconfig.json` file exists at the specified path and that `parserOptions.project` is correctly configured relative to `tsconfigRootDir`.","cause":"The `tsconfig.json` file specified in `parserOptions.project` could not be found at the given path.","error":"Error: ESLint was configured to run on 'tsconfig.json' but that file does not exist."},{"fix":"For ESLint v9+ or projects using ESM, migrate your ESLint configuration to the Flat Config style (e.g., in `eslint.config.js` with `export default [...]`) as shown in the `Imports` section for Flat Config.","cause":"Attempting to use `module.exports = { ... }` (CommonJS) style configuration in an `eslint.config.js` file when ESLint is running in an ESM context (e.g., Node.js v16+ with `type: \"module\"` in `package.json`, or ESLint v9+ Flat Config).","error":"TypeError: require() of ES Module ... is not supported. Instead, change the require to a dynamic import() or top-level await."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}