eslint-config-prettier
raw JSON → 10.1.8 verified Sat Apr 25 auth: no javascript
eslint-config-prettier is an ESLint shareable config that turns off all rules that are unnecessary or might conflict with Prettier. It selectively disables core ESLint rules and plugin rules (e.g., @typescript-eslint, import, react, unicorn) that are made redundant by Prettier's formatting. Version 10.1.8 is the current stable release, published as CommonJS with TypeScript declarations. The package follows a patch-only release cadence (no breaking changes since 10.x). Key differentiators: it is the official Prettier-ESLint integration maintained by the Prettier team, supports both legacy .eslintrc format and flat config via eslint-config-prettier/flat, and includes a CLI to check for conflicting rules. It requires eslint >=7.0.0.
Common errors
error Error: Cannot find module 'eslint-config-prettier' ↓
cause Package not installed or incorrect import path.
fix
Run 'npm install --save-dev eslint-config-prettier'. In flat config, use 'eslint-config-prettier/flat'.
error TypeError: configPrettier is not a function or array ↓
cause Using legacy default import for flat config (e.g., import prettier from 'eslint-config-prettier').
fix
Use 'import configPrettier from 'eslint-config-prettier/flat'' instead of default import from root.
Warnings
breaking v10.0.0 dropped support for ESLint <7 and switched to CommonJS-only exports. TypeScript configs may break. ↓
fix Update ESLint to >=7 and ensure you are using CommonJS or ESM correctly. For flat config, import 'eslint-config-prettier/flat'.
deprecated The 'eslint-config-prettier' entry point for flat config (without '/flat') is deprecated since v10.1.0. Use 'eslint-config-prettier/flat'. ↓
fix Change import from 'eslint-config-prettier' to 'eslint-config-prettier/flat' in flat ESLint configs.
gotcha eslint-config-prettier only turns off formatting rules; it does not enable any rules. You must still configure other configs (e.g., @eslint/js, @typescript-eslint) for linting logic. ↓
fix Always include a base config like 'eslint:recommended' or '@eslint/js/recommended' before this config.
Install
npm install eslint-config-prettier yarn add eslint-config-prettier pnpm add eslint-config-prettier Imports
- eslint-config-prettier (legacy) wrong
extends: ['prettier']correctextends: ['eslint-config-prettier'] - eslint-config-prettier/flat (flat config) wrong
import { configPrettier } from 'eslint-config-prettier'; export default [configPrettier];correctimport configPrettier from 'eslint-config-prettier/flat'; export default [configPrettier, /* other configs */]; - TypeScript types wrong
import { Config } from 'eslint-config-prettier';correctimport type { Config } from 'eslint-config-prettier';
Quickstart
// .eslintrc.js (legacy)
module.exports = {
extends: [
'some-other-config',
'eslint-config-prettier'
]
};
// eslint.config.js (flat config - modern)
import js from '@eslint/js';
import configPrettier from 'eslint-config-prettier/flat';
export default [
js.configs.recommended,
configPrettier,
// your other configs
];
// Check for conflicting rules via CLI:
// npx eslint-config-prettier path/to/eslint.config.js