Registry / testing / tslint-plugin-prettier

tslint-plugin-prettier

JSON →
library2.3.0jsnpmunverified

Runs Prettier as a TSLint rule and reports differences as individual TSLint issues. Stable version 2.3.0, low release cadence (last update 2019). Integrates Prettier formatting into TSLint workflows, emitting each difference as a separate lint failure. Unlike other tools, it supports both TSLint 5/6 and Prettier 1.x/2.x, but TSLint itself is deprecated in favor of ESLint. No active development expected.

npm install tslint-plugin-prettier
INSTALL
IMPORT
SIG · TSLINT-PLUGIN-PRET
T
tslint-plugin-prettier
testingjavascriptv2.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const plugin = require('tslint-plugin-prettier')
import plugin from 'tslint-plugin-prettier'
CJS-only package, no ESM exports.
Rules
const { Rules } = require('tslint-plugin-prettier')
import { Rules } from 'tslint-plugin-prettier'
Use destructured require for Rules.
PrettierRule
const { PrettierRule } = require('tslint-plugin-prettier')
import { PrettierRule } from 'tslint-plugin-prettier'
Named export for the rule class.

Enables the prettier rule in TSLint, checking formatting against Prettier's defaults.

// tslint.json { "extends": ["tslint-plugin-prettier"], "rules": { "prettier": true } } // Run: tslint --config tslint.json 'src/**/*.ts'
Debug
Known issues
deprecatedTSLint itself is deprecated. Prettier integration is better done via eslint-plugin-prettier.
fix
Migrate to ESLint + eslint-plugin-prettier.
affects: all
gotchaThe rule reports each difference as a separate failure, which can flood output in large files.
fix
Use Prettier directly for formatting, or limit rule scope to specific files.
affects: all
breakingVersion 2.0.0 dropped support for Prettier <1.9 and TSLint <5.0.
fix
Upgrade to Prettier >=1.9 and TSLint >=5.0.
affects: >=2.0.0 <3.0.0
Errors
Common errors & fixes
Cannot find module 'tslint-plugin-prettier'
Package not installed or peer dependencies missing.
fix
npm install tslint-plugin-prettier --save-dev
Could not find rule: 'prettier'
tslint.json not configured correctly or plugin not loaded.
fix
Add 'tslint-plugin-prettier' to 'extends' or 'rulesDirectory' in tslint.json.
Invalid 'prettier' rule options
The 'prettier' rule accepts only boolean (true) or an object with options.
fix
Use "prettier": true or "prettier": true in tslint.json.
Upgrade
Version history
2.3.0latest on npm
Audit
Dependencies
tslintrequiredpeer dependency, required to load rules
prettierrequiredpeer dependency, used for formatting comparison
Agent activity
8 hits · last 30 days
node
8
Resources
tslint-plugin-prettier — npm install tslint-plugin-prettier · libregistry