eslint-plugin-oxfmt 0.24.0 → 0.26.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 +23 -10
- package/dist/index.mjs +1 -1
- package/package.json +6 -7
- package/workers/oxfmt.mjs +10 -15
package/README.md
CHANGED
|
@@ -24,15 +24,22 @@ Maintained in the [eslint-plugin-oxfmt monorepo](https://github.com/ntnyq/eslint
|
|
|
24
24
|
|
|
25
25
|
- **ESLint**: `^9.5.0 || ^10.0.0` (Only supports ESLint flat config)
|
|
26
26
|
- **Node.js**: `^22.13.0 || >=24`
|
|
27
|
-
- **oxfmt**: `>= 0.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
comments
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
- **oxfmt**: `>= 0.71.0`
|
|
28
|
+
|
|
29
|
+
Upgrading from oxfmt 0.70.0 to 0.71.0 preserves comment order around test-call
|
|
30
|
+
arguments and comments on either side of assignment operators. It also fixes
|
|
31
|
+
adjacent block comments, trailing spaces in block comments, and JSDoc hard
|
|
32
|
+
breaks, including `/***` comments. The bundled Prettier upgrade from 3.9.6 to
|
|
33
|
+
3.9.9 fixes embedded template indentation and Markdown handling of single
|
|
34
|
+
tildes, dollar signs, Liquid syntax, blockquotes, and list indentation. Existing
|
|
35
|
+
files may receive formatting fixes after upgrading. No formatting options were
|
|
36
|
+
added, renamed, or removed, and config merge precedence is unchanged.
|
|
37
|
+
|
|
38
|
+
The upstream native Markdown formatter is not yet used by the published
|
|
39
|
+
formatting API; Markdown still uses Prettier, including frontmatter formatting.
|
|
40
|
+
The upstream fix for repeated CLI calls in one process does not affect this
|
|
41
|
+
plugin's worker, which uses the formatting API.
|
|
42
|
+
See the upstream [0.71.0 release notes](https://github.com/oxc-project/oxc/releases/tag/oxfmt_v0.71.0).
|
|
36
43
|
|
|
37
44
|
The monorepo migration aligns the Node.js requirement with `load-oxfmt-config`; Node.js 20 is no longer supported.
|
|
38
45
|
|
|
@@ -202,7 +209,11 @@ All options are optional and default to sensible values.
|
|
|
202
209
|
|
|
203
210
|
### Config Discovery & Precedence
|
|
204
211
|
|
|
205
|
-
When `useConfig` is `true`, the plugin loads config using
|
|
212
|
+
When `useConfig` is `true`, the plugin loads config using
|
|
213
|
+
`loadOxfmtConfigForFile()` from `load-oxfmt-config`. EditorConfig sections are
|
|
214
|
+
matched relative to their own directory, including when the oxfmt config is in
|
|
215
|
+
a nested package. Matching sections apply in source order, and basename patterns
|
|
216
|
+
such as `[*.js]` also match files in descendant directories.
|
|
206
217
|
|
|
207
218
|
- Config discovery order (from the formatted file's directory, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts` → `oxfmt.config.mts`
|
|
208
219
|
- `.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
|
|
@@ -213,6 +224,8 @@ When `useConfig` is `true`, the plugin loads config using `load-oxfmt-config`.
|
|
|
213
224
|
- `configPath` supports explicit file paths with extensions: `.json`, `.jsonc`, `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`
|
|
214
225
|
- ESLint rule options generally take highest priority because inline rule options are merged after loaded config.
|
|
215
226
|
- 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.
|
|
227
|
+
- Providing rule-level `ignorePatterns` replaces config-level patterns, including `[]` to clear them. Default ignores still apply independently.
|
|
228
|
+
- `respectOxfmtDefaultIgnores: false` disables default directories, lockfiles, and ignore files, while retaining config-level `ignorePatterns` when `useConfig` is enabled.
|
|
216
229
|
- When `useConfig` is `true`, config `overrides` are applied first and rule-level `overrides` are appended after them (later entries win on conflicts).
|
|
217
230
|
- Invalid `files` or `excludeFiles` override glob patterns are reported as formatting errors.
|
|
218
231
|
- When `useConfig` is `false`, config discovery and config `ignorePatterns` are skipped, while global ignores still apply when `respectOxfmtDefaultIgnores` is enabled.
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-oxfmt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"description": "An ESLint plugin for formatting code with oxfmt.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"sideEffects": false,
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"eslint": "^9.5.0 || ^10.0.0",
|
|
51
|
-
"oxfmt": ">=0.
|
|
51
|
+
"oxfmt": ">=0.71.0",
|
|
52
52
|
"svelte": "*"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"generate-differences": "^0.1.1",
|
|
61
|
-
"ignore": "^7.0.
|
|
62
|
-
"load-oxfmt-config": "^0.
|
|
61
|
+
"ignore": "^7.0.10",
|
|
62
|
+
"load-oxfmt-config": "^0.26.0",
|
|
63
63
|
"picomatch": "^4.0.7",
|
|
64
64
|
"synckit": "^0.11.13"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/json-schema": "^7.0.15",
|
|
68
68
|
"eslint-parser-plain": "^0.1.1",
|
|
69
|
-
"eslint-plugin-oxfmt": "0.
|
|
69
|
+
"eslint-plugin-oxfmt": "0.26.0",
|
|
70
70
|
"eslint-typegen": "^2.3.1",
|
|
71
71
|
"eslint-vitest-rule-tester": "^3.2.0",
|
|
72
72
|
"jsonc-eslint-parser": "^3.3.0",
|
|
73
73
|
"show-invisibles": "^0.0.2",
|
|
74
|
-
"svelte": "^5.57.
|
|
74
|
+
"svelte": "^5.57.1",
|
|
75
75
|
"tinyglobby": "^0.2.17"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"build": "pnpm run update:rule-options && tsdown",
|
|
82
82
|
"check:schema": "tsx scripts/checkSchemaParity.ts",
|
|
83
83
|
"dev": "tsdown --watch",
|
|
84
|
-
"test": "vitest run --root . --config ../../vitest.config.ts",
|
|
85
84
|
"update:rule-options": "tsx scripts/updateRuleOptions.ts"
|
|
86
85
|
}
|
|
87
86
|
}
|
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,
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
ignored
|
|
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
|
|
230
|
+
const loaded = await loadOxfmtConfigForFile({
|
|
236
231
|
configPath: pluginOptions.configPath,
|
|
237
232
|
cwd: cwd ?? dirname(filename),
|
|
238
233
|
disableNestedConfig: pluginOptions.disableNestedConfig,
|