{"id":20360,"library":"prettier-plugin-eslint","title":"prettier-plugin-eslint","description":"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).","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/asentechnology/prettier-plugin-eslint","tags":["javascript","prettier","prettier-plugin","eslint"],"install":[{"cmd":"npm install prettier-plugin-eslint","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-eslint","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-eslint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - requires Prettier as the formatter host","package":"prettier","optional":false},{"reason":"peer dependency - uses ESLint to autofix files","package":"eslint","optional":false}],"imports":[{"note":"This is a Prettier plugin; installation alone activates it. No JavaScript import required.","wrong":"import plugin from 'prettier-plugin-eslint'","symbol":"plugin","correct":"// No import needed; install and it auto-registers with Prettier."},{"note":"Configure via Prettier's plugins option, not a direct require.","wrong":"require('prettier-plugin-eslint')","symbol":"default","correct":"// In .prettierrc: { \"plugins\": [\"prettier-plugin-eslint\"] }"},{"note":"Pass the plugin name in the options object when using Prettier programmatically.","wrong":"const plugin = require('prettier-plugin-eslint');","symbol":"use with Prettier API","correct":"const prettier = require('prettier'); await prettier.format(code, { parser: 'babel', plugins: ['prettier-plugin-eslint'] });"}],"quickstart":{"code":"npm install --save-dev prettier prettier-plugin-eslint eslint\necho '{\"plugins\": [\"prettier-plugin-eslint\"]}' > .prettierrc\necho '{\"rules\": {\"semi\": [\"error\", \"never\"]}}' > .eslintrc.json\n# Create a test file\necho 'const x = 1;' > test.js\n# Run Prettier\nnpx prettier --write test.js\n# Verify that semicolon is removed (ESLint --fix applied)\ncat test.js # should output: const x = 1","lang":"javascript","description":"Install prettier-plugin-eslint, configure .prettierrc, ESLint rule for no semicolons, and run Prettier to see autofix."},"warnings":[{"fix":"Use separate plugins (e.g., prettier-plugin-tslint) for non-JS files.","message":"Plugin only processes .js files; other file types (ts, json, css) are not linted.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure ESLint rules are compatible with Prettier output; use eslint-config-prettier to disable conflicting rules.","message":"The plugin runs ESLint before Prettier; formatting from ESLint may conflict with Prettier styles.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Move ESLint config to an .eslintrc file or wait for package.json support.","message":"ESLint configuration must be in .eslintrc file (JSON, YAML, or JS); package.json 'eslintConfig' key is not supported.","severity":"gotcha","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Run ESLint directly if custom fix behavior is needed.","message":"The plugin does not support ESLint's --fix-to-stdout or other CLI flags.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Prettier to version 2.0 or later.","message":"Version 1.0.0 required Prettier >= 2.0. Older Prettier versions are incompatible.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev prettier-plugin-eslint'.","cause":"Plugin not installed or not found in node_modules.","error":"Error: Cannot find module 'prettier-plugin-eslint'"},{"fix":"Use full package name: { \"plugins\": [\"prettier-plugin-eslint\"] }","cause":"Plugin name not specified correctly in .prettierrc.","error":"Couldn't resolve plugin \"prettier-plugin-eslint\""},{"fix":"Create an .eslintrc file (e.g., .eslintrc.json) in project root.","cause":"Missing ESLint config file; package.json eslintConfig not supported.","error":"ESLint configuration not found. .eslintrc file is required."},{"fix":"Ensure both 'prettier' and 'eslint' are installed as devDependencies.","cause":"Plugin runs before ESLint is initialized due to missing dependencies.","error":"Cannot read property 'config' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}