Registry / testing / eslint-plugin-prettier

eslint-plugin-prettier

JSON →
library5.5.5jsnpmunverified

Runs Prettier as an ESLint rule, reporting formatting differences as individual lint issues. Current stable version is v5.5.5, released Jan 2025. Requires ESLint >=8, Prettier >=3, and eslint-config-prettier >=7. Actively maintained with monthly releases. Ships TypeScript types and supports flat config (eslint.config.js) and legacy .eslintrc. Integrates with eslint-config-prettier to disable conflicting rules. Notable features: supports non-JS languages (CSS, JSON) via @eslint/css and @eslint/json plugins, Svelte support, and configurable options like 'usePrettierrc' and 'fileInfoOptions'. Faster than prettier-eslint as it avoids double parsing.

npm install eslint-plugin-prettier
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-PRET
E
eslint-plugin-prettier
testingjavascriptv5.5.5
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

plugin
✓ import plugin from 'eslint-plugin-prettier'
✗ const plugin = require('eslint-plugin-prettier')
Default import works in both ESM and CJS contexts via bundler, but ESM is preferred for flat config
recommended
✓ import recommended from 'eslint-plugin-prettier/recommended'
✗ require('eslint-plugin-prettier').configs.recommended
This is the flat config export. In CJS, use require with .default if needed.
configs.recommended
✓ const { configs } = require('eslint-plugin-prettier'); configs.recommended
✗ require('eslint-plugin-prettier/recommended')
For legacy .eslintrc, use the 'recommended' string in extends array, not the config object directly.

Flat config setup with eslint-plugin-prettier and eslint-config-prettier to automatically fix formatting.

// eslint.config.js import eslintPluginPrettier from 'eslint-plugin-prettier'; import eslintConfigPrettier from 'eslint-config-prettier'; export default [ { plugins: { prettier: eslintPluginPrettier, }, rules: { 'prettier/prettier': 'error', 'arrow-body-style': 'off', 'prefer-arrow-callback': 'off', }, }, eslintConfigPrettier, ]; // Then run: npx eslint . // This will check all files with Prettier formatting.
Debug
Known issues
breakingRequires Prettier >=3.0.0 and ESLint >=8.0.0 as peer dependencies since v5.0.0.
fix
Upgrade Prettier to v3+ and ESLint to v8+.
affects: >=5.0.0
breakingv5.x drops support for Node.js <14.18 and uses ESM exports internally; some bundlers may need configuration.
fix
Use Node 14.18+ or 16+; for CJS projects, use dynamic import or upgrade to Node 22+ with require(esm) support.
affects: >=5.0.0
deprecatedThe 'prettier/prettier' rule options object now uses 'prettierOptions' instead of 'options' in v5.5.0+.
fix
Rename the 'options' property to 'prettierOptions' in rule configuration.
affects: >=5.5.0
gotchaIncompatible with eslint-plugin-prettier's own 'arrow-body-style' and 'prefer-arrow-callback' rules; must disable them manually or use the recommended config.
fix
Add 'arrow-body-style': 'off' and 'prefer-arrow-callback': 'off' in your ESLint rules.
affects: >=4.0.0
gotchaWhen using flat config, the recommended config is exported as 'eslint-plugin-prettier/recommended' (a single config object), not 'plugin.configs.recommended'.
fix
Use 'import recommended from "eslint-plugin-prettier/recommended"' and spread it in your config array.
affects: >=5.4.0
Errors
Common errors & fixes
Error: Failed to load plugin 'prettier' declared in 'plugins': Cannot find module 'eslint-plugin-prettier'
Plugin not installed or not in node_modules.
fix
Run 'npm install --save-dev eslint-plugin-prettier'.
TypeError: Cannot read properties of undefined (reading 'message')
Bug in synckit <=0.11.6 used by prettier-linter-helpers.
fix
Upgrade to eslint-plugin-prettier v5.4.1+ which bumps synckit to v0.11.7.
Parsing error: Unexpected token }
ESLint parser is not configured for the file type (e.g., TypeScript or JSX).
fix
Install and configure @typescript-eslint/parser or eslint-plugin-react.
ESLint couldn't determine the plugin for rule 'prettier/prettier'
Plugin not listed in 'plugins' array in flat config.
fix
Add 'prettier: eslintPluginPrettier' to the plugins object in your flat config.
Upgrade
Version history
5.5.5latest on npm
Audit
Dependencies
eslintrequiredpeer dependency, plugin runs inside ESLint
prettierrequiredpeer dependency, core formatting engine
eslint-config-prettieroptionalpeer dependency, recommended to disable conflicting rules
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-prettier — npm install eslint-plugin-prettier · libregistry