Registry / testing / eslint-config-typescript-tc

eslint-config-typescript-tc

JSON →
library12.1.0jsnpmunverified

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.

npm install eslint-config-typescript-tc
INSTALL
IMPORT
SIG · ESLINT-CONFIG-TYPE
E
eslint-config-typescript-tc
testingjavascriptv12.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESLint Configuration (CJS)
module.exports = { extends: ['eslint-config-tc', 'eslint-config-typescript-tc'], parserOptions: { project: './tsconfig.json', tsconfigRootDir: __dirname, }, };
extends: ['plugin:@typescript-eslint/recommended']
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.
ESLint Configuration (Flat Config)
import tcConfig from 'eslint-config-tc'; import typescriptTcConfig from 'eslint-config-typescript-tc'; export default [ ...tcConfig, ...typescriptTcConfig, { files: ['**/*.ts', '**/*.tsx'], languageOptions: { parserOptions: { project: './tsconfig.json', tsconfigRootDir: import.meta.dirname, }, }, }, ];
module.exports = { extends: [...] }
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.
Overriding Rules
module.exports = { extends: ['eslint-config-tc', 'eslint-config-typescript-tc'], parserOptions: { project: './tsconfig.json', tsconfigRootDir: __dirname, }, rules: { "@typescript-eslint/array-type": "off" } };
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.

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.

{ "name": "my-ts-project", "version": "1.0.0", "description": "My TypeScript project with ESLint", "main": "index.js", "scripts": { "lint": "eslint . --ext .ts,.tsx,.js,.jsx" }, "devDependencies": { "eslint": "^10.0.0", "eslint-config-prettier": "^10.1.8", "eslint-config-tc": "^28.0.3", "eslint-config-typescript-tc": "^12.1.0", "typescript": "^5.0.0", "typescript-eslint": "^8.35.0" } } // .eslintrc.js module.exports = { extends: ['eslint-config-tc', 'eslint-config-typescript-tc'], parserOptions: { project: './tsconfig.json', tsconfigRootDir: __dirname, }, }; // tsconfig.json { "compilerOptions": { "target": "ESNext", "module": "ESNext", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true }, "include": ["src/**/*.ts"], "exclude": ["node_modules"] } // src/index.ts const greeting: string = 'Hello, TypeScript and ESLint!'; console.log(greeting); interface User { id: number; name: string; email?: string; } const users: User[] = [ { id: 1, name: 'Alice' }, { id: 2, name: 'Bob', email: 'bob@example.com' }, ]; users.forEach(user => { console.log(`User: ${user.name}${user.email ? ` (${user.email})` : ''}`); });
Debug
Known issues
breakingVersion 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.
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`).
affects: >=12.0.0
breakingVersion 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.
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).
affects: >=8.0.0
breakingNode.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`).
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.
affects: >=9.0.0
gotchaFor 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.
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.
affects: >=12.1.0
gotchaIncorrect `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.
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.
affects: >=1.0.0
Errors
Common errors & fixes
Parsing error: "parserOptions.project" has been set for the parser
ESLint could not find or load the `tsconfig.json` file specified in `parserOptions.project`.
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.
TypeError: Cannot read properties of undefined (reading 'getTypeChecker')
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`.
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.
Error: ESLint was configured to run on 'tsconfig.json' but that file does not exist.
The `tsconfig.json` file specified in `parserOptions.project` could not be found at the given path.
fix
Verify the `tsconfig.json` file exists at the specified path and that `parserOptions.project` is correctly configured relative to `tsconfigRootDir`.
TypeError: require() of ES Module ... is not supported. Instead, change the require to a dynamic import() or top-level await.
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).
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.
Upgrade
Version history
12.1.0latest on npm
Audit
Dependencies
eslint-config-prettierrequiredUsed for disabling ESLint rules that conflict with Prettier.
eslint-config-tcrequiredProvides the base JavaScript ESLint configuration this package extends.
typescriptrequiredRequired for TypeScript parsing and type-aware linting rules.
typescript-eslintrequiredProvides the ESLint parser and plugins for TypeScript.
Agent activity
2 hits · last 30 days
node
2
Resources