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.
npm install eslint-plugin-formatVerified import paths — ran on the pinned version, not inferred.
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.
Use ESM imports. If CJS is required, pin to v1.x (e.g., 'eslint-plugin-format': '^1.5.0')
Add a rule with matching `files` pattern for each file type you want to format. The plugin does not apply to all files automatically.
Always specify a parser in format/prettier options. The rule will not infer from file extension.
Ensure dprint plugin WASM files are installed or use a URL. Example: plugin: 'node_modules/dprint-plugin-malva/plugin.wasm'
Upgrade to >=2.0.1 to ignore unsupported file type errors gracefully.
Run 'npm install eslint-plugin-format --save-dev'. For CJS, pin to v1.x or use dynamic import().
Add parser option: 'format/prettier': ['error', { parser: 'css' }]Verify the path: plugin: 'node_modules/dprint-plugin-<name>/plugin.wasm' or use an absolute path.
Use `import format from 'eslint-plugin-format'`