Registry / testing / eslint-plugin-format

eslint-plugin-format

JSON →
library2.0.1jsnpmunverified

An ESLint plugin that integrates multiple formatters (Prettier, dprint, oxfmt) for formatting various languages directly through ESLint rules. Current stable version is 2.0.1, released with support for ESLint v8 through v10, TypeScript types included. Key differentiators: side-effects-free, flat config native, supports multiple formatters in one plugin, and does not require language detection or external config files. Each file type must be explicitly configured with a formatter and options, giving full control but requiring manual setup.

testing
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.

The default export is an object with `parserPlain` and rule definitions. Named export `format` is not available; use default import.

import format from 'eslint-plugin-format'

parserPlain is a property of the default export, not a named export. Access via the default import object.

import format from 'eslint-plugin-format'; const { parserPlain } = format

v2.0.0 dropped CJS support; only ESM is supported. For CJS projects, pin to v1.x or use dynamic import.

const format = require('eslint-plugin-format')

Configures ESLint flat config to format CSS files with Prettier and TOML files with dprint. Each formatter rule must be applied per file type with explicit parser and options.

// eslint.config.js import format from 'eslint-plugin-format' export default [ { files: ['**/*.css'], languageOptions: { parser: format.parserPlain, }, plugins: { format, }, rules: { 'format/prettier': ['error', { parser: 'css' }], }, }, { files: ['**/*.toml'], languageOptions: { parser: format.parserPlain, }, plugins: { format, }, rules: { 'format/dprint': ['error', { language: 'toml' }], }, }, ]
Debug
Known footguns
breakingCJS support dropped in v2.0.0
gotchaNo default configs: formatters only apply to files explicitly configured with a rule
deprecatedPrettier parser option may be deprecated in future versions; prefer explicit parser per file type
gotchadprint requires WASM plugins; local paths may fail if binary not found
breakingoxfmt rule changed behavior for unsupported file types in v2.0.1
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources