tslint-config-prettier
raw JSON → 1.18.0 verified Sat Apr 25 auth: no javascript deprecated
tslint-config-prettier is a shareable TSLint configuration that disables all TSLint rules that conflict with Prettier, allowing you to use both tools together without clashes. Version 1.18.0 is the latest stable release, actively maintained until TSLint's deprecation. It bundles a CLI checker to identify conflicting rules in your config. It supports multiple TSLint rule set extensions including codelyzer, tslint-consistent-codestyle, tslint-eslint-rules, tslint-immutable, tslint-microsoft-contrib, and tslint-react. It is deprecated in favor of using ESLint with @typescript-eslint and eslint-config-prettier.
Common errors
error Error: Cannot find module 'tslint' ↓
cause tslint is not installed as a peer dependency
fix
Run npm install --save-dev tslint
error tslint-config-prettier-check: No rules found ↓
cause Path to tslint.json is incorrect or file doesn't exist
fix
Verify the path: npx tslint-config-prettier-check ./tslint.json
Warnings
deprecated tslint is deprecated; TSLint is no longer maintained. Use ESLint with @typescript-eslint instead. ↓
fix Migrate from TSLint to ESLint. Consider using eslint-config-prettier.
gotcha tslint-config-prettier must be the last extension in the "extends" array to properly override conflicting rules. ↓
fix Ensure the extends array ends with "tslint-config-prettier".
gotcha The CLI checker `tslint-config-prettier-check` requires tslint to be installed as a peer dependency. ↓
fix Install tslint: npm install --save-dev tslint
Install
npm install tslint-config-prettier yarn add tslint-config-prettier pnpm add tslint-config-prettier Imports
- tslint-config-prettier wrong
Using `require('tslint-config-prettier')` in JavaScript file instead of extending in tslint.jsoncorrect// In tslint.json { "extends": ["tslint-config-prettier"] } - tslint-config-prettier-check wrong
Running `tslint-config-prettier` without arguments or with wrong pathcorrectnpx tslint-config-prettier-check ./tslint.json
Quickstart
// Install
npm install --save-dev tslint tslint-config-prettier
// tslint.json
{
"extends": [
"tslint:recommended",
"tslint-config-prettier"
]
}