eslint-plugin-oxfmt 0.13.0 → 0.15.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
@@ -13,7 +13,7 @@
13
13
  - 🔧 **Auto-fix** - Automatically format code on save or via ESLint's fix command
14
14
  - 🎯 **ESLint Integration** - Seamlessly integrates with ESLint v9+ flat config
15
15
  - 📦 **Zero Config** - Works out of the box with sensible defaults
16
- - 🧩 **Config File Discovery** - Auto-discovers `.oxfmtrc.json`, `.oxfmtrc.jsonc`, and `oxfmt.config.{ts,mts,cts,js,mjs,cjs}`
16
+ - 🧩 **Config File Discovery** - Auto-discovers `.oxfmtrc.json`, `.oxfmtrc.jsonc`, and `oxfmt.config.{ts,mts}`
17
17
  - 📝 **EditorConfig Integration** - Respects a subset of `.editorconfig` options via [oxfmt's strategy](https://oxc.rs/docs/guide/usage/formatter/config#editorconfig)
18
18
  - 🎨 **Highly Configurable** - Supports all oxfmt formatting options
19
19
  - 🌐 **Multi-language Support** - JavaScript, TypeScript, JSX, TSX and [more](https://oxc.rs/docs/guide/usage/formatter.html#supported-languages)
@@ -22,7 +22,7 @@
22
22
 
23
23
  - **ESLint**: `>= 9.0.0` (Only supports ESLint flat config)
24
24
  - **Node.js**: `^20.19.0 || >=22.12.0`
25
- - **oxfmt**: `>= 0.58.0`
25
+ - **oxfmt**: `>= 0.60.0`
26
26
 
27
27
  ## Installation
28
28
 
@@ -191,16 +191,17 @@ All options are optional and default to sensible values.
191
191
 
192
192
  When `useConfig` is `true`, the plugin loads config using `load-oxfmt-config`.
193
193
 
194
- - Config discovery order (from the formatted file's directory, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts` / `oxfmt.config.mts` / `oxfmt.config.cts` / `oxfmt.config.js` / `oxfmt.config.mjs` / `oxfmt.config.cjs`
195
- - `.editorconfig` support follows oxfmt behavior: only the nearest `.editorconfig` is loaded for the current file (with section overrides in that file)
194
+ - Config discovery order (from the formatted file's directory, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts` → `oxfmt.config.mts`
195
+ - `.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
196
196
  - Set `editorconfig: false` to disable `.editorconfig` merging
197
197
  - Set `editorconfig: { onlyCwd: true }` to read only the current `cwd`'s `.editorconfig` (no upward traversal)
198
198
  - Set `editorconfig: { cwd: '/path/to/base' }` to customize editorconfig resolution base directory
199
199
  - `configPath` overrides discovery and directly targets the specified config file
200
200
  - `configPath` supports explicit file paths with extensions: `.json`, `.jsonc`, `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`
201
201
  - ESLint rule options generally take highest priority because inline rule options are merged after loaded config.
202
- - Rule-level `ignorePatterns` are resolved relative to ESLint `cwd`; config-level `ignorePatterns` are resolved relative to the resolved config file directory.
202
+ - 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.
203
203
  - When `useConfig` is `true`, config `overrides` are applied first and rule-level `overrides` are appended after them (later entries win on conflicts).
204
+ - Invalid `files` or `excludeFiles` override glob patterns are reported as formatting errors.
204
205
  - When `useConfig` is `false`, config discovery and config `ignorePatterns` are skipped, while global ignores still apply when `respectOxfmtDefaultIgnores` is enabled.
205
206
 
206
207
  For detailed behavior, see:
@@ -210,14 +211,14 @@ For detailed behavior, see:
210
211
 
211
212
  ### Basic Options
212
213
 
213
- | Option | Type | Default | Description |
214
- | ---------------- | ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
215
- | `semi` | `boolean` | `true` | Add semicolons at the end of statements |
216
- | `singleQuote` | `boolean` | `false` | Use single quotes instead of double quotes |
217
- | `tabWidth` | `number` | `2` | Number of spaces per indentation level |
218
- | `useTabs` | `boolean` | `false` | Use tabs for indentation |
219
- | `printWidth` | `number` | `100` | Maximum line length for wrapping |
220
- | `ignorePatterns` | `string[]` | `[]` | Glob patterns to skip formatting. Rule option patterns are resolved from ESLint cwd; config file patterns are resolved from the config file directory. |
214
+ | Option | Type | Default | Description |
215
+ | ---------------- | ---------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
216
+ | `semi` | `boolean` | `true` | Add semicolons at the end of statements |
217
+ | `singleQuote` | `boolean` | `false` | Use single quotes instead of double quotes |
218
+ | `tabWidth` | `number` | `2` | Number of spaces per indentation level |
219
+ | `useTabs` | `boolean` | `false` | Use tabs for indentation |
220
+ | `printWidth` | `number` | `100` | Maximum line length for wrapping |
221
+ | `ignorePatterns` | `string[]` | `[]` | Glob patterns to skip formatting. Rule option patterns are resolved from ESLint cwd; config file patterns are resolved from the config file directory and cannot contain `..` path segments. |
221
222
 
222
223
  ### Trailing Commas
223
224
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { Linter, Rule } from "eslint";
2
+ import "load-oxfmt-config";
3
+ import "oxfmt";
2
4
  //#region src/types.d.ts
3
5
  interface PluginOxfmt {
4
6
  configs: {
package/dist/index.mjs CHANGED
@@ -79,7 +79,7 @@ const configs = {
79
79
  //#region src/meta.ts
80
80
  const meta = {
81
81
  name: "eslint-plugin-oxfmt",
82
- version: "0.13.0"
82
+ version: "0.15.0"
83
83
  };
84
84
  //#endregion
85
85
  //#region src/dir.ts
@@ -195,7 +195,7 @@ const oxfmtOptionsSchema = {
195
195
  type: "string"
196
196
  },
197
197
  ignorePatterns: {
198
- description: `Ignore files matching these glob patterns. Rule-level ignorePatterns are resolved relative to ESLint cwd. Config ignorePatterns are resolved relative to the config file directory.`,
198
+ description: `Ignore files matching these glob patterns. Rule-level ignorePatterns are resolved relative to ESLint cwd. Config ignorePatterns are resolved relative to the config file directory and reject parent-directory (\`..\`) path segments.`,
199
199
  type: "array",
200
200
  items: { type: "string" }
201
201
  },
@@ -630,8 +630,8 @@ const rules = { oxfmt: {
630
630
  });
631
631
  }
632
632
  else reportDifferences(context, sourceText, formatResult.code);
633
- } catch (err) {
634
- const details = err instanceof Error ? `: ${err.message}` : "";
633
+ } catch (error) {
634
+ const details = error instanceof Error ? `: ${error.message}` : "";
635
635
  context.report({
636
636
  message: `Failed to format file: ${context.filename}${details}`,
637
637
  loc: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-oxfmt",
3
3
  "type": "module",
4
- "version": "0.13.0",
4
+ "version": "0.15.0",
5
5
  "description": "An ESLint plugin for formatting code with oxfmt.",
6
6
  "keywords": [
7
7
  "eslint",
@@ -47,7 +47,7 @@
47
47
  "sideEffects": false,
48
48
  "peerDependencies": {
49
49
  "eslint": "^9.5.0 || ^10.0.0",
50
- "oxfmt": ">=0.58.0",
50
+ "oxfmt": ">=0.60.0",
51
51
  "svelte": "*"
52
52
  },
53
53
  "peerDependenciesMeta": {
@@ -57,18 +57,18 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "generate-differences": "^0.1.1",
60
- "ignore": "^7.0.5",
61
- "load-oxfmt-config": "^0.14.0",
60
+ "ignore": "^7.0.6",
61
+ "load-oxfmt-config": "^0.16.0",
62
62
  "picomatch": "^4.0.5",
63
63
  "synckit": "^0.11.13"
64
64
  },
65
65
  "devDependencies": {
66
- "@ntnyq/eslint-config": "^6.1.5",
66
+ "@ntnyq/eslint-config": "^7.0.0-beta.13",
67
67
  "@types/json-schema": "^7.0.15",
68
- "@types/node": "^26.1.0",
69
- "@typescript/native-preview": "^7.0.0-dev.20260706.1",
70
- "bumpp": "^11.1.0",
71
- "eslint": "^10.6.0",
68
+ "@types/node": "^26.1.1",
69
+ "@typescript/native-preview": "^7.0.0-dev.20260707.2",
70
+ "bumpp": "^12.0.0",
71
+ "eslint": "^10.7.0",
72
72
  "eslint-parser-plain": "^0.1.1",
73
73
  "eslint-typegen": "^2.3.1",
74
74
  "eslint-vitest-rule-tester": "^3.1.0",
@@ -76,15 +76,15 @@
76
76
  "jsonc-eslint-parser": "^3.1.0",
77
77
  "nano-staged": "^1.0.2",
78
78
  "npm-run-all2": "^9.0.2",
79
- "oxfmt": "^0.58.0",
79
+ "oxfmt": "^0.60.0",
80
80
  "show-invisibles": "^0.0.2",
81
- "svelte": "^5.56.4",
81
+ "svelte": "^5.56.7",
82
82
  "tinyglobby": "^0.2.17",
83
- "tsdown": "^0.22.3",
84
- "tsx": "^4.23.0",
83
+ "tsdown": "^0.22.13",
84
+ "tsx": "^4.23.1",
85
85
  "typescript": "^6.0.3",
86
86
  "vitest": "^4.1.10",
87
- "eslint-plugin-oxfmt": "0.13.0"
87
+ "eslint-plugin-oxfmt": "0.15.0"
88
88
  },
89
89
  "engines": {
90
90
  "node": "^20.19.0 || >=22.12.0"
package/workers/oxfmt.mjs CHANGED
@@ -247,10 +247,24 @@ function getCachedOverrideMatcher(patterns) {
247
247
  return cached
248
248
  }
249
249
 
250
- const matcher = picomatch(patterns, {
250
+ const matcherOptions = {
251
251
  dot: true,
252
252
  noextglob: true,
253
- })
253
+ strictBrackets: true,
254
+ }
255
+
256
+ for (const pattern of patterns) {
257
+ try {
258
+ picomatch(pattern, matcherOptions)
259
+ } catch (error) {
260
+ const details = error instanceof Error ? `: ${error.message}` : ''
261
+ throw new Error(`Invalid glob pattern \`${pattern}\`${details}`, {
262
+ cause: error,
263
+ })
264
+ }
265
+ }
266
+
267
+ const matcher = picomatch(patterns, matcherOptions)
254
268
  setCacheEntry(overrideMatcherCache, key, matcher)
255
269
  return matcher
256
270
  }