tslint-eslint-rules
raw JSON → 5.4.0 verified Sat Apr 25 auth: no javascript
tslint-eslint-rules provides ESLint rules as TSLint plugins, allowing developers to use familiar ESLint linting rules within the TSLint ecosystem for TypeScript projects. The current stable version is 5.4.0, released with peer dependencies on tslint ^5.0.0 and TypeScript ^2.2.0 or ^3.0.0. The project is actively maintained and includes over 50 rules covering possible errors, best practices, and stylistic concerns. It differentiates from alternatives by bridging the gap between ESLint and TSLint, offering a familiar rule set for teams migrating or combining tools.
Common errors
error Could not find rule: 'no-constant-condition' ↓
cause The rule is not enabled or the plugin is not extended correctly.
fix
Ensure tslint.json extends 'tslint-eslint-rules' and the rule name is spelled correctly.
error Require statement not part of import statement ↓
cause Mixing CommonJS require with TypeScript modules.
fix
Use ES module imports: import * as rules from 'tslint-eslint-rules';
Warnings
breaking Version 4.0.0 dropped support for TypeScript < 2.2 and tslint < 5.0.0. ↓
fix Update TypeScript to ^2.2.0 and tslint to ^5.0.0.
deprecated TSLint is deprecated in favor of ESLint with typescript-eslint parser. This package may not receive further updates. ↓
fix Migrate to ESLint with @typescript-eslint/parser and @typescript-eslint/eslint-plugin.
gotcha Rule names in tslint-eslint-rules use camelCase instead of kebab-case used in ESLint. ↓
fix Use camelCase rule names, e.g., 'noConstantCondition' but note the package uses native ESLint names? Actually, the rules are named with kebab-case in the JSON configuration. Check docs.
Install
npm install tslint-eslint-rules yarn add tslint-eslint-rules pnpm add tslint-eslint-rules Imports
- tslint-eslint-rules wrong
extends: 'tslint-eslint-rules'correctextends: ['tslint-eslint-rules'] - no-constant-condition wrong
"no-constant-condition": "error"correct"no-constant-condition": true - no-control-regex wrong
"no-control-regex": "warn"correct"no-control-regex": true
Quickstart
// tslint.json
{
"extends": ["tslint-eslint-rules"],
"rules": {
"no-constant-condition": true,
"no-control-regex": true
}
}