{"id":19879,"library":"eslint-plugin-prettier","title":"eslint-plugin-prettier","description":"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.","status":"active","version":"5.5.5","language":"javascript","source_language":"en","source_url":"https://github.com/prettier/eslint-plugin-prettier","tags":["javascript","eslint","eslintplugin","eslint-plugin","prettier","typescript"],"install":[{"cmd":"npm install eslint-plugin-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, plugin runs inside ESLint","package":"eslint","optional":false},{"reason":"peer dependency, core formatting engine","package":"prettier","optional":false},{"reason":"peer dependency, recommended to disable conflicting rules","package":"eslint-config-prettier","optional":true}],"imports":[{"note":"Default import works in both ESM and CJS contexts via bundler, but ESM is preferred for flat config","wrong":"const plugin = require('eslint-plugin-prettier')","symbol":"plugin","correct":"import plugin from 'eslint-plugin-prettier'"},{"note":"This is the flat config export. In CJS, use require with .default if needed.","wrong":"require('eslint-plugin-prettier').configs.recommended","symbol":"recommended","correct":"import recommended from 'eslint-plugin-prettier/recommended'"},{"note":"For legacy .eslintrc, use the 'recommended' string in extends array, not the config object directly.","wrong":"require('eslint-plugin-prettier/recommended')","symbol":"configs.recommended","correct":"const { configs } = require('eslint-plugin-prettier'); configs.recommended"}],"quickstart":{"code":"// eslint.config.js\nimport eslintPluginPrettier from 'eslint-plugin-prettier';\nimport eslintConfigPrettier from 'eslint-config-prettier';\n\nexport default [\n  {\n    plugins: {\n      prettier: eslintPluginPrettier,\n    },\n    rules: {\n      'prettier/prettier': 'error',\n      'arrow-body-style': 'off',\n      'prefer-arrow-callback': 'off',\n    },\n  },\n  eslintConfigPrettier,\n];\n\n// Then run: npx eslint .\n// This will check all files with Prettier formatting.","lang":"javascript","description":"Flat config setup with eslint-plugin-prettier and eslint-config-prettier to automatically fix formatting."},"warnings":[{"fix":"Upgrade Prettier to v3+ and ESLint to v8+.","message":"Requires Prettier >=3.0.0 and ESLint >=8.0.0 as peer dependencies since v5.0.0.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use Node 14.18+ or 16+; for CJS projects, use dynamic import or upgrade to Node 22+ with require(esm) support.","message":"v5.x drops support for Node.js <14.18 and uses ESM exports internally; some bundlers may need configuration.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Rename the 'options' property to 'prettierOptions' in rule configuration.","message":"The 'prettier/prettier' rule options object now uses 'prettierOptions' instead of 'options' in v5.5.0+.","severity":"deprecated","affected_versions":">=5.5.0"},{"fix":"Add 'arrow-body-style': 'off' and 'prefer-arrow-callback': 'off' in your ESLint rules.","message":"Incompatible with eslint-plugin-prettier's own 'arrow-body-style' and 'prefer-arrow-callback' rules; must disable them manually or use the recommended config.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use 'import recommended from \"eslint-plugin-prettier/recommended\"' and spread it in your config array.","message":"When using flat config, the recommended config is exported as 'eslint-plugin-prettier/recommended' (a single config object), not 'plugin.configs.recommended'.","severity":"gotcha","affected_versions":">=5.4.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 eslint-plugin-prettier'.","cause":"Plugin not installed or not in node_modules.","error":"Error: Failed to load plugin 'prettier' declared in 'plugins': Cannot find module 'eslint-plugin-prettier'"},{"fix":"Upgrade to eslint-plugin-prettier v5.4.1+ which bumps synckit to v0.11.7.","cause":"Bug in synckit <=0.11.6 used by prettier-linter-helpers.","error":"TypeError: Cannot read properties of undefined (reading 'message')","affected_versions":">=5.4.0"},{"fix":"Install and configure @typescript-eslint/parser or eslint-plugin-react.","cause":"ESLint parser is not configured for the file type (e.g., TypeScript or JSX).","error":"Parsing error: Unexpected token }"},{"fix":"Add 'prettier: eslintPluginPrettier' to the plugins object in your flat config.","cause":"Plugin not listed in 'plugins' array in flat config.","error":"ESLint couldn't determine the plugin for rule 'prettier/prettier'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}