Registry / devops / prettier-plugin-eslint

prettier-plugin-eslint

JSON →
library1.0.2jsnpmunverified

Automatically integrates ESLint's auto-fix functionality into Prettier formatting, so that running Prettier also applies ESLint --fix. Version 1.0.2 is the current stable release; the plugin runs ESLint on .js files before Prettier formatting. Compared to alternatives like prettier-eslint, this is a Prettier plugin (not a separate CLI) and requires no extra configuration beyond installation. It assumes ESLint configuration is in an .eslintrc file (package.json support planned).

npm install prettier-plugin-eslint
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-ES
P
prettier-plugin-eslint
devopsjavascriptv1.0.2
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.

plugin
// No import needed; install and it auto-registers with Prettier.
import plugin from 'prettier-plugin-eslint'
This is a Prettier plugin; installation alone activates it. No JavaScript import required.
default
// In .prettierrc: { "plugins": ["prettier-plugin-eslint"] }
require('prettier-plugin-eslint')
Configure via Prettier's plugins option, not a direct require.
use with Prettier API
const prettier = require('prettier'); await prettier.format(code, { parser: 'babel', plugins: ['prettier-plugin-eslint'] });
const plugin = require('prettier-plugin-eslint');
Pass the plugin name in the options object when using Prettier programmatically.

Install prettier-plugin-eslint, configure .prettierrc, ESLint rule for no semicolons, and run Prettier to see autofix.

npm install --save-dev prettier prettier-plugin-eslint eslint echo '{"plugins": ["prettier-plugin-eslint"]}' > .prettierrc echo '{"rules": {"semi": ["error", "never"]}}' > .eslintrc.json # Create a test file echo 'const x = 1;' > test.js # Run Prettier npx prettier --write test.js # Verify that semicolon is removed (ESLint --fix applied) cat test.js # should output: const x = 1
Debug
Known issues
gotchaPlugin only processes .js files; other file types (ts, json, css) are not linted.
fix
Use separate plugins (e.g., prettier-plugin-tslint) for non-JS files.
affects: >=1.0.0
gotchaThe plugin runs ESLint before Prettier; formatting from ESLint may conflict with Prettier styles.
fix
Ensure ESLint rules are compatible with Prettier output; use eslint-config-prettier to disable conflicting rules.
affects: >=1.0.0
gotchaESLint configuration must be in .eslintrc file (JSON, YAML, or JS); package.json 'eslintConfig' key is not supported.
fix
Move ESLint config to an .eslintrc file or wait for package.json support.
affects: >=1.0.0 <2.0.0
gotchaThe plugin does not support ESLint's --fix-to-stdout or other CLI flags.
fix
Run ESLint directly if custom fix behavior is needed.
affects: >=1.0.0
breakingVersion 1.0.0 required Prettier >= 2.0. Older Prettier versions are incompatible.
fix
Upgrade Prettier to version 2.0 or later.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-eslint'
Plugin not installed or not found in node_modules.
fix
Run 'npm install --save-dev prettier-plugin-eslint'.
Couldn't resolve plugin "prettier-plugin-eslint"
Plugin name not specified correctly in .prettierrc.
fix
Use full package name: { "plugins": ["prettier-plugin-eslint"] }
ESLint configuration not found. .eslintrc file is required.
Missing ESLint config file; package.json eslintConfig not supported.
fix
Create an .eslintrc file (e.g., .eslintrc.json) in project root.
Cannot read property 'config' of undefined
Plugin runs before ESLint is initialized due to missing dependencies.
fix
Ensure both 'prettier' and 'eslint' are installed as devDependencies.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
prettierrequiredpeer dependency - requires Prettier as the formatter host
eslintrequiredpeer dependency - uses ESLint to autofix files
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-eslint — npm install prettier-plugin-eslint · libregistry