eslint-plugin-oxfmt 0.6.0 → 0.7.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`
16
+ - 🧩 **Config File Discovery** - Auto-discovers `.oxfmtrc.json`, `.oxfmtrc.jsonc`, and `oxfmt.config.{ts,mts,cts,js,mjs,cjs}`
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)
@@ -80,11 +80,13 @@ import pluginOxfmt from 'eslint-plugin-oxfmt'
80
80
  export default [
81
81
  {
82
82
  ...pluginOxfmt.configs.cliParity,
83
- files: ['**/*.{js,ts,mjs,cjs,jsx,tsx,json,jsonc,yaml,yml}'],
83
+ files: ['**/*.{js,ts,mjs,cjs,jsx,tsx,svelte,json,jsonc,yaml,yml}'],
84
84
  },
85
85
  ]
86
86
  ```
87
87
 
88
+ `cliParity` is parser-agnostic. For non-JS extensions (for example `svelte`, `json`, `yaml`), also configure a suitable `languageOptions.parser` (such as `eslint-parser-plain`) in that config block.
89
+
88
90
  ### Custom Configuration
89
91
 
90
92
  You can customize the formatting options by configuring the rule:
@@ -173,7 +175,7 @@ All options are optional and default to sensible values.
173
175
 
174
176
  | Option | Type | Default | Description |
175
177
  | ---------------------------- | ------------------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
176
- | `useConfig` | `boolean` | `true` | Load `.oxfmtrc.json`, `.oxfmtrc.jsonc`, or `oxfmt.config.*` via `load-oxfmt-config`. Set to `false` to rely only on inline options. |
178
+ | `useConfig` | `boolean` | `true` | Load `.oxfmtrc.json`, `.oxfmtrc.jsonc`, or `oxfmt.config.{ts,mts,cts,js,mjs,cjs}` via `load-oxfmt-config`. Set to `false` to rely only on inline options. |
177
179
  | `configPath` | `string` | — | Custom path to an oxfmt config file. Relative paths resolve from ESLint `cwd`; absolute paths are used as-is. Explicit `configPath` accepts `.json`, `.jsonc`, `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs`. |
178
180
  | `editorconfig` | `boolean \| { onlyCwd?: boolean; cwd?: string }` | `true` | Control `.editorconfig` loading. Use `false` to disable, or object form for advanced resolution strategy. |
179
181
  | `ignorePath` | `string \| string[]` | — | Ignore file path(s) for CLI-style ignore resolution (same role as CLI `--ignore-path`). |
@@ -188,7 +190,7 @@ All options are optional and default to sensible values.
188
190
 
189
191
  When `useConfig` is `true`, the plugin loads config using `load-oxfmt-config`.
190
192
 
191
- - Config discovery order (from `cwd`, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts`
193
+ - Config discovery order (from `cwd`, walking upward): `.oxfmtrc.json` → `.oxfmtrc.jsonc` → `oxfmt.config.ts` / `oxfmt.config.mts` / `oxfmt.config.cts` / `oxfmt.config.js` / `oxfmt.config.mjs` / `oxfmt.config.cjs`
192
194
  - `.editorconfig` support: nearest `.editorconfig` (including section overrides) is merged into the final options
193
195
  - Set `editorconfig: false` to disable `.editorconfig` merging
194
196
  - Set `editorconfig: { onlyCwd: true }` to read only the current `cwd`'s `.editorconfig` (no upward traversal)
@@ -292,6 +294,7 @@ Tip: `jsdoc: true` is equivalent to enabling JSDoc with default settings.
292
294
  | `sortImports` | `boolean \| object` | disabled | Experimental import sorting configuration |
293
295
  | `sortPackageJson` | `boolean \| object` | `true` | Experimental package.json sorting (object form: `{ sortScripts?: boolean }`) |
294
296
  | `sortTailwindcss` | `boolean \| object` | disabled | Experimental Tailwind CSS class sorting (enable with `{}` for defaults) |
297
+ | `svelte` | `boolean \| object` | disabled | Enable/configure `.svelte` formatting via `prettier-plugin-svelte` |
295
298
 
296
299
  #### Import sorting (`sortImports`)
297
300
 
@@ -413,10 +416,12 @@ It respects:
413
416
 
414
417
  - `.oxfmtrc.json`
415
418
  - `.oxfmtrc.jsonc`
416
- - `oxfmt.config.*`
419
+ - `oxfmt.config.{ts,mts,cts,js,mjs,cjs}`
417
420
  - `.editorconfig`
418
421
  - `ignorePatterns`
419
422
  - `.gitignore`
423
+ - parent `.gitignore`
424
+ - `.git/info/exclude`
420
425
  - `.prettierignore`
421
426
  - default ignored directories
422
427
  - default ignored lockfiles
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.6.0"
82
+ version: "0.7.0"
83
83
  };
84
84
  //#endregion
85
85
  //#region src/dir.ts
@@ -438,6 +438,27 @@ const oxfmtOptionsSchema = {
438
438
  }
439
439
  }]
440
440
  },
441
+ svelte: {
442
+ description: `Options for prettier-plugin-svelte.\nPass true or an object to enable .svelte file formatting, or false/omit to disable.\n\nNOTE: prettier-plugin-svelte requires the svelte package (svelte/compiler) at runtime.\n\n- (Default: disabled)`,
443
+ oneOf: [{ type: "boolean" }, {
444
+ additionalProperties: false,
445
+ type: "object",
446
+ properties: {
447
+ allowShorthand: {
448
+ description: `Whether to allow attribute shorthand if attribute name and expression are the same. (Default: true)`,
449
+ type: "boolean"
450
+ },
451
+ indentScriptAndStyle: {
452
+ description: `Whether to indent code inside <script> and <style> tags in Svelte files. (Default: true)`,
453
+ type: "boolean"
454
+ },
455
+ sortOrder: {
456
+ description: `The order in which Svelte sections are printed, e.g. "options-scripts-markup-styles", or "none" to keep order. (Default: "options-scripts-markup-styles")`,
457
+ type: "string"
458
+ }
459
+ }
460
+ }]
461
+ },
441
462
  tabWidth: {
442
463
  description: `Number of spaces per indentation level. (Default: 2)`,
443
464
  type: "integer"
@@ -535,7 +556,7 @@ const oxfmtRuleSchema = {
535
556
  items: { type: "string" }
536
557
  },
537
558
  files: {
538
- description: `Glob patterns to match files for this override.\nAll patterns are relative to the Oxfmt configuration file.`,
559
+ description: `Glob patterns to match files for this override.\nWhen \`useConfig\` is true, patterns are resolved relative to the discovered/resolved Oxfmt config directory.\nWhen \`useConfig\` is false, patterns are resolved relative to ESLint cwd.`,
539
560
  type: "array",
540
561
  items: { type: "string" }
541
562
  },
@@ -124,6 +124,15 @@ export type OxfmtOxfmt = []|[{
124
124
  stylesheet?: string
125
125
  })
126
126
 
127
+ svelte?: (boolean | {
128
+
129
+ allowShorthand?: boolean
130
+
131
+ indentScriptAndStyle?: boolean
132
+
133
+ sortOrder?: string
134
+ })
135
+
127
136
  tabWidth?: number
128
137
 
129
138
  trailingComma?: ("all" | "es5" | "none")
@@ -269,6 +278,15 @@ export type OxfmtOxfmt = []|[{
269
278
  stylesheet?: string
270
279
  })
271
280
 
281
+ svelte?: (boolean | {
282
+
283
+ allowShorthand?: boolean
284
+
285
+ indentScriptAndStyle?: boolean
286
+
287
+ sortOrder?: string
288
+ })
289
+
272
290
  tabWidth?: number
273
291
 
274
292
  trailingComma?: ("all" | "es5" | "none")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-oxfmt",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "description": "An ESLint plugin for formatting code with oxfmt.",
6
6
  "keywords": [
7
7
  "eslint",
@@ -44,19 +44,25 @@
44
44
  "sideEffects": false,
45
45
  "peerDependencies": {
46
46
  "eslint": "^9.5.0 || ^10.0.0",
47
- "oxfmt": ">=0.45.0"
47
+ "oxfmt": ">=0.49.0",
48
+ "svelte": "*"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "svelte": {
52
+ "optional": true
53
+ }
48
54
  },
49
55
  "dependencies": {
50
56
  "generate-differences": "^0.1.1",
51
- "load-oxfmt-config": "^0.7.1",
57
+ "load-oxfmt-config": "^0.8.0",
52
58
  "picomatch": "^4.0.4",
53
59
  "synckit": "^0.11.12"
54
60
  },
55
61
  "devDependencies": {
56
62
  "@ntnyq/eslint-config": "^6.1.3",
57
63
  "@types/json-schema": "^7.0.15",
58
- "@types/node": "^25.6.2",
59
- "@typescript/native-preview": "^7.0.0-dev.20260507.1",
64
+ "@types/node": "^25.7.0",
65
+ "@typescript/native-preview": "^7.0.0-dev.20260511.1",
60
66
  "bumpp": "^11.1.0",
61
67
  "eslint": "^10.3.0",
62
68
  "eslint-parser-plain": "^0.1.1",
@@ -66,14 +72,15 @@
66
72
  "jsonc-eslint-parser": "^3.1.0",
67
73
  "nano-staged": "^1.0.2",
68
74
  "npm-run-all2": "^8.0.4",
69
- "oxfmt": "^0.48.0",
75
+ "oxfmt": "^0.49.0",
70
76
  "show-invisibles": "^0.0.2",
77
+ "svelte": "^5.55.5",
71
78
  "tinyglobby": "^0.2.16",
72
79
  "tsdown": "^0.22.0",
73
80
  "tsx": "^4.21.0",
74
81
  "typescript": "^6.0.3",
75
- "vitest": "^4.1.5",
76
- "eslint-plugin-oxfmt": "0.6.0"
82
+ "vitest": "^4.1.6",
83
+ "eslint-plugin-oxfmt": "0.7.0"
77
84
  },
78
85
  "engines": {
79
86
  "node": "^20.19.0 || >=22.12.0"
package/workers/oxfmt.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
 
3
3
  import { dirname, relative } from 'node:path'
4
- import { isOxfmtIgnored, loadOxfmtConfigResult } from 'load-oxfmt-config'
4
+ import { isOxfmtIgnored, loadOxfmtConfig } from 'load-oxfmt-config'
5
5
  import { format } from 'oxfmt'
6
6
  import picomatch from 'picomatch'
7
7
  import { runAsWorker } from 'synckit'
@@ -178,7 +178,7 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
178
178
  ? cwd
179
179
  : dirname(filename)
180
180
 
181
- const loaded = await loadOxfmtConfigResult({
181
+ const loaded = await loadOxfmtConfig({
182
182
  configPath: pluginOptions.configPath,
183
183
  cwd: configResolutionCwd,
184
184
  editorconfig: pluginOptions.editorconfig,