eslint-plugin-oxfmt

raw JSON →
0.4.0 verified Sat Apr 25 auth: no javascript

An ESLint plugin that integrates oxfmt (a blazing-fast Rust-based formatter from the OXC project) as an ESLint rule. Current stable version is 0.4.0, released monthly. Requires ESLint v9+ with flat config (no legacy config support) and Node.js ^20.19.0 || >=22.12.0. Key differentiators: leverages oxfmt's performance (written in Rust), supports a wide range of formatting options including JSDoc, sort imports, Tailwind CSS class sorting, and EditorConfig integration. Unlike prettier-based ESLint plugins, it uses the same formatter as oxlint for unified formatting.

error Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'eslint-plugin-oxfmt'
cause Package not installed, or using require() on ESM-only package.
fix
Install via npm install eslint-plugin-oxfmt. Use import syntax, not require.
error Configuration for rule "oxfmt/oxfmt" is invalid: Value "warn" must be a string or array of strings.
cause Incorrect rule configuration format.
fix
Use 'oxfmt/oxfmt': 'error' or 'oxfmt/oxfmt': ['error', { /* options */ }].
error ESLint: Key "files" is missing in config object.
cause Using pluginOxfmt.configs.recommended without specifying `files`.
fix
Add files: ['**/*.{js,ts,jsx,tsx}'] to the config object.
breaking Version 0.1.0 dropped support for ESLint <9 and oxfmt <0.35.0.
fix Upgrade to eslint-plugin-oxfmt@0.1.0+ and ensure oxfmt >=0.35.0 and ESLint >=9.0.0
breaking ESLint flat config only. No support for .eslintrc or legacy config.
fix Migrate to ESLint flat config (eslint.config.mjs).
gotcha The recommended config does not include the `files` property. If omitted, the rule will not be applied to any files.
fix Always set `files: ['**/*.js', ...]` when spreading `pluginOxfmt.configs.recommended`.
gotcha EditorConfig support uses only a subset of options (indent_style, indent_size, tab_width, end_of_line, quote_type, max_line_length). Other EditorConfig properties are ignored.
fix Check oxfmt documentation for supported properties.
deprecated The `jsdoc.commentLineStrategy` option changed from 'singleLine' to 'keep' in oxfmt 0.45.0? Check oxfmt docs.
fix Refer to oxfmt changelog for accurate option names.
npm install eslint-plugin-oxfmt
yarn add eslint-plugin-oxfmt
pnpm add eslint-plugin-oxfmt

Installs dependencies and sets up ESLint flat config to format files using oxfmt via the plugin's recommended config.

npm install -D oxfmt eslint-plugin-oxfmt

// eslint.config.mjs
import pluginOxfmt from 'eslint-plugin-oxfmt'

export default [
  {
    ...pluginOxfmt.configs.recommended,
    files: ['**/*.{js,ts,mjs,cjs,jsx,tsx}'],
  },
]

// Use ESLint fix: npx eslint --fix .