@eslint-sets/eslint-config 6.1.0 → 6.2.0-beta.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 +12 -0
- package/dist/cli/index.js +13 -12
- package/dist/cli/index.mjs +1 -0
- package/dist/configs/stylistic.d.ts.map +1 -1
- package/dist/configs/typescript.d.ts.map +1 -1
- package/dist/configs/unocss.d.ts.map +1 -1
- package/dist/index.js +38 -22
- package/dist/index.mjs +34 -18
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +151 -150
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Try it online with StackBlitz:
|
|
|
41
41
|
- 🔍 **Editor Detection** - Automatically detect editor environment
|
|
42
42
|
- 🔎 **Config Inspector** - Visual tool for inspecting your ESLint config
|
|
43
43
|
- 📊 **Perfectionist Sorting** - Import/export sorting with natural ordering
|
|
44
|
+
- 🔄 **CJS & ESM Support** - Works with both CommonJS and ES Module config files
|
|
44
45
|
|
|
45
46
|
## Supported Frameworks
|
|
46
47
|
|
|
@@ -70,6 +71,15 @@ npm install -D @eslint-sets/eslint-config eslint
|
|
|
70
71
|
bun add -D @eslint-sets/eslint-config eslint
|
|
71
72
|
```
|
|
72
73
|
|
|
74
|
+
> **Note for pnpm users**: ESLint 9.x requires `jiti` for TypeScript config files. If you use `eslint.config.ts`, ensure peer dependencies are installed:
|
|
75
|
+
> ```shell
|
|
76
|
+
> # Option 1: Add to .npmrc
|
|
77
|
+
> echo "auto-install-peers=true" >> .npmrc
|
|
78
|
+
>
|
|
79
|
+
> # Option 2: Install jiti manually
|
|
80
|
+
> pnpm add -D jiti
|
|
81
|
+
> ```
|
|
82
|
+
|
|
73
83
|
## Requirements
|
|
74
84
|
|
|
75
85
|
- **Node.js**: `^18.18.0` or `^20.9.0` or `>=21.1.0`
|
|
@@ -580,6 +590,8 @@ import {
|
|
|
580
590
|
| prettier | ^3.5.3 (optional, for Prettier integration) |
|
|
581
591
|
| typescript | >=5.0.0 (optional, for TypeScript support) |
|
|
582
592
|
|
|
593
|
+
> **Note**: ESLint 9.x requires `jiti` for loading TypeScript config files. It's automatically installed as ESLint's peer dependency with npm/yarn, but pnpm users may need to enable `auto-install-peers` or use `--shamefully-hoist`.
|
|
594
|
+
|
|
583
595
|
## System Requirements
|
|
584
596
|
|
|
585
597
|
| Requirement | Version |
|
package/dist/cli/index.js
CHANGED
|
@@ -26,6 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/cli/index.ts
|
|
27
27
|
var import_node_fs = require("node:fs");
|
|
28
28
|
var import_node_path = require("node:path");
|
|
29
|
+
var import_node_process = __toESM(require("node:process"));
|
|
29
30
|
var p = __toESM(require("@clack/prompts"));
|
|
30
31
|
async function main() {
|
|
31
32
|
console.clear();
|
|
@@ -49,7 +50,7 @@ async function main() {
|
|
|
49
50
|
});
|
|
50
51
|
if (p.isCancel(projectType)) {
|
|
51
52
|
p.cancel("Operation cancelled.");
|
|
52
|
-
|
|
53
|
+
import_node_process.default.exit(0);
|
|
53
54
|
}
|
|
54
55
|
answers.type = projectType;
|
|
55
56
|
const typescript = await p.confirm({
|
|
@@ -58,7 +59,7 @@ async function main() {
|
|
|
58
59
|
});
|
|
59
60
|
if (p.isCancel(typescript)) {
|
|
60
61
|
p.cancel("Operation cancelled.");
|
|
61
|
-
|
|
62
|
+
import_node_process.default.exit(0);
|
|
62
63
|
}
|
|
63
64
|
answers.typescript = typescript;
|
|
64
65
|
const frameworks = await p.multiselect({
|
|
@@ -78,7 +79,7 @@ async function main() {
|
|
|
78
79
|
});
|
|
79
80
|
if (p.isCancel(frameworks)) {
|
|
80
81
|
p.cancel("Operation cancelled.");
|
|
81
|
-
|
|
82
|
+
import_node_process.default.exit(0);
|
|
82
83
|
}
|
|
83
84
|
answers.frameworks = frameworks;
|
|
84
85
|
if (answers.frameworks.includes("vue") || answers.frameworks.includes("react")) {
|
|
@@ -88,7 +89,7 @@ async function main() {
|
|
|
88
89
|
});
|
|
89
90
|
if (p.isCancel(a11y)) {
|
|
90
91
|
p.cancel("Operation cancelled.");
|
|
91
|
-
|
|
92
|
+
import_node_process.default.exit(0);
|
|
92
93
|
}
|
|
93
94
|
answers.a11y = a11y;
|
|
94
95
|
}
|
|
@@ -101,7 +102,7 @@ async function main() {
|
|
|
101
102
|
});
|
|
102
103
|
if (p.isCancel(formatter)) {
|
|
103
104
|
p.cancel("Operation cancelled.");
|
|
104
|
-
|
|
105
|
+
import_node_process.default.exit(0);
|
|
105
106
|
}
|
|
106
107
|
answers.formatter = formatter;
|
|
107
108
|
const gitignore = await p.confirm({
|
|
@@ -110,7 +111,7 @@ async function main() {
|
|
|
110
111
|
});
|
|
111
112
|
if (p.isCancel(gitignore)) {
|
|
112
113
|
p.cancel("Operation cancelled.");
|
|
113
|
-
|
|
114
|
+
import_node_process.default.exit(0);
|
|
114
115
|
}
|
|
115
116
|
answers.gitignore = gitignore;
|
|
116
117
|
const sortPackageJson = await p.confirm({
|
|
@@ -119,7 +120,7 @@ async function main() {
|
|
|
119
120
|
});
|
|
120
121
|
if (p.isCancel(sortPackageJson)) {
|
|
121
122
|
p.cancel("Operation cancelled.");
|
|
122
|
-
|
|
123
|
+
import_node_process.default.exit(0);
|
|
123
124
|
}
|
|
124
125
|
answers.sortPackageJson = sortPackageJson;
|
|
125
126
|
const sortTsconfig = await p.confirm({
|
|
@@ -128,11 +129,11 @@ async function main() {
|
|
|
128
129
|
});
|
|
129
130
|
if (p.isCancel(sortTsconfig)) {
|
|
130
131
|
p.cancel("Operation cancelled.");
|
|
131
|
-
|
|
132
|
+
import_node_process.default.exit(0);
|
|
132
133
|
}
|
|
133
134
|
answers.sortTsconfig = sortTsconfig;
|
|
134
135
|
const config = generateConfig(answers);
|
|
135
|
-
const cwd =
|
|
136
|
+
const cwd = import_node_process.default.cwd();
|
|
136
137
|
const configPath = (0, import_node_path.resolve)(cwd, "eslint.config.ts");
|
|
137
138
|
if ((0, import_node_fs.existsSync)(configPath)) {
|
|
138
139
|
const overwrite = await p.confirm({
|
|
@@ -141,7 +142,7 @@ async function main() {
|
|
|
141
142
|
});
|
|
142
143
|
if (p.isCancel(overwrite) || !overwrite) {
|
|
143
144
|
p.cancel("Operation cancelled.");
|
|
144
|
-
|
|
145
|
+
import_node_process.default.exit(0);
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
(0, import_node_fs.writeFileSync)(configPath, config, "utf-8");
|
|
@@ -157,7 +158,7 @@ async function main() {
|
|
|
157
158
|
});
|
|
158
159
|
if (p.isCancel(packageManager)) {
|
|
159
160
|
p.cancel("Operation cancelled.");
|
|
160
|
-
|
|
161
|
+
import_node_process.default.exit(0);
|
|
161
162
|
}
|
|
162
163
|
const deps = getDependencies(answers);
|
|
163
164
|
const installCommand = getInstallCommand(packageManager, deps);
|
|
@@ -259,5 +260,5 @@ function getInstallCommand(packageManager, deps) {
|
|
|
259
260
|
}
|
|
260
261
|
main().catch((error) => {
|
|
261
262
|
console.error(error);
|
|
262
|
-
|
|
263
|
+
import_node_process.default.exit(1);
|
|
263
264
|
});
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylistic.d.ts","sourceRoot":"","sources":["../../src/configs/stylistic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAIpC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAA;IAE7C;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IAEvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IAEb;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sBAAsB,CAAA;IAE3E;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAE5B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;;OAGG;IACH,aAAa,CAAC,EAAE,kBAAkB,GAAG,QAAQ,GAAG,OAAO,GAAG,gBAAgB,CAAA;CAC1E;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAWrC,CAAA;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,CA+GzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/configs/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAMhD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IAC1D;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAKD;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/configs/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAMhD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IAC1D;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB;AAKD;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAuJ1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unocss.d.ts","sourceRoot":"","sources":["../../src/configs/unocss.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"unocss.d.ts","sourceRoot":"","sources":["../../src/configs/unocss.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAOhD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB;AAgBD;;GAEG;AACH,wBAAsB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAwClF"}
|
package/dist/index.js
CHANGED
|
@@ -263,11 +263,34 @@ async function ensurePackages(packages) {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
// src/utils/index.ts
|
|
267
|
+
var import_node_process2 = __toESM(require("node:process"));
|
|
268
|
+
|
|
266
269
|
// src/utils/git.ts
|
|
267
270
|
var import_node_fs = require("node:fs");
|
|
271
|
+
var import_promises = require("node:fs/promises");
|
|
268
272
|
var import_node_path = __toESM(require("node:path"));
|
|
269
|
-
var
|
|
273
|
+
var import_node_process = __toESM(require("node:process"));
|
|
270
274
|
var { resolve } = import_node_path.default;
|
|
275
|
+
async function findUp(name, options) {
|
|
276
|
+
let directory = import_node_path.default.resolve(options?.cwd ?? import_node_process.default.cwd());
|
|
277
|
+
const { root } = import_node_path.default.parse(directory);
|
|
278
|
+
while (true) {
|
|
279
|
+
const filePath = import_node_path.default.join(directory, name);
|
|
280
|
+
try {
|
|
281
|
+
const stats = await (0, import_promises.stat)(filePath);
|
|
282
|
+
if (stats.isFile()) {
|
|
283
|
+
return filePath;
|
|
284
|
+
}
|
|
285
|
+
} catch {
|
|
286
|
+
}
|
|
287
|
+
if (directory === root) {
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
directory = import_node_path.default.dirname(directory);
|
|
291
|
+
}
|
|
292
|
+
return void 0;
|
|
293
|
+
}
|
|
271
294
|
function parseGitignore(content) {
|
|
272
295
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => {
|
|
273
296
|
if (line.startsWith("!")) {
|
|
@@ -282,8 +305,8 @@ function parseGitignore(content) {
|
|
|
282
305
|
return line;
|
|
283
306
|
});
|
|
284
307
|
}
|
|
285
|
-
async function findGitignore(cwd =
|
|
286
|
-
const gitignorePath = await
|
|
308
|
+
async function findGitignore(cwd = import_node_process.default.cwd()) {
|
|
309
|
+
const gitignorePath = await findUp(".gitignore", { cwd });
|
|
287
310
|
if (!gitignorePath) {
|
|
288
311
|
return [];
|
|
289
312
|
}
|
|
@@ -294,9 +317,9 @@ async function findGitignore(cwd = process.cwd()) {
|
|
|
294
317
|
return [];
|
|
295
318
|
}
|
|
296
319
|
}
|
|
297
|
-
async function getGitignorePatterns(cwd =
|
|
320
|
+
async function getGitignorePatterns(cwd = import_node_process.default.cwd()) {
|
|
298
321
|
const patterns = [];
|
|
299
|
-
const gitignorePath = await
|
|
322
|
+
const gitignorePath = await findUp(".gitignore", { cwd });
|
|
300
323
|
if (gitignorePath) {
|
|
301
324
|
try {
|
|
302
325
|
const content = (0, import_node_fs.readFileSync)(gitignorePath, "utf-8");
|
|
@@ -356,7 +379,7 @@ function filterNil(array) {
|
|
|
356
379
|
return array.filter((item) => item !== void 0 && item !== null);
|
|
357
380
|
}
|
|
358
381
|
function isInEditorEnv() {
|
|
359
|
-
return EDITOR_ENV_KEYS.some((key) =>
|
|
382
|
+
return EDITOR_ENV_KEYS.some((key) => import_node_process2.default.env[key]);
|
|
360
383
|
}
|
|
361
384
|
async function interopDefault(promise) {
|
|
362
385
|
const result = await promise;
|
|
@@ -1311,9 +1334,9 @@ function node() {
|
|
|
1311
1334
|
"n/no-sync": "off",
|
|
1312
1335
|
"n/no-unpublished-import": "off",
|
|
1313
1336
|
"n/no-unpublished-require": "off",
|
|
1314
|
-
"n/prefer-global/buffer": ["error", "
|
|
1337
|
+
"n/prefer-global/buffer": ["error", "never"],
|
|
1315
1338
|
"n/prefer-global/console": ["error", "always"],
|
|
1316
|
-
"n/prefer-global/process": ["error", "
|
|
1339
|
+
"n/prefer-global/process": ["error", "never"],
|
|
1317
1340
|
"n/prefer-global/text-decoder": ["error", "always"],
|
|
1318
1341
|
"n/prefer-global/text-encoder": ["error", "always"],
|
|
1319
1342
|
"n/prefer-global/url": ["error", "always"],
|
|
@@ -1881,7 +1904,6 @@ function stylistic(options = {}) {
|
|
|
1881
1904
|
semi
|
|
1882
1905
|
});
|
|
1883
1906
|
const indentStyle = indent === "tab" ? "tab" : indent;
|
|
1884
|
-
const indentSize = indent === "tab" ? 2 : indent;
|
|
1885
1907
|
return [
|
|
1886
1908
|
{
|
|
1887
1909
|
files: [GLOB_SRC],
|
|
@@ -1921,18 +1943,6 @@ function stylistic(options = {}) {
|
|
|
1921
1943
|
"@stylistic/jsx-tag-spacing": ["error", { beforeSelfClosing: "always" }],
|
|
1922
1944
|
"@stylistic/jsx-wrap-multilines": "off",
|
|
1923
1945
|
"@stylistic/linebreak-style": "off",
|
|
1924
|
-
"@stylistic/max-len": [
|
|
1925
|
-
"error",
|
|
1926
|
-
{
|
|
1927
|
-
code: 120,
|
|
1928
|
-
ignoreComments: false,
|
|
1929
|
-
ignoreRegExpLiterals: true,
|
|
1930
|
-
ignoreStrings: true,
|
|
1931
|
-
ignoreTemplateLiterals: true,
|
|
1932
|
-
ignoreUrls: true,
|
|
1933
|
-
tabWidth: typeof indentSize === "number" ? indentSize : 2
|
|
1934
|
-
}
|
|
1935
|
-
],
|
|
1936
1946
|
"@stylistic/member-delimiter-style": [
|
|
1937
1947
|
"error",
|
|
1938
1948
|
{
|
|
@@ -2220,6 +2230,11 @@ async function typescript(options = {}) {
|
|
|
2220
2230
|
// Use TypeScript's no-redeclare rule instead
|
|
2221
2231
|
"ts/no-redeclare": "error",
|
|
2222
2232
|
"ts/no-require-imports": "error",
|
|
2233
|
+
"ts/no-unused-expressions": ["error", {
|
|
2234
|
+
allowShortCircuit: true,
|
|
2235
|
+
allowTaggedTemplates: true,
|
|
2236
|
+
allowTernary: true
|
|
2237
|
+
}],
|
|
2223
2238
|
"ts/no-unused-vars": "off",
|
|
2224
2239
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
2225
2240
|
"ts/no-useless-constructor": "off",
|
|
@@ -2307,6 +2322,7 @@ function unicorn(options = {}) {
|
|
|
2307
2322
|
// src/configs/unocss.ts
|
|
2308
2323
|
var import_node_fs2 = require("node:fs");
|
|
2309
2324
|
var import_node_path2 = require("node:path");
|
|
2325
|
+
var import_node_process3 = __toESM(require("node:process"));
|
|
2310
2326
|
function hasUnoCSSConfig() {
|
|
2311
2327
|
const configFiles = [
|
|
2312
2328
|
"uno.config.ts",
|
|
@@ -2314,7 +2330,7 @@ function hasUnoCSSConfig() {
|
|
|
2314
2330
|
"unocss.config.ts",
|
|
2315
2331
|
"unocss.config.js"
|
|
2316
2332
|
];
|
|
2317
|
-
return configFiles.some((file) => (0, import_node_fs2.existsSync)((0, import_node_path2.resolve)(
|
|
2333
|
+
return configFiles.some((file) => (0, import_node_fs2.existsSync)((0, import_node_path2.resolve)(import_node_process3.default.cwd(), file)));
|
|
2318
2334
|
}
|
|
2319
2335
|
async function unocss(options = {}) {
|
|
2320
2336
|
const { overrides = {}, strict = false } = options;
|
package/dist/index.mjs
CHANGED
|
@@ -134,11 +134,34 @@ async function ensurePackages(packages) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// src/utils/index.ts
|
|
138
|
+
import process2 from "node:process";
|
|
139
|
+
|
|
137
140
|
// src/utils/git.ts
|
|
138
141
|
import { existsSync, readFileSync } from "node:fs";
|
|
142
|
+
import { stat } from "node:fs/promises";
|
|
139
143
|
import path from "node:path";
|
|
140
|
-
import
|
|
144
|
+
import process from "node:process";
|
|
141
145
|
var { resolve } = path;
|
|
146
|
+
async function findUp(name, options) {
|
|
147
|
+
let directory = path.resolve(options?.cwd ?? process.cwd());
|
|
148
|
+
const { root } = path.parse(directory);
|
|
149
|
+
while (true) {
|
|
150
|
+
const filePath = path.join(directory, name);
|
|
151
|
+
try {
|
|
152
|
+
const stats = await stat(filePath);
|
|
153
|
+
if (stats.isFile()) {
|
|
154
|
+
return filePath;
|
|
155
|
+
}
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
if (directory === root) {
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
directory = path.dirname(directory);
|
|
162
|
+
}
|
|
163
|
+
return void 0;
|
|
164
|
+
}
|
|
142
165
|
function parseGitignore(content) {
|
|
143
166
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => {
|
|
144
167
|
if (line.startsWith("!")) {
|
|
@@ -227,7 +250,7 @@ function filterNil(array) {
|
|
|
227
250
|
return array.filter((item) => item !== void 0 && item !== null);
|
|
228
251
|
}
|
|
229
252
|
function isInEditorEnv() {
|
|
230
|
-
return EDITOR_ENV_KEYS.some((key) =>
|
|
253
|
+
return EDITOR_ENV_KEYS.some((key) => process2.env[key]);
|
|
231
254
|
}
|
|
232
255
|
async function interopDefault(promise) {
|
|
233
256
|
const result = await promise;
|
|
@@ -1182,9 +1205,9 @@ function node() {
|
|
|
1182
1205
|
"n/no-sync": "off",
|
|
1183
1206
|
"n/no-unpublished-import": "off",
|
|
1184
1207
|
"n/no-unpublished-require": "off",
|
|
1185
|
-
"n/prefer-global/buffer": ["error", "
|
|
1208
|
+
"n/prefer-global/buffer": ["error", "never"],
|
|
1186
1209
|
"n/prefer-global/console": ["error", "always"],
|
|
1187
|
-
"n/prefer-global/process": ["error", "
|
|
1210
|
+
"n/prefer-global/process": ["error", "never"],
|
|
1188
1211
|
"n/prefer-global/text-decoder": ["error", "always"],
|
|
1189
1212
|
"n/prefer-global/text-encoder": ["error", "always"],
|
|
1190
1213
|
"n/prefer-global/url": ["error", "always"],
|
|
@@ -1752,7 +1775,6 @@ function stylistic(options = {}) {
|
|
|
1752
1775
|
semi
|
|
1753
1776
|
});
|
|
1754
1777
|
const indentStyle = indent === "tab" ? "tab" : indent;
|
|
1755
|
-
const indentSize = indent === "tab" ? 2 : indent;
|
|
1756
1778
|
return [
|
|
1757
1779
|
{
|
|
1758
1780
|
files: [GLOB_SRC],
|
|
@@ -1792,18 +1814,6 @@ function stylistic(options = {}) {
|
|
|
1792
1814
|
"@stylistic/jsx-tag-spacing": ["error", { beforeSelfClosing: "always" }],
|
|
1793
1815
|
"@stylistic/jsx-wrap-multilines": "off",
|
|
1794
1816
|
"@stylistic/linebreak-style": "off",
|
|
1795
|
-
"@stylistic/max-len": [
|
|
1796
|
-
"error",
|
|
1797
|
-
{
|
|
1798
|
-
code: 120,
|
|
1799
|
-
ignoreComments: false,
|
|
1800
|
-
ignoreRegExpLiterals: true,
|
|
1801
|
-
ignoreStrings: true,
|
|
1802
|
-
ignoreTemplateLiterals: true,
|
|
1803
|
-
ignoreUrls: true,
|
|
1804
|
-
tabWidth: typeof indentSize === "number" ? indentSize : 2
|
|
1805
|
-
}
|
|
1806
|
-
],
|
|
1807
1817
|
"@stylistic/member-delimiter-style": [
|
|
1808
1818
|
"error",
|
|
1809
1819
|
{
|
|
@@ -2091,6 +2101,11 @@ async function typescript(options = {}) {
|
|
|
2091
2101
|
// Use TypeScript's no-redeclare rule instead
|
|
2092
2102
|
"ts/no-redeclare": "error",
|
|
2093
2103
|
"ts/no-require-imports": "error",
|
|
2104
|
+
"ts/no-unused-expressions": ["error", {
|
|
2105
|
+
allowShortCircuit: true,
|
|
2106
|
+
allowTaggedTemplates: true,
|
|
2107
|
+
allowTernary: true
|
|
2108
|
+
}],
|
|
2094
2109
|
"ts/no-unused-vars": "off",
|
|
2095
2110
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
2096
2111
|
"ts/no-useless-constructor": "off",
|
|
@@ -2178,6 +2193,7 @@ function unicorn(options = {}) {
|
|
|
2178
2193
|
// src/configs/unocss.ts
|
|
2179
2194
|
import { existsSync as existsSync2 } from "node:fs";
|
|
2180
2195
|
import { resolve as resolve2 } from "node:path";
|
|
2196
|
+
import process3 from "node:process";
|
|
2181
2197
|
function hasUnoCSSConfig() {
|
|
2182
2198
|
const configFiles = [
|
|
2183
2199
|
"uno.config.ts",
|
|
@@ -2185,7 +2201,7 @@ function hasUnoCSSConfig() {
|
|
|
2185
2201
|
"unocss.config.ts",
|
|
2186
2202
|
"unocss.config.js"
|
|
2187
2203
|
];
|
|
2188
|
-
return configFiles.some((file) => existsSync2(resolve2(
|
|
2204
|
+
return configFiles.some((file) => existsSync2(resolve2(process3.cwd(), file)));
|
|
2189
2205
|
}
|
|
2190
2206
|
async function unocss(options = {}) {
|
|
2191
2207
|
const { overrides = {}, strict = false } = options;
|
package/dist/utils/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBxD;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAclF;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA8BzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAKpC,cAAc,OAAO,CAAA;AAGrB,cAAc,SAAS,CAAA;AAEvB;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAEpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACvC,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAYlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE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
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
2
|
+
"name": "@eslint-sets/eslint-config",
|
|
3
|
+
"description": "Modern ESLint config with flat config support for Vue, React, Svelte, TypeScript, Next.js, Nuxt, Astro, Angular, UnoCSS and more",
|
|
4
|
+
"version": "6.2.0-beta.0",
|
|
5
|
+
"packageManager": "pnpm@9.0.6",
|
|
6
|
+
"bin": {
|
|
7
|
+
"eslint-sets": "./dist/cli/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.mjs",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"import": "./dist/index.mjs"
|
|
17
|
+
},
|
|
18
|
+
"./cli": {
|
|
19
|
+
"types": "./dist/cli/index.d.ts",
|
|
20
|
+
"import": "./dist/cli/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"README.md",
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "jiti scripts/build.ts",
|
|
30
|
+
"dev": "jiti scripts/build.ts && tsc --watch",
|
|
31
|
+
"gen": "jiti scripts/typegen.ts",
|
|
32
|
+
"lint": "eslint .",
|
|
33
|
+
"lint:fix": "eslint . --fix",
|
|
34
|
+
"typecheck": "tsc --noEmit",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"test:watch": "vitest",
|
|
37
|
+
"test:coverage": "vitest run --coverage",
|
|
38
|
+
"inspector": "@eslint/config-inspector",
|
|
39
|
+
"prepublishOnly": "pnpm build",
|
|
40
|
+
"release": "bumpp && pnpm publish"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"registry": "https://registry.npmjs.org",
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@clack/prompts": "^0.10.0",
|
|
48
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
49
|
+
"@eslint/js": "^9.22.0",
|
|
50
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
52
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
53
|
+
"@vitest/eslint-plugin": "^1.6.12",
|
|
54
|
+
"eslint-config-prettier": "^10.1.1",
|
|
55
|
+
"eslint-plugin-import-x": "^4.9.0",
|
|
56
|
+
"eslint-plugin-jsdoc": "^61.7.1",
|
|
57
|
+
"eslint-plugin-jsonc": "^2.21.1",
|
|
58
|
+
"eslint-plugin-n": "^17.24.0",
|
|
59
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
60
|
+
"eslint-plugin-perfectionist": "^4.15.1",
|
|
61
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
62
|
+
"eslint-plugin-regexp": "^2.10.0",
|
|
63
|
+
"eslint-plugin-solid": "^0.14.5",
|
|
64
|
+
"eslint-plugin-toml": "^1.3.1",
|
|
65
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
|
66
|
+
"eslint-plugin-unused-imports": "^4.1.0",
|
|
67
|
+
"eslint-plugin-vue": "^9.33.0",
|
|
68
|
+
"eslint-plugin-yml": "^1.19.1",
|
|
69
|
+
"globals": "^17.4.0",
|
|
70
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
71
|
+
"local-pkg": "^1.0.0",
|
|
72
|
+
"toml-eslint-parser": "^1.0.3",
|
|
73
|
+
"vue-eslint-parser": "^10.4.0",
|
|
74
|
+
"yaml-eslint-parser": "^1.3.2"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@types/node": "^22.13.10",
|
|
78
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
79
|
+
"bumpp": "^10.1.0",
|
|
80
|
+
"esbuild": "^0.27.4",
|
|
81
|
+
"eslint": "^9.22.0",
|
|
82
|
+
"eslint-typegen": "^2.3.1",
|
|
83
|
+
"jiti": "^2.6.1",
|
|
84
|
+
"prettier": "^3.5.3",
|
|
85
|
+
"typescript": "~5.9.3",
|
|
86
|
+
"vitest": "^4.1.0"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"eslint": "^9.10.0 || ^9.22.0",
|
|
90
|
+
"prettier": "^3.5.3",
|
|
91
|
+
"typescript": ">=5.0.0"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"prettier": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"typescript": {
|
|
98
|
+
"optional": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"optionalDependencies": {
|
|
102
|
+
"@angular-eslint/eslint-plugin": "^21.3.0",
|
|
103
|
+
"@angular-eslint/eslint-plugin-template": "^21.3.0",
|
|
104
|
+
"@angular-eslint/template-parser": "^21.3.0",
|
|
105
|
+
"@e18e/eslint-plugin": "^0.2.0",
|
|
106
|
+
"@eslint-react/eslint-plugin": "^1.40.0",
|
|
107
|
+
"@eslint/markdown": "^6.6.0",
|
|
108
|
+
"@next/eslint-plugin-next": ">=15.0.0",
|
|
109
|
+
"@unocss/eslint-plugin": ">=0.60.0",
|
|
110
|
+
"astro-eslint-parser": "^1.0.2",
|
|
111
|
+
"eslint-plugin-astro": "^1.2.0",
|
|
112
|
+
"eslint-plugin-format": "^0.1.3",
|
|
113
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
114
|
+
"eslint-plugin-pnpm": "^1.1.0",
|
|
115
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
116
|
+
"eslint-plugin-svelte": "^2.46.1",
|
|
117
|
+
"eslint-plugin-vuejs-accessibility": "^2.4.0",
|
|
118
|
+
"svelte": "^5.25.0",
|
|
119
|
+
"svelte-eslint-parser": "^1.0.0"
|
|
120
|
+
},
|
|
121
|
+
"engines": {
|
|
122
|
+
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
123
|
+
},
|
|
124
|
+
"keywords": [
|
|
125
|
+
"eslint",
|
|
126
|
+
"eslint-config",
|
|
127
|
+
"eslint-flat-config",
|
|
128
|
+
"vue",
|
|
129
|
+
"react",
|
|
130
|
+
"svelte",
|
|
131
|
+
"typescript",
|
|
132
|
+
"nextjs",
|
|
133
|
+
"nuxt",
|
|
134
|
+
"astro",
|
|
135
|
+
"angular",
|
|
136
|
+
"solid",
|
|
137
|
+
"unocss",
|
|
138
|
+
"accessibility",
|
|
139
|
+
"a11y",
|
|
140
|
+
"cli"
|
|
141
|
+
],
|
|
142
|
+
"license": "MIT",
|
|
143
|
+
"author": "saqqdy <https://github.com/saqqdy>",
|
|
144
|
+
"homepage": "https://github.com/saqqdy/eslint-sets#readme",
|
|
145
|
+
"bugs": {
|
|
146
|
+
"url": "https://github.com/saqqdy/eslint-sets/issues"
|
|
147
|
+
},
|
|
148
|
+
"repository": {
|
|
149
|
+
"type": "git",
|
|
150
|
+
"url": "git+https://github.com/saqqdy/eslint-sets.git"
|
|
151
|
+
}
|
|
152
|
+
}
|