eslint-plugin-tsc

raw JSON →
2.0.0 verified Fri May 01 auth: no javascript maintenance

ESLint plugin that wraps TypeScript compiler checks as an ESLint rule. Version 2.0.0 (September 2020) requires TypeScript 4+. It provides a single rule `tsc/config` that runs the TypeScript compiler on files linted by ESLint, reporting type errors and diagnostics. Unlike @typescript-eslint, which implements type-aware lint rules individually, this plugin directly invokes the full compiler, catching all type errors and compiler options like noUnusedLocals. Suitable for projects wanting to enforce compiler checks within ESLint without duplicating compiler options. Release cadence: infrequent, last release 2020.

error Error: Could not find tsconfig.json. Please specify configFile in rule options.
cause configFile path is missing or incorrect.
fix
Add configFile to rule options with correct path, e.g., "configFile": "path/to/tsconfig.json".
error Parsing error: The keyword 'import' is reserved
cause ESLint is parsing TypeScript as JavaScript. Need to configure TypeScript parser.
fix
Add @typescript-eslint/parser to your ESLint config: 'parser': '@typescript-eslint/parser'.
error Definition for rule 'tsc/config' was not found.
cause eslint-plugin-tsc is not installed or not added to plugins array.
fix
Run npm install eslint-plugin-tsc --save-dev and add 'tsc' to plugins array.
breaking Version 2.0.0 requires TypeScript 4+. Downgrade to 1.x for TypeScript 3.x compatibility.
fix Use eslint-plugin-tsc@1.2.0 if using TypeScript <4.
gotcha The configFile path is relative to the current working directory, not the ESLint config file. Use absolute paths to avoid confusion.
fix Specify an absolute path for configFile, e.g., path.resolve(__dirname, 'tsconfig.json').
gotcha Plugin only provides a single rule 'tsc/config'. It does not include individual rules like '@typescript-eslint/no-unused-vars'.
fix Use alongside @typescript-eslint for fine-grained lint rules if needed.
deprecated Plugin is thinly maintained; last release 2020. Consider switching to @typescript-eslint which is more actively maintained and integrates type checking.
fix Migrate to @typescript-eslint/parser and @typescript-eslint/eslint-plugin.
npm install eslint-plugin-tsc
yarn add eslint-plugin-tsc
pnpm add eslint-plugin-tsc

Configures eslint-plugin-tsc to run TypeScript compiler checks via the tsc/config rule, overriding compiler options.

// .eslintrc.js
module.exports = {
  plugins: ['tsc'],
  rules: {
    'tsc/config': [
      'warn',
      {
        configFile: './tsconfig.json',
        compilerOptions: {
          noUnusedLocals: true,
          strictNullChecks: true
        }
      }
    ]
  }
};

// Run ESLint on a TypeScript file
// eslint src/index.ts