tslint-to-eslint-config

raw JSON →
2.16.0 verified Sat Apr 25 auth: no javascript

Automated tool to convert TSLint configuration to the closest reasonable ESLint equivalent, facilitating migration from the deprecated TSLint to ESLint. Current stable version is 2.16.0, released with minor fixes and dependency updates. It reads existing linter, TypeScript, and package configs, generates an .eslintrc.js, and supports CLI flags for customization. Key differentiators: community-maintained under typescript-eslint, handles rule mapping with fallback to eslint-plugin-tslint for unmatched rules, and includes inline comment conversion.

error Cannot find module 'tslint-to-eslint-config'
cause Package not installed or not using ESM import.
fix
Install package (npm install --save-dev tslint-to-eslint-config) and use import syntax.
error SyntaxError: Unexpected token 'export'
cause Node version <14 or CommonJS environment trying to load ESM.
fix
Upgrade Node to >=14 and use import syntax or run with --experimental-modules.
error Error: TSLint configuration file not found: ./tslint.json
cause Missing or incorrect path to TSLint config.
fix
Specify correct path with --tslint flag or ensure tslint.json exists in working directory.
breaking v2.13.0 switched to ECMAScript modules (ESM). CJS require() no longer works.
fix Use import syntax and ensure your project is ESM or use dynamic import.
gotcha The package expects Node >=14.0.0. Older versions will fail with syntax errors.
fix Upgrade Node to 14 or later.
deprecated TSLint is deprecated. This tool is for migration only; not intended for ongoing use.
fix Use ESLint directly after migration.
gotcha Some TSLint rules have no ESLint equivalent and are wrapped with eslint-plugin-tslint, which may degrade performance.
fix Manually replace wrapped rules with native ESLint rules when possible.
breaking v2.12.0 removed integration with deprecated Prettier ESLint configs. Config output may differ.
fix Check generated config for Prettier settings and adjust manually if needed.
npm install tslint-to-eslint-config
yarn add tslint-to-eslint-config
pnpm add tslint-to-eslint-config

Reads TSLint config and generates ESLint config object. Requires Node >=14.0.0.

import { convertConfig } from 'tslint-to-eslint-config';

async function main() {
  const result = await convertConfig({
    tslint: './tslint.json',
    typescript: './tsconfig.json',
    eslint: './.eslintrc.js',
    package: './package.json',
    prettier: true,
    comments: true,
  });
  console.log(JSON.stringify(result.config, null, 2));
}

main().catch(console.error);