eslint-plugin-prettier
Run Prettier as an ESLint rule that reports formatting differences as autofixable lint errors.
Repository Health
Technical Analysis
eslint-plugin-prettier integrates Prettier directly into ESLint’s rule engine, reporting any formatting difference between your source and Prettier’s expected output as a standard ESLint prettier/prettier violation — insertions, deletions, and replacements are all surfaced with precise line/column locations and can be auto-fixed via eslint --fix.
Rather than reimplementing formatting logic, the plugin lazily loads Prettier through a synckit-backed worker so a single ESLint rule visitor can call Prettier’s promise-based API synchronously, and it ships ready-made recommended configs for both legacy .eslintrc and flat eslint.config.js setups that also enable eslint-config-prettier to silence conflicting style rules.
What You Get
- A
prettier/prettierESLint rule that reports every formatting difference as an autofixable lint error - Ready-made
recommendedconfigs for both legacy.eslintrcand flateslint.config.jssetups - Automatic disabling of conflicting ESLint formatting rules via bundled
eslint-config-prettierintegration - Support for virtual files from other ESLint processors (Markdown, HTML, GraphQL, Vue, Svelte) without double-formatting
Common Use Cases
- Enforcing consistent code formatting across a team without a separate Prettier CI step
- Auto-fixing formatting violations during
eslint --fixor on save in an editor - Migrating a codebase from format-related ESLint rules to Prettier-driven formatting
- Catching formatting drift in pull requests via a single
eslintcheck
Under The Hood
Architecture
Single-file plugin (eslint-plugin-prettier.js) exports one ESLint rule that hooks the top-level AST node type, lazily requiring synckit’s createSyncFn against a separate worker.mjs script to bridge Prettier’s promise-based API into ESLint’s synchronous rule visitor; the worker resolves .prettierrc/.editorconfig via prettier.resolveConfig, infers a parser via prettier.getFileInfo, and formats via prettier.format(), returning the formatted string across the process boundary. Differences between source and formatted output are computed with prettier-linter-helpers’s generateDifferences and reported as individual ESLint issues with precise fix ranges. A recommended.js/recommended.d.ts pair composes the plugin with eslint-config-prettier’s rule-disabling config for flat-config consumers, while legacy .eslintrc consumers get an equivalent configs.recommended entry inside the plugin object itself. This is about as flat and single-purpose an architecture as an ESLint plugin can have — no internal layering beyond the worker-process split needed for the sync/async bridge.
Tech Stack
Plain CommonJS module for the main plugin entry, ESM worker invoked via synckit, with runtime dependencies limited to prettier-linter-helpers (diff/invisible-character formatting) and synckit (sync-over-async worker bridge); peer dependencies are eslint, eslint-config-prettier, and prettier, reflecting that the plugin does no bundling of its own and defers entirely to the host project’s installed versions. Devtooling is comprehensive: a recent major-version ESLint running in flat-config mode (dogfooding itself via plugin:prettier/recommended), Mocha for tests, Changesets for versioned releases, commitlint plus simple-git-hooks for commit discipline, and a pnpm workspace with a patched dependency supporting the remark-based docs lint pipeline.
Code Quality
Tests live under test/ as numbered .txt fixture files covering dozens of formatting scenarios plus named edge cases (Vue, GraphQL, MDX, JSON), driven through Mocha via test/prettier.mjs — a snapshot-style fixture approach well suited to a rule whose job is literally “does the diff match.” Error handling is explicit: both the rule and the worker special-case SyntaxError from Prettier and re-throw anything unexpected, and the rule strips Prettier’s redundant code-frame text from re-reported messages. Typing is done via JSDoc @ts-check annotations and @import typedefs rather than compiled TypeScript, checked by lint and format scripts that run in CI. Test fixture coverage across markdown/html/graphql/vue/svelte edge cases is notably thorough for a package this size.
API Design
The plugin’s entire public surface is one rule name (prettier/prettier) plus two ready-made config exports, about as low-boilerplate as an ESLint integration gets — most consumers add a single extends entry or import the flat-config object and never touch the rule’s options directly. The rule’s own options mirror Prettier’s own API rather than inventing new configuration vocabulary, keeping the learning curve close to zero for anyone who already knows Prettier. The README documents edge cases thoroughly (Svelte support caveats, a documented arrow-body-style/prefer-arrow-callback interaction bug) rather than just happy-path usage. Running a formatter through a linter’s fixer mechanism is a well-established pattern predating this package, so it isn’t technically novel — but the developer experience is exemplary for its category.
Used by 102 apps in this directory
ByteChef
AI Agents · Automation
Unified open-source platform for AI agent orchestration and workflow automation with 180+ connectors, MCP support, and durable execution.
Cap
Team Chat · Video Conferencing
Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.
Chatwoot
Customer Support
Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.
Circle
Developer Tools · Project Management
A Linear-inspired project management interface built with Next.js and shadcn/ui — issues, cycles, projects, teams, and a mocked AI agent chat, running entirely on client-side mock data as a self-hostable front-end template.
Cosmos-Server
Authentication · Security
All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.
DataEase
AI Assistants · Analytics · Data Engineering
Open-source BI tool with drag-and-drop dashboards, 20+ data source connectors, and AI-powered natural language queries — a self-hosted alternative to Tableau.
DefGuard
Authentication · Networking · Security
Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.
DevTools-X
Developer Tools
41 offline-first developer utilities in a single 10MB cross-platform desktop app — no Electron, no cloud, no compromise.
Dittofeed
Automation · Marketing
Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.