eslint-plugin-oxfmt 0.10.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 +1 -0
- package/dist/index.mjs +5 -3
- package/dts/rule-options.d.ts +0 -2
- package/package.json +12 -12
- package/workers/oxfmt.mjs +22 -3
package/README.md
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -79,14 +79,14 @@ const configs = {
|
|
|
79
79
|
//#region src/meta.ts
|
|
80
80
|
const meta = {
|
|
81
81
|
name: "eslint-plugin-oxfmt",
|
|
82
|
-
version: "0.
|
|
82
|
+
version: "0.12.0"
|
|
83
83
|
};
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/dir.ts
|
|
86
86
|
const dirWorkers = fileURLToPath(new URL("../workers", import.meta.url));
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region node_modules/.pnpm/show-invisibles@0.0.2/node_modules/show-invisibles/dist/index.js
|
|
89
|
-
const DEFAULT_MAPPINGS = new Map([
|
|
89
|
+
const DEFAULT_MAPPINGS = /* @__PURE__ */ new Map([
|
|
90
90
|
[" ", "·"],
|
|
91
91
|
["\n", "⏎"],
|
|
92
92
|
["\r", "␍"],
|
|
@@ -482,6 +482,8 @@ const oxfmtOptionsSchema = {
|
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
};
|
|
485
|
+
const oxfmtOverrideOptionsSchemaProperties = { ...oxfmtOptionsSchema.properties };
|
|
486
|
+
delete oxfmtOverrideOptionsSchemaProperties.ignorePatterns;
|
|
485
487
|
const oxfmtConfigSchema = {
|
|
486
488
|
additionalProperties: false,
|
|
487
489
|
type: "object",
|
|
@@ -564,7 +566,7 @@ const oxfmtRuleSchema = {
|
|
|
564
566
|
additionalProperties: false,
|
|
565
567
|
description: `Format options to apply for matched files.`,
|
|
566
568
|
type: "object",
|
|
567
|
-
properties: { ...
|
|
569
|
+
properties: { ...oxfmtOverrideOptionsSchemaProperties }
|
|
568
570
|
}
|
|
569
571
|
}
|
|
570
572
|
}
|
package/dts/rule-options.d.ts
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.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.
|
|
50
|
+
"oxfmt": ">=0.57.0",
|
|
51
51
|
"svelte": "*"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
@@ -57,33 +57,33 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"generate-differences": "^0.1.1",
|
|
60
|
-
"load-oxfmt-config": "^0.
|
|
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": "^
|
|
68
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
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.
|
|
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",
|
|
74
74
|
"husky": "^9.1.7",
|
|
75
75
|
"jsonc-eslint-parser": "^3.1.0",
|
|
76
76
|
"nano-staged": "^1.0.2",
|
|
77
|
-
"npm-run-all2": "^9.0.
|
|
78
|
-
"oxfmt": "^0.
|
|
77
|
+
"npm-run-all2": "^9.0.2",
|
|
78
|
+
"oxfmt": "^0.57.0",
|
|
79
79
|
"show-invisibles": "^0.0.2",
|
|
80
|
-
"svelte": "^5.56.
|
|
80
|
+
"svelte": "^5.56.4",
|
|
81
81
|
"tinyglobby": "^0.2.17",
|
|
82
|
-
"tsdown": "^0.22.
|
|
82
|
+
"tsdown": "^0.22.3",
|
|
83
83
|
"tsx": "^4.22.4",
|
|
84
84
|
"typescript": "^6.0.3",
|
|
85
|
-
"vitest": "^4.1.
|
|
86
|
-
"eslint-plugin-oxfmt": "0.
|
|
85
|
+
"vitest": "^4.1.9",
|
|
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
|
|
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
|
|
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.
|