tsconfig-lint

raw JSON →
0.12.0 verified Fri May 01 auth: no javascript deprecated

A CLI and Node API to run TSLint on files listed in a tsconfig.json. Integrates with tsconfig-glob for filesGlob support. Active development up to v0.12.0, with a deprecation notice recommending migration to TypeScript 2.0's built-in 'include' glob support. Differentiator: automates linting of tsconfig-defined files, reducing manual file list maintenance. Uses a callback-based async API. Last release v0.12.0; no recent updates.

error TypeError: lint is not a function
cause Importing the module incorrectly using named export instead of namespace import.
fix
Use import * as lint from 'tsconfig-lint' or const lint = require('tsconfig-lint').
error Cannot find module 'tsconfig-lint'
cause Package not installed in node_modules.
fix
Run npm install tsconfig-lint --save-dev.
error Error: ENOENT: no such file or directory, open 'tsconfig.json'
cause The configPath option points to a directory without a tsconfig.json file.
fix
Ensure the configPath directory contains a tsconfig.json, or provide the full path to a .json file.
breaking In v0.9.0, the --use-glob option now only uses filesGlob instead of files, and tsconfig-glob has been removed as a dependency.
fix Update scripts using --use-glob to rely solely on filesGlob; no longer need tsconfig-glob installed.
deprecated This package is deprecated in favor of TypeScript 2.0's 'include' property for glob support in tsconfig.json.
fix Migrate to TypeScript 2.0+ and use the 'include' and 'exclude' properties in tsconfig.json; stop using tsconfig-lint.
gotcha The CJS require returns the function directly, not an object with a 'lint' property.
fix Use `const lint = require('tsconfig-lint')` instead of destructured import.
breaking In v0.9.0, tsconfig-glob was removed as a dependency, so filesGlob expansion must be handled externally if needed.
fix Install tsconfig-glob separately if you need filesGlob support, or use TypeScript's built-in glob patterns.
npm install tsconfig-lint
yarn add tsconfig-lint
pnpm add tsconfig-lint

Run tslint using tsconfig-lint with custom options including filesGlob.

import * as lint from 'tsconfig-lint';
import * as path from 'path';

const options = {
  configPath: '.',
  cwd: process.cwd(),
  useGlob: true,
  tsconfigOptions: { indent: 2 },
  tsLintConfigFilePath: 'tslint.json'
};

lint(options, (err: Error | null) => {
  if (err) {
    console.error('Linting failed:', err);
    process.exit(1);
  }
  console.log('Linting complete');
});