eslint-plugin-oxfmt 0.1.1 → 0.1.2
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/dist/index.mjs +12 -35
- package/package.json +9 -9
- package/workers/oxfmt.mjs +37 -0
package/dist/index.mjs
CHANGED
|
@@ -2,23 +2,17 @@ import { join } from "node:path";
|
|
|
2
2
|
import { createSyncFn } from "synckit";
|
|
3
3
|
import { URL, fileURLToPath } from "node:url";
|
|
4
4
|
import { DIFFERENCE, generateDifferences } from "generate-differences";
|
|
5
|
-
|
|
6
5
|
//#region \0rolldown/runtime.js
|
|
7
6
|
var __defProp = Object.defineProperty;
|
|
8
7
|
var __exportAll = (all, no_symbols) => {
|
|
9
8
|
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (!no_symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
14
|
return target;
|
|
20
15
|
};
|
|
21
|
-
|
|
22
16
|
//#endregion
|
|
23
17
|
//#region node_modules/.pnpm/eslint-parser-plain@0.1.1/node_modules/eslint-parser-plain/dist/index.mjs
|
|
24
18
|
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -47,11 +41,9 @@ const meta$1 = {
|
|
|
47
41
|
name: name$1,
|
|
48
42
|
version: version$1
|
|
49
43
|
};
|
|
50
|
-
|
|
51
44
|
//#endregion
|
|
52
45
|
//#region src/parser.ts
|
|
53
46
|
const parserPlain = dist_exports;
|
|
54
|
-
|
|
55
47
|
//#endregion
|
|
56
48
|
//#region src/configs.ts
|
|
57
49
|
const recommended = {
|
|
@@ -63,23 +55,15 @@ const recommended = {
|
|
|
63
55
|
rules: { "oxfmt/oxfmt": "error" }
|
|
64
56
|
};
|
|
65
57
|
const configs = { recommended };
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region package.json
|
|
69
|
-
var name = "eslint-plugin-oxfmt";
|
|
70
|
-
var version = "0.1.1";
|
|
71
|
-
|
|
72
58
|
//#endregion
|
|
73
59
|
//#region src/meta.ts
|
|
74
60
|
const meta = {
|
|
75
|
-
name,
|
|
76
|
-
version
|
|
61
|
+
name: "eslint-plugin-oxfmt",
|
|
62
|
+
version: "0.1.2"
|
|
77
63
|
};
|
|
78
|
-
|
|
79
64
|
//#endregion
|
|
80
65
|
//#region src/dir.ts
|
|
81
66
|
const dirWorkers = fileURLToPath(new URL("../workers", import.meta.url));
|
|
82
|
-
|
|
83
67
|
//#endregion
|
|
84
68
|
//#region node_modules/.pnpm/show-invisibles@0.0.2/node_modules/show-invisibles/dist/index.js
|
|
85
69
|
const DEFAULT_MAPPINGS = new Map([
|
|
@@ -112,7 +96,6 @@ function showInvisibles(input, options = {}) {
|
|
|
112
96
|
if (typeof input !== "string") throw new TypeError(`Expected input to type string, got ${typeof input}`);
|
|
113
97
|
return input.split("").map((c) => mappings.get(c) || c).join("");
|
|
114
98
|
}
|
|
115
|
-
|
|
116
99
|
//#endregion
|
|
117
100
|
//#region src/reporter.ts
|
|
118
101
|
/**
|
|
@@ -149,7 +132,6 @@ function _reportDifference(context, difference, rangeOffset = 0) {
|
|
|
149
132
|
fix: (fixer) => fixer.replaceTextRange(range, insertText)
|
|
150
133
|
});
|
|
151
134
|
}
|
|
152
|
-
|
|
153
135
|
//#endregion
|
|
154
136
|
//#region src/schema.ts
|
|
155
137
|
const oxfmtOptionsSchema = {
|
|
@@ -449,11 +431,12 @@ const oxfmtRuleSchema = {
|
|
|
449
431
|
}
|
|
450
432
|
}
|
|
451
433
|
};
|
|
452
|
-
|
|
453
434
|
//#endregion
|
|
454
435
|
//#region src/rules/oxfmt.ts
|
|
455
436
|
let formatViaOxfmt;
|
|
456
|
-
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/rules/index.ts
|
|
439
|
+
const rules = { oxfmt: {
|
|
457
440
|
meta: {
|
|
458
441
|
defaultOptions: [],
|
|
459
442
|
fixable: "whitespace",
|
|
@@ -519,12 +502,7 @@ const oxfmt = {
|
|
|
519
502
|
}
|
|
520
503
|
} };
|
|
521
504
|
}
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
//#endregion
|
|
525
|
-
//#region src/rules/index.ts
|
|
526
|
-
const rules = { oxfmt };
|
|
527
|
-
|
|
505
|
+
} };
|
|
528
506
|
//#endregion
|
|
529
507
|
//#region src/index.ts
|
|
530
508
|
const plugin = {
|
|
@@ -532,6 +510,5 @@ const plugin = {
|
|
|
532
510
|
meta,
|
|
533
511
|
rules
|
|
534
512
|
};
|
|
535
|
-
|
|
536
513
|
//#endregion
|
|
537
|
-
export { configs, plugin as default, plugin, meta, parserPlain, recommended, rules };
|
|
514
|
+
export { configs, plugin as default, plugin, meta, parserPlain, recommended, rules };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-oxfmt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "An ESLint plugin for formatting code with oxfmt.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -48,31 +48,31 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"generate-differences": "^0.1.1",
|
|
51
|
-
"load-oxfmt-config": "^0.
|
|
51
|
+
"load-oxfmt-config": "^0.2.0",
|
|
52
52
|
"picomatch": "^4.0.3",
|
|
53
53
|
"synckit": "^0.11.12"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@ntnyq/eslint-config": "^6.0.0-beta.
|
|
56
|
+
"@ntnyq/eslint-config": "^6.0.0-beta.13",
|
|
57
57
|
"@types/json-schema": "^7.0.15",
|
|
58
|
-
"@types/node": "^25.
|
|
59
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
58
|
+
"@types/node": "^25.4.0",
|
|
59
|
+
"@typescript/native-preview": "^7.0.0-dev.20260312.1",
|
|
60
60
|
"bumpp": "^10.4.1",
|
|
61
|
-
"eslint": "^10.0.
|
|
61
|
+
"eslint": "^10.0.3",
|
|
62
62
|
"eslint-parser-plain": "^0.1.1",
|
|
63
63
|
"eslint-typegen": "^2.3.1",
|
|
64
64
|
"eslint-vitest-rule-tester": "^3.1.0",
|
|
65
65
|
"husky": "^9.1.7",
|
|
66
66
|
"nano-staged": "^0.9.0",
|
|
67
67
|
"npm-run-all2": "^8.0.4",
|
|
68
|
-
"oxfmt": "^0.
|
|
68
|
+
"oxfmt": "^0.39.0",
|
|
69
69
|
"show-invisibles": "^0.0.2",
|
|
70
70
|
"tinyglobby": "^0.2.15",
|
|
71
|
-
"tsdown": "^0.
|
|
71
|
+
"tsdown": "^0.21.2",
|
|
72
72
|
"tsx": "^4.21.0",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
74
|
"vitest": "^4.0.18",
|
|
75
|
-
"eslint-plugin-oxfmt": "0.1.
|
|
75
|
+
"eslint-plugin-oxfmt": "0.1.2"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.19.0 || >=22.12.0"
|
package/workers/oxfmt.mjs
CHANGED
|
@@ -69,6 +69,32 @@ function applyOverrides(
|
|
|
69
69
|
return hasOverrides ? mergedOptions : baseOptions
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Check if a file should be ignored based on ignorePatterns
|
|
74
|
+
* @param filename - The file path
|
|
75
|
+
* @param cwd - Current working directory
|
|
76
|
+
* @param [ignorePatterns] - Ignore patterns
|
|
77
|
+
* @returns - Whether the file should be ignored
|
|
78
|
+
*/
|
|
79
|
+
function shouldIgnoreFile(
|
|
80
|
+
/** @type {string} */
|
|
81
|
+
filename,
|
|
82
|
+
/** @type {string} */
|
|
83
|
+
cwd,
|
|
84
|
+
/** @type {string[] | undefined} */
|
|
85
|
+
ignorePatterns,
|
|
86
|
+
) {
|
|
87
|
+
if (!ignorePatterns || ignorePatterns.length === 0) {
|
|
88
|
+
return false
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Get relative path from cwd and normalize to forward slashes for cross-platform compatibility
|
|
92
|
+
const relativePath = relative(cwd, filename).replace(/\\/g, '/')
|
|
93
|
+
|
|
94
|
+
// Check if file matches any ignore pattern
|
|
95
|
+
return picomatch.isMatch(relativePath, ignorePatterns)
|
|
96
|
+
}
|
|
97
|
+
|
|
72
98
|
runAsWorker(
|
|
73
99
|
async (
|
|
74
100
|
/**
|
|
@@ -87,6 +113,7 @@ runAsWorker(
|
|
|
87
113
|
const {
|
|
88
114
|
configPath,
|
|
89
115
|
cwd,
|
|
116
|
+
ignorePatterns,
|
|
90
117
|
overrides,
|
|
91
118
|
useConfig = true,
|
|
92
119
|
...formatOptions
|
|
@@ -103,6 +130,16 @@ runAsWorker(
|
|
|
103
130
|
...formatOptions,
|
|
104
131
|
}
|
|
105
132
|
|
|
133
|
+
if (
|
|
134
|
+
shouldIgnoreFile(
|
|
135
|
+
filename,
|
|
136
|
+
cwd,
|
|
137
|
+
ignorePatterns || baseOptions.ignorePatterns,
|
|
138
|
+
)
|
|
139
|
+
) {
|
|
140
|
+
return { code: sourceText }
|
|
141
|
+
}
|
|
142
|
+
|
|
106
143
|
// Apply overrides based on filename
|
|
107
144
|
const mergedOptions = applyOverrides(
|
|
108
145
|
filename,
|