eslint-plugin-oxfmt 0.24.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 +22 -10
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/workers/oxfmt.mjs +10 -15
package/README.md
CHANGED
|
@@ -24,15 +24,21 @@ 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.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).
|
|
36
42
|
|
|
37
43
|
The monorepo migration aligns the Node.js requirement with `load-oxfmt-config`; Node.js 20 is no longer supported.
|
|
38
44
|
|
|
@@ -202,7 +208,11 @@ All options are optional and default to sensible values.
|
|
|
202
208
|
|
|
203
209
|
### Config Discovery & Precedence
|
|
204
210
|
|
|
205
|
-
When `useConfig` is `true`, the plugin loads config using
|
|
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.
|
|
206
216
|
|
|
207
217
|
- Config discovery order (from the formatted file's directory, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts` → `oxfmt.config.mts`
|
|
208
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
|
|
@@ -213,6 +223,8 @@ When `useConfig` is `true`, the plugin loads config using `load-oxfmt-config`.
|
|
|
213
223
|
- `configPath` supports explicit file paths with extensions: `.json`, `.jsonc`, `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`
|
|
214
224
|
- ESLint rule options generally take highest priority because inline rule options are merged after loaded config.
|
|
215
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.
|
|
216
228
|
- When `useConfig` is `true`, config `overrides` are applied first and rule-level `overrides` are appended after them (later entries win on conflicts).
|
|
217
229
|
- Invalid `files` or `excludeFiles` override glob patterns are reported as formatting errors.
|
|
218
230
|
- 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.25.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.70.0",
|
|
52
52
|
"svelte": "*"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -59,19 +59,19 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"generate-differences": "^0.1.1",
|
|
61
61
|
"ignore": "^7.0.9",
|
|
62
|
-
"load-oxfmt-config": "^0.
|
|
62
|
+
"load-oxfmt-config": "^0.25.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.25.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": {
|
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,
|