eslint-plugin-oxfmt 0.22.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
 
8
8
  > An ESLint plugin for formatting code with [oxfmt](https://github.com/oxc-project/oxc) - A blazing fast formatter powered by Rust.
9
9
 
10
+ Maintained in the [eslint-plugin-oxfmt monorepo](https://github.com/ntnyq/eslint-plugin-oxfmt). See the root README for development and release instructions.
11
+
10
12
  ## Features
11
13
 
12
14
  - ⚡️ **Blazing Fast** - Powered by [oxfmt](https://github.com/oxc-project/oxc), written in Rust
@@ -20,16 +22,25 @@
20
22
 
21
23
  ## Requirements
22
24
 
23
- - **ESLint**: `>= 9.0.0` (Only supports ESLint flat config)
24
- - **Node.js**: `^20.19.0 || >=22.12.0`
25
- - **oxfmt**: `>= 0.67.0`
25
+ - **ESLint**: `^9.5.0 || ^10.0.0` (Only supports ESLint flat config)
26
+ - **Node.js**: `^22.13.0 || >=24`
27
+ - **oxfmt**: `>= 0.70.0`
28
+
29
+ Upgrading from oxfmt 0.68.0 to 0.70.0 fixes comments after assignment operators,
30
+ leading union comments after `as` and `satisfies`, multiline block comments,
31
+ typecast arrow bodies, and parentheses in suppressed type aliases. JSX `fbt`
32
+ elements now preserve adjacency between text and child components. Existing
33
+ files may receive formatting fixes after upgrading. No formatting options were
34
+ added, renamed, or removed, and config merge precedence is unchanged.
35
+
36
+ The upstream native Markdown formatter is not yet used by the published
37
+ formatting API; Markdown still uses Prettier, including frontmatter formatting.
38
+ The Vite+ config discovery changes do not affect this plugin's standalone oxfmt
39
+ config loading or nested config support.
40
+ See the upstream [0.69.0 release notes](https://github.com/oxc-project/oxc/releases/tag/apps_v1.84.0)
41
+ and [0.70.0 release notes](https://github.com/oxc-project/oxc/releases/tag/oxfmt_v0.70.0).
26
42
 
27
- Oxfmt 0.67.0 preserves JSDoc cast parentheses containing comments, fixes
28
- CSS/SCSS/Less comment and list formatting, and moves GraphQL comments after
29
- an opening brace onto their own line. Existing files may receive formatting
30
- fixes after upgrading. No formatting options were renamed or removed, and
31
- config merge precedence is unchanged. See the
32
- [upstream release notes](https://github.com/oxc-project/oxc/releases/tag/oxfmt_v0.67.0).
43
+ The monorepo migration aligns the Node.js requirement with `load-oxfmt-config`; Node.js 20 is no longer supported.
33
44
 
34
45
  ## Installation
35
46
 
@@ -197,7 +208,11 @@ All options are optional and default to sensible values.
197
208
 
198
209
  ### Config Discovery & Precedence
199
210
 
200
- When `useConfig` is `true`, the plugin loads config using `load-oxfmt-config`.
211
+ When `useConfig` is `true`, the plugin loads config using
212
+ `loadOxfmtConfigForFile()` from `load-oxfmt-config`. EditorConfig sections are
213
+ matched relative to their own directory, including when the oxfmt config is in
214
+ a nested package. Matching sections apply in source order, and basename patterns
215
+ such as `[*.js]` also match files in descendant directories.
201
216
 
202
217
  - Config discovery order (from the formatted file's directory, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts` → `oxfmt.config.mts`
203
218
  - `.editorconfig` support follows oxfmt behavior: only the nearest `.editorconfig` is loaded for the current file, and its root and section values provide fallbacks for fields not set by the oxfmt config
@@ -208,6 +223,8 @@ When `useConfig` is `true`, the plugin loads config using `load-oxfmt-config`.
208
223
  - `configPath` supports explicit file paths with extensions: `.json`, `.jsonc`, `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`
209
224
  - ESLint rule options generally take highest priority because inline rule options are merged after loaded config.
210
225
  - Rule-level `ignorePatterns` are resolved relative to ESLint `cwd`; config-level `ignorePatterns` are resolved relative to the resolved config file directory and reject parent-directory (`..`) path segments.
226
+ - Providing rule-level `ignorePatterns` replaces config-level patterns, including `[]` to clear them. Default ignores still apply independently.
227
+ - `respectOxfmtDefaultIgnores: false` disables default directories, lockfiles, and ignore files, while retaining config-level `ignorePatterns` when `useConfig` is enabled.
211
228
  - When `useConfig` is `true`, config `overrides` are applied first and rule-level `overrides` are appended after them (later entries win on conflicts).
212
229
  - Invalid `files` or `excludeFiles` override glob patterns are reported as formatting errors.
213
230
  - When `useConfig` is `false`, config discovery and config `ignorePatterns` are skipped, while global ignores still apply when `respectOxfmtDefaultIgnores` is enabled.
@@ -491,4 +508,4 @@ Add this to your `.vscode/settings.json`:
491
508
 
492
509
  ## License
493
510
 
494
- [MIT](./LICENSE) License © 2025-PRESENT [ntnyq](https://github.com/ntnyq)
511
+ [MIT](https://github.com/ntnyq/eslint-plugin-oxfmt/blob/main/LICENSE) License © 2025-PRESENT [ntnyq](https://github.com/ntnyq)
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ var __exportAll = (all, no_symbols) => {
15
15
  return target;
16
16
  };
17
17
  //#endregion
18
- //#region node_modules/.pnpm/eslint-parser-plain@0.1.1/node_modules/eslint-parser-plain/dist/index.mjs
18
+ //#region ../../node_modules/.pnpm/eslint-parser-plain@0.1.1/node_modules/eslint-parser-plain/dist/index.mjs
19
19
  var dist_exports = /* @__PURE__ */ __exportAll({
20
20
  meta: () => meta$1,
21
21
  parseForESLint: () => parseForESLint
@@ -80,13 +80,13 @@ const configs = {
80
80
  //#region src/meta.ts
81
81
  const meta = {
82
82
  name: "eslint-plugin-oxfmt",
83
- version: "0.22.0"
83
+ version: "0.25.0"
84
84
  };
85
85
  //#endregion
86
86
  //#region src/dir.ts
87
87
  const dirWorkers = fileURLToPath(new URL("../workers", import.meta.url));
88
88
  //#endregion
89
- //#region node_modules/.pnpm/show-invisibles@0.0.2/node_modules/show-invisibles/dist/index.js
89
+ //#region ../../node_modules/.pnpm/show-invisibles@0.0.2/node_modules/show-invisibles/dist/index.js
90
90
  const DEFAULT_MAPPINGS = /* @__PURE__ */ new Map([
91
91
  [" ", "·"],
92
92
  ["\n", "⏎"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-oxfmt",
3
3
  "type": "module",
4
- "version": "0.22.0",
4
+ "version": "0.25.0",
5
5
  "description": "An ESLint plugin for formatting code with oxfmt.",
6
6
  "keywords": [
7
7
  "eslint",
@@ -16,10 +16,11 @@
16
16
  "name": "ntnyq",
17
17
  "email": "ntnyq13@gmail.com"
18
18
  },
19
- "homepage": "https://github.com/ntnyq/eslint-plugin-oxfmt#readme",
19
+ "homepage": "https://github.com/ntnyq/eslint-plugin-oxfmt/tree/main/packages/eslint-plugin-oxfmt#readme",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/ntnyq/eslint-plugin-oxfmt.git"
22
+ "url": "git+https://github.com/ntnyq/eslint-plugin-oxfmt.git",
23
+ "directory": "packages/eslint-plugin-oxfmt"
23
24
  },
24
25
  "bugs": {
25
26
  "url": "https://github.com/ntnyq/eslint-plugin-oxfmt/issues"
@@ -47,7 +48,7 @@
47
48
  "sideEffects": false,
48
49
  "peerDependencies": {
49
50
  "eslint": "^9.5.0 || ^10.0.0",
50
- "oxfmt": ">=0.67.0",
51
+ "oxfmt": ">=0.70.0",
51
52
  "svelte": "*"
52
53
  },
53
54
  "peerDependenciesMeta": {
@@ -57,54 +58,30 @@
57
58
  },
58
59
  "dependencies": {
59
60
  "generate-differences": "^0.1.1",
60
- "ignore": "^7.0.8",
61
- "load-oxfmt-config": "^0.23.0",
61
+ "ignore": "^7.0.9",
62
+ "load-oxfmt-config": "^0.25.0",
62
63
  "picomatch": "^4.0.7",
63
64
  "synckit": "^0.11.13"
64
65
  },
65
66
  "devDependencies": {
66
- "@ntnyq/eslint-config": "^7.0.0-beta.19",
67
67
  "@types/json-schema": "^7.0.15",
68
- "@types/node": "^26.5.0",
69
- "@typescript/native-preview": "^7.0.0-dev.20260707.2",
70
- "bumpp": "^12.3.0",
71
- "eslint": "^10.10.0",
72
68
  "eslint-parser-plain": "^0.1.1",
73
- "eslint-plugin-oxfmt": "0.22.0",
69
+ "eslint-plugin-oxfmt": "0.25.0",
74
70
  "eslint-typegen": "^2.3.1",
75
- "eslint-vitest-rule-tester": "^3.1.0",
76
- "husky": "^9.1.7",
71
+ "eslint-vitest-rule-tester": "^3.2.0",
77
72
  "jsonc-eslint-parser": "^3.3.0",
78
- "nano-staged": "^1.0.2",
79
- "npm-run-all2": "^9.0.3",
80
- "oxfmt": "^0.67.0",
81
73
  "show-invisibles": "^0.0.2",
82
- "svelte": "^5.57.0",
83
- "tinyglobby": "^0.2.17",
84
- "tsdown": "^0.23.0",
85
- "tsx": "^4.23.13",
86
- "typescript": "^6.0.3",
87
- "vitest": "^5.0.0"
74
+ "svelte": "^5.57.1",
75
+ "tinyglobby": "^0.2.17"
88
76
  },
89
77
  "engines": {
90
- "node": "^20.19.0 || >=22.12.0"
91
- },
92
- "nano-staged": {
93
- "*.{js,ts,mjs,tsx,md,vue,yml,yaml,toml,json}": "eslint --fix",
94
- "*": "oxfmt --no-error-on-unmatched-pattern"
78
+ "node": "^22.13.0 || >=24"
95
79
  },
96
80
  "scripts": {
97
81
  "build": "pnpm run update:rule-options && tsdown",
98
82
  "check:schema": "tsx scripts/checkSchemaParity.ts",
99
83
  "dev": "tsdown --watch",
100
- "format": "oxfmt",
101
- "format:check": "oxfmt --check",
102
- "lint": "eslint",
103
- "release": "run-s release:check release:version",
104
- "release:check": "run-s check:schema format:check lint typecheck test build",
105
- "release:version": "bumpp",
106
- "test": "vitest",
107
- "typecheck": "tsgo --noEmit",
84
+ "test": "vitest run --root . --config ../../vitest.config.ts",
108
85
  "update:rule-options": "tsx scripts/updateRuleOptions.ts"
109
86
  }
110
87
  }
package/workers/oxfmt.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { dirname, extname, relative, resolve } from 'node:path'
4
4
  import ignore from 'ignore'
5
- import { isOxfmtIgnored, loadOxfmtConfig } from 'load-oxfmt-config'
5
+ import { isOxfmtIgnored, loadOxfmtConfigForFile } from 'load-oxfmt-config'
6
6
  import { format } from 'oxfmt'
7
7
  import picomatch from 'picomatch'
8
8
  import { runAsWorker } from 'synckit'
@@ -172,7 +172,7 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
172
172
  }
173
173
  }
174
174
 
175
- if (pluginOptions.respectOxfmtDefaultIgnores !== false && cwd) {
175
+ if (cwd) {
176
176
  /**
177
177
  * Config and ignore resolution settings for the current file.
178
178
  * @type {import('load-oxfmt-config').IsOxfmtIgnoredOptions}
@@ -183,25 +183,20 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
183
183
  disableNestedConfig: pluginOptions.disableNestedConfig,
184
184
  filepath: filename,
185
185
  ignorePath: pluginOptions.ignorePath,
186
- includeConfigIgnorePatterns: useConfig,
186
+ includeDefaultIgnores: pluginOptions.respectOxfmtDefaultIgnores,
187
187
  loadConfigForIgnorePatterns: useConfig,
188
188
  useCache,
189
189
  withNodeModules: pluginOptions.withNodeModules,
190
+ includeConfigIgnorePatterns:
191
+ useConfig && ruleIgnorePatterns === undefined,
190
192
  }
191
193
  const ignored = await isOxfmtIgnored(ignoredOptions)
192
194
 
193
195
  if (ignored.ignored) {
194
- if (
195
- ruleIgnorePatterns?.length &&
196
- ignored.reason === 'config-ignore-patterns'
197
- ) {
198
- // Rule-level ignorePatterns should take precedence over config ignorePatterns.
199
- } else {
200
- return {
201
- code: sourceText,
202
- ignored: true,
203
- reason: ignored.reason,
204
- }
196
+ return {
197
+ code: sourceText,
198
+ ignored: true,
199
+ reason: ignored.reason,
205
200
  }
206
201
  }
207
202
  }
@@ -232,7 +227,7 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
232
227
  )
233
228
 
234
229
  if (useConfig) {
235
- const loaded = await loadOxfmtConfig({
230
+ const loaded = await loadOxfmtConfigForFile({
236
231
  configPath: pluginOptions.configPath,
237
232
  cwd: cwd ?? dirname(filename),
238
233
  disableNestedConfig: pluginOptions.disableNestedConfig,