eslint-plugin-oxfmt 0.11.0 → 0.12.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
@@ -22,6 +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.57.0`
25
26
 
26
27
  ## Installation
27
28
 
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.11.0"
82
+ version: "0.12.0"
83
83
  };
84
84
  //#endregion
85
85
  //#region src/dir.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-oxfmt",
3
3
  "type": "module",
4
- "version": "0.11.0",
4
+ "version": "0.12.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.56.0",
50
+ "oxfmt": ">=0.57.0",
51
51
  "svelte": "*"
52
52
  },
53
53
  "peerDependenciesMeta": {
@@ -57,17 +57,17 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "generate-differences": "^0.1.1",
60
- "load-oxfmt-config": "^0.12.1",
60
+ "load-oxfmt-config": "^0.13.0",
61
61
  "picomatch": "^4.0.4",
62
62
  "synckit": "^0.11.13"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@ntnyq/eslint-config": "^6.1.5",
66
66
  "@types/json-schema": "^7.0.15",
67
- "@types/node": "^26.0.0",
68
- "@typescript/native-preview": "^7.0.0-dev.20260622.1",
67
+ "@types/node": "^26.0.1",
68
+ "@typescript/native-preview": "^7.0.0-dev.20260629.1",
69
69
  "bumpp": "^11.1.0",
70
- "eslint": "^10.5.0",
70
+ "eslint": "^10.6.0",
71
71
  "eslint-parser-plain": "^0.1.1",
72
72
  "eslint-typegen": "^2.3.1",
73
73
  "eslint-vitest-rule-tester": "^3.1.0",
@@ -75,15 +75,15 @@
75
75
  "jsonc-eslint-parser": "^3.1.0",
76
76
  "nano-staged": "^1.0.2",
77
77
  "npm-run-all2": "^9.0.2",
78
- "oxfmt": "^0.56.0",
78
+ "oxfmt": "^0.57.0",
79
79
  "show-invisibles": "^0.0.2",
80
- "svelte": "^5.56.3",
80
+ "svelte": "^5.56.4",
81
81
  "tinyglobby": "^0.2.17",
82
82
  "tsdown": "^0.22.3",
83
83
  "tsx": "^4.22.4",
84
84
  "typescript": "^6.0.3",
85
85
  "vitest": "^4.1.9",
86
- "eslint-plugin-oxfmt": "0.11.0"
86
+ "eslint-plugin-oxfmt": "0.12.0"
87
87
  },
88
88
  "engines": {
89
89
  "node": "^20.19.0 || >=22.12.0"
package/workers/oxfmt.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- import { dirname, relative } from 'node:path'
3
+ import { dirname, extname, relative } from 'node:path'
4
4
  import { isOxfmtIgnored, loadOxfmtConfig } from 'load-oxfmt-config'
5
5
  import { format } from 'oxfmt'
6
6
  import picomatch from 'picomatch'
@@ -118,6 +118,7 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
118
118
 
119
119
  const cwd = pluginOptions.cwd
120
120
  const useConfig = pluginOptions.useConfig !== false
121
+ const useCache = getUseCacheOption(pluginOptions)
121
122
 
122
123
  const ruleIgnorePatterns = isStringArray(inlineFormatOptions.ignorePatterns)
123
124
  ? inlineFormatOptions.ignorePatterns
@@ -143,7 +144,7 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
143
144
  ignorePath: pluginOptions.ignorePath,
144
145
  includeConfigIgnorePatterns: useConfig,
145
146
  loadConfigForIgnorePatterns: useConfig,
146
- useCache: pluginOptions.useCache,
147
+ useCache,
147
148
  withNodeModules: pluginOptions.withNodeModules,
148
149
  }
149
150
  const ignored = await isOxfmtIgnored(ignoredOptions)
@@ -178,7 +179,7 @@ async function formatViaOxfmt(filename, sourceText, options = {}) {
178
179
  disableNestedConfig: pluginOptions.disableNestedConfig,
179
180
  editorconfig: pluginOptions.editorconfig,
180
181
  filepath: filename,
181
- useCache: pluginOptions.useCache,
182
+ useCache,
182
183
  })
183
184
  const { overrides: configOverrides, ...loadedConfig } = loaded.config
184
185
  const { overrides: ruleOverrides, ...inlineOptionsWithoutOverrides } =
@@ -241,6 +242,24 @@ function getRelativePath(baseDir, filename) {
241
242
  return relative(baseDir, filename).replace(/\\/g, '/')
242
243
  }
243
244
 
245
+ /**
246
+ * Resolve the cache setting passed to load-oxfmt-config.
247
+ * Explicit CommonJS config files need the loader's non-cached CJS path so
248
+ * `module.exports = {}` configs are read as config objects.
249
+ * @param {PluginOnlyOptions} pluginOptions - Plugin orchestration options.
250
+ * @returns {boolean | undefined} Cache setting for config/ignore loading.
251
+ */
252
+ function getUseCacheOption(pluginOptions) {
253
+ if (
254
+ pluginOptions.configPath &&
255
+ extname(pluginOptions.configPath) === '.cjs'
256
+ ) {
257
+ return false
258
+ }
259
+
260
+ return pluginOptions.useCache
261
+ }
262
+
244
263
  /**
245
264
  * Check whether a value is an array of strings.
246
265
  * @param {unknown} value - Value to validate.