@biscuittin/eslint-config 0.0.6 → 0.1.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/dist/index.d.ts +14518 -245
- package/dist/index.js +1433 -1592
- package/package.json +45 -45
- package/typegen.d.ts +4373 -901
- package/.jiek-production-tag +0 -0
- package/dist/index.cjs +0 -1800
- package/dist/index.d.cts +0 -350
package/dist/index.js
CHANGED
|
@@ -1,243 +1,235 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import * as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
31
|
-
import
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
35
|
-
import { isPackageExists } from 'local-pkg';
|
|
1
|
+
import eslintPluginESLintComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { findUp } from "find-up";
|
|
6
|
+
import fsp from "node:fs/promises";
|
|
7
|
+
import eslintPluginFormat from "eslint-plugin-format";
|
|
8
|
+
import * as parserJsonc from "jsonc-eslint-parser";
|
|
9
|
+
import { configs, parser, plugin } from "typescript-eslint";
|
|
10
|
+
import gitignore from "eslint-config-flat-gitignore";
|
|
11
|
+
import eslintPluginAntfu from "eslint-plugin-antfu";
|
|
12
|
+
import eslintPluginImportX, { configs as configs$1, createNodeResolver } from "eslint-plugin-import-x";
|
|
13
|
+
import eslintPluginPerfectionist from "eslint-plugin-perfectionist";
|
|
14
|
+
import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
|
|
15
|
+
import js from "@eslint/js";
|
|
16
|
+
import eslintPluginAutofix from "eslint-plugin-autofix";
|
|
17
|
+
import globals, { default as globals$1 } from "globals";
|
|
18
|
+
import eslintPluginJson from "@eslint/json";
|
|
19
|
+
import eslintPluginJsonc from "eslint-plugin-jsonc";
|
|
20
|
+
import eslintPluginNextJs from "@next/eslint-plugin-next";
|
|
21
|
+
import eslintPluginReactRefresh from "eslint-plugin-react-refresh";
|
|
22
|
+
import eslintPluginNode from "eslint-plugin-n";
|
|
23
|
+
import eslintPluginReact from "@eslint-react/eslint-plugin";
|
|
24
|
+
import { eslint_plugin_jsx_a11y_minimal } from "@eslint-sukka/eslint-plugin-react-jsx-a11y";
|
|
25
|
+
import eslintPluginStylistic from "@stylistic/eslint-plugin";
|
|
26
|
+
import * as eslintPluginReactCompiler from "eslint-plugin-react-compiler";
|
|
27
|
+
import * as eslintPluginReactHooks from "eslint-plugin-react-hooks";
|
|
28
|
+
import * as eslintPluginRegexp from "eslint-plugin-regexp";
|
|
29
|
+
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
30
|
+
import { createTypeScriptImportResolver, defaultExtensions } from "eslint-import-resolver-typescript";
|
|
31
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
32
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
33
|
+
import { isPackageExists } from "local-pkg";
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
//#region src/utils/combine.ts
|
|
36
|
+
/**
|
|
37
|
+
* Combine array and non-array configs into a single array.
|
|
38
|
+
* Copied from antfu/eslint-config
|
|
39
|
+
* Ref: https://github.com/antfu/eslint-config/blob/e283983d8cb72304424f67090a3e3bdccdf95c0d/src/utils.ts#L32
|
|
40
|
+
*/
|
|
41
|
+
async function combine(...configs$2) {
|
|
42
|
+
const resolved = await Promise.all(configs$2);
|
|
43
|
+
return resolved.flat();
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/utils/get-flat-config-name.ts
|
|
42
48
|
function getFlatConfigName(module) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
return {
|
|
50
|
+
base: `@biscuittin/eslint-config/${module}`,
|
|
51
|
+
setup: `@biscuittin/eslint-config/${module}/setup`,
|
|
52
|
+
rules: `@biscuittin/eslint-config/${module}/rules`,
|
|
53
|
+
stylistic: `@biscuittin/eslint-config/${module}/stylistic`,
|
|
54
|
+
commonjs: `@biscuittin/eslint-config/${module}/commonjs`,
|
|
55
|
+
module: `@biscuittin/eslint-config/${module}/module`,
|
|
56
|
+
script: `@biscuittin/eslint-config/${module}/script`
|
|
57
|
+
};
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/utils/get-package-json.ts
|
|
57
62
|
const SKIP_TIME = 2e4;
|
|
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
|
-
}
|
|
63
|
+
/**
|
|
64
|
+
* The class of cache.
|
|
65
|
+
* The cache will dispose of each value if the value has not been accessed
|
|
66
|
+
* during 20 seconds.
|
|
67
|
+
*/
|
|
68
|
+
var Cache = class {
|
|
69
|
+
/**
|
|
70
|
+
* Initialize this cache instance.
|
|
71
|
+
*/
|
|
72
|
+
map = /* @__PURE__ */ new Map();
|
|
73
|
+
/**
|
|
74
|
+
* Get the cached value of the given key.
|
|
75
|
+
*/
|
|
76
|
+
get(key) {
|
|
77
|
+
const entry = this.map.get(key);
|
|
78
|
+
const now = Date.now();
|
|
79
|
+
if (!entry) return null;
|
|
80
|
+
if (entry.expire > now) {
|
|
81
|
+
entry.expire = now + SKIP_TIME;
|
|
82
|
+
return entry.value;
|
|
83
|
+
}
|
|
84
|
+
this.map.delete(key);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Set the value of the given key.
|
|
89
|
+
*/
|
|
90
|
+
set(key, value) {
|
|
91
|
+
const entry = this.map.get(key);
|
|
92
|
+
const expire = Date.now() + SKIP_TIME;
|
|
93
|
+
if (!entry) {
|
|
94
|
+
this.map.set(key, {
|
|
95
|
+
value,
|
|
96
|
+
expire
|
|
97
|
+
});
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
entry.value = value;
|
|
101
|
+
entry.expire = expire;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
93
104
|
const cache = new Cache();
|
|
105
|
+
/**
|
|
106
|
+
* Reads the `package.json` data in a given path.
|
|
107
|
+
*
|
|
108
|
+
* Don't cache the data.
|
|
109
|
+
*
|
|
110
|
+
* @param directory - The path to a directory to read.
|
|
111
|
+
* @returns The read `package.json` data, or null.
|
|
112
|
+
*/
|
|
94
113
|
function readPackageJson(directory) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return null;
|
|
114
|
+
const filePath = path.join(directory, "package.json");
|
|
115
|
+
try {
|
|
116
|
+
const text = fs.readFileSync(filePath, "utf8");
|
|
117
|
+
const data = JSON.parse(text);
|
|
118
|
+
if (data && typeof data === "object") {
|
|
119
|
+
data["filePath"] = filePath;
|
|
120
|
+
return data;
|
|
121
|
+
}
|
|
122
|
+
} catch {}
|
|
123
|
+
return null;
|
|
106
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Gets a `package.json` data.
|
|
127
|
+
* The data is cached if found, then it's used after.
|
|
128
|
+
*
|
|
129
|
+
* @param startPath - A file path to lookup.
|
|
130
|
+
* @returns A found `package.json` data or `null`.
|
|
131
|
+
* This object have additional property `filePath`.
|
|
132
|
+
*/
|
|
107
133
|
function getPackageJson(startPath = "a.js") {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
cache.set(startDirectory, null);
|
|
130
|
-
return null;
|
|
134
|
+
const startDirectory = path.dirname(path.resolve(startPath));
|
|
135
|
+
let directory = startDirectory;
|
|
136
|
+
let previousDirectory = "";
|
|
137
|
+
let data = null;
|
|
138
|
+
do {
|
|
139
|
+
data = cache.get(directory);
|
|
140
|
+
if (data) {
|
|
141
|
+
if (directory !== startDirectory) cache.set(startDirectory, data);
|
|
142
|
+
return data;
|
|
143
|
+
}
|
|
144
|
+
data = readPackageJson(directory);
|
|
145
|
+
if (data) {
|
|
146
|
+
cache.set(directory, data);
|
|
147
|
+
cache.set(startDirectory, data);
|
|
148
|
+
return data;
|
|
149
|
+
}
|
|
150
|
+
previousDirectory = directory;
|
|
151
|
+
directory = path.resolve(directory, "..");
|
|
152
|
+
} while (directory !== previousDirectory);
|
|
153
|
+
cache.set(startDirectory, null);
|
|
154
|
+
return null;
|
|
131
155
|
}
|
|
132
156
|
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/utils/is-in-git-hooks.ts
|
|
133
159
|
function isInGitHooksOrLintStaged() {
|
|
134
|
-
|
|
160
|
+
return !!((process.env["GIT_PARAMS"] ?? "") || (process.env["VSCODE_GIT_COMMAND"] ?? "") || process.env["npm_lifecycle_script"]?.startsWith("lint-staged"));
|
|
135
161
|
}
|
|
136
162
|
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/utils/is-in-editor.ts
|
|
137
165
|
function isInEditorEnv() {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
166
|
+
if (process.env["CI"] ?? "") return false;
|
|
167
|
+
if (isInGitHooksOrLintStaged()) return false;
|
|
168
|
+
return !!((process.env["VSCODE_PID"] ?? "") || (process.env["VSCODE_CWD"] ?? "") || (process.env["JETBRAINS_IDE"] ?? "") || (process.env["VIM"] ?? "") || (process.env["NVIM"] ?? ""));
|
|
141
169
|
}
|
|
142
170
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/utils/load-local-file.ts
|
|
173
|
+
async function loadLocalFile(name$15, cwd = process.cwd()) {
|
|
174
|
+
const path$1 = await findUp(name$15, { cwd });
|
|
175
|
+
if (!path$1 || !fs.existsSync(path$1)) return null;
|
|
176
|
+
return JSON.parse(await fsp.readFile(path$1, "utf8"));
|
|
147
177
|
}
|
|
148
178
|
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/utils/memoize-eslint-plugin.ts
|
|
181
|
+
/**
|
|
182
|
+
* Every package manager has this flaw: Even if a pinned, same version of transitive dependency
|
|
183
|
+
* is depended on by multiple packages, all npm/pnpm/yarn/bun will not dedupe it, some package
|
|
184
|
+
* manager even doesn't have dedupe feature (yes, bun. You are literally wasting my disk space
|
|
185
|
+
* for speed).
|
|
186
|
+
*
|
|
187
|
+
* But if there are multiple copy of the same version of transitive dependency, they will not have
|
|
188
|
+
* the same referential identity, which causes ESLint to panic and throw error.
|
|
189
|
+
*
|
|
190
|
+
* So we have to memoize the plugins and configs to make sure they are the same referential identity.
|
|
191
|
+
*
|
|
192
|
+
* Copied from SukkaW/eslint-config-sukka
|
|
193
|
+
* Ref: https://github.com/SukkaW/eslint-config-sukka/blob/bbca2d568d738a1d287c473804ea8ccbf00d3c86/packages/shared/src/memoize-eslint-plugin.ts#L17
|
|
194
|
+
*/
|
|
149
195
|
function memo(function_, key) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return globalThis.__ESLINT_PLUGIN_MEMO__[_key];
|
|
196
|
+
let _key = key;
|
|
197
|
+
if (_key === void 0 || !_key) {
|
|
198
|
+
if (typeof function_.toString !== "function") throw new TypeError("memo() requires a key!");
|
|
199
|
+
_key = function_.toString();
|
|
200
|
+
}
|
|
201
|
+
globalThis.__ESLINT_PLUGIN_MEMO__ ??= {};
|
|
202
|
+
globalThis.__ESLINT_PLUGIN_MEMO__[_key] ??= function_;
|
|
203
|
+
return globalThis.__ESLINT_PLUGIN_MEMO__[_key];
|
|
159
204
|
}
|
|
160
205
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
pluginESLintComments: memo(
|
|
166
|
-
pluginESLintComments,
|
|
167
|
-
"eslint-plugin-eslint-comments"
|
|
168
|
-
),
|
|
169
|
-
pluginFormat: memo(pluginFormat, "eslint-plugin-format"),
|
|
170
|
-
pluginImportX: memo(pluginImportX, "eslint-plugin-import-x"),
|
|
171
|
-
pluginJson: memo(pluginJson, "eslint-plugin-json"),
|
|
172
|
-
pluginJsonc: memo(pluginJsonc, "eslint-plugin-jsonc"),
|
|
173
|
-
pluginJsxA11y: memo(eslint_plugin_jsx_a11y_minimal, "eslint-plugin-react-jsx-a11y"),
|
|
174
|
-
pluginNextJs: memo(pluginNextJs, "eslint-plugin-next"),
|
|
175
|
-
pluginNode: memo(pluginNode, "eslint-plugin-n"),
|
|
176
|
-
pluginPerfectionist: memo(pluginPerfectionist, "eslint-plugin-perfectionist"),
|
|
177
|
-
pluginReact: memo(
|
|
178
|
-
reactPlugins["@eslint-react"],
|
|
179
|
-
"eslint-plugin-react-x"
|
|
180
|
-
),
|
|
181
|
-
pluginReactCompiler: memo(
|
|
182
|
-
pluginReactCompiler,
|
|
183
|
-
"eslint-plugin-react-compiler"
|
|
184
|
-
),
|
|
185
|
-
pluginReactDebug: memo(
|
|
186
|
-
reactPlugins["@eslint-react/debug"],
|
|
187
|
-
"eslint-plugin-react-debug"
|
|
188
|
-
),
|
|
189
|
-
pluginReactDom: memo(
|
|
190
|
-
reactPlugins["@eslint-react/dom"],
|
|
191
|
-
"eslint-plugin-react-dom"
|
|
192
|
-
),
|
|
193
|
-
pluginReactHooks: memo(pluginReactHooks, "eslint-plugin-react-hooks"),
|
|
194
|
-
pluginReactHooksExtra: memo(
|
|
195
|
-
reactPlugins["@eslint-react/hooks-extra"],
|
|
196
|
-
"eslint-plugin-react-hooks-extra"
|
|
197
|
-
),
|
|
198
|
-
pluginReactHooksNamingConvention: memo(
|
|
199
|
-
reactPlugins["@eslint-react/naming-convention"],
|
|
200
|
-
"eslint-plugin-react-naming-convention"
|
|
201
|
-
),
|
|
202
|
-
pluginReactRefresh: memo(pluginReactRefresh, "eslint-plugin-react-refresh"),
|
|
203
|
-
pluginReactWebApi: memo(
|
|
204
|
-
reactPlugins["@eslint-react/web-api"],
|
|
205
|
-
"eslint-plugin-react-web-api"
|
|
206
|
-
),
|
|
207
|
-
pluginRegexp: memo(pluginRegexp, "eslint-plugin-regexp"),
|
|
208
|
-
pluginStylisticJsx: memo(pluginStylisticJsx, "eslint-plugin-jsx"),
|
|
209
|
-
pluginTailwindCSS: memo(pluginTailwindCSS, "eslint-plugin-tailwindcss"),
|
|
210
|
-
pluginTypescript: memo(plugin, "typescript-eslint"),
|
|
211
|
-
pluginUnicorn: memo(pluginUnicorn, "eslint-plugin-unicorn"),
|
|
212
|
-
pluginUnusedImports: memo(pluginUnusedImports, "eslint-plugin-unused-imports")
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
const name$e = getFlatConfigName("eslint-comments");
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/configs/comments.ts
|
|
208
|
+
const pluginESLintComments = memo(eslintPluginESLintComments, "eslint-plugin-eslint-comments");
|
|
209
|
+
const name$14 = getFlatConfigName("eslint-comments");
|
|
216
210
|
function comments() {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
|
|
232
|
-
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
|
233
|
-
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
|
234
|
-
"@eslint-community/eslint-comments/no-unused-enable": "error",
|
|
235
|
-
"@eslint-community/eslint-comments/require-description": "error"
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
];
|
|
211
|
+
return [{
|
|
212
|
+
name: name$14.setup,
|
|
213
|
+
plugins: { "@eslint-community/eslint-comments": pluginESLintComments }
|
|
214
|
+
}, {
|
|
215
|
+
name: name$14.rules,
|
|
216
|
+
rules: {
|
|
217
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
218
|
+
"@eslint-community/eslint-comments/no-aggregating-enable": "error",
|
|
219
|
+
"@eslint-community/eslint-comments/no-duplicate-disable": "error",
|
|
220
|
+
"@eslint-community/eslint-comments/no-unlimited-disable": "error",
|
|
221
|
+
"@eslint-community/eslint-comments/no-unused-enable": "error",
|
|
222
|
+
"@eslint-community/eslint-comments/require-description": "error"
|
|
223
|
+
}
|
|
224
|
+
}];
|
|
239
225
|
}
|
|
240
226
|
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/globs.ts
|
|
229
|
+
/**
|
|
230
|
+
* Copied from antfu/eslint-config
|
|
231
|
+
* Ref: https://github.com/antfu/eslint-config/blob/12718a47803bcd3fa1faf3f424430ecf1a9ddda9/src/globs.ts
|
|
232
|
+
*/
|
|
241
233
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
242
234
|
const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
243
235
|
const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -258,1466 +250,1315 @@ const GLOB_XML = "**/*.xml";
|
|
|
258
250
|
const GLOB_HTML = "**/*.htm?(l)";
|
|
259
251
|
const GLOB_SVG = "**/*.svg";
|
|
260
252
|
const GLOB_ASTRO = "**/*.astro";
|
|
253
|
+
const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
254
|
+
const GLOB_TESTS = [
|
|
255
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
256
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
257
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
258
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
259
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
260
|
+
];
|
|
261
261
|
const GLOB_ALL_SRC = [
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
262
|
+
GLOB_SRC,
|
|
263
|
+
GLOB_STYLE,
|
|
264
|
+
GLOB_POSTCSS,
|
|
265
|
+
GLOB_JSON,
|
|
266
|
+
GLOB_JSON5,
|
|
267
|
+
GLOB_JSONC,
|
|
268
|
+
GLOB_MARKDOWN,
|
|
269
|
+
GLOB_SVELTE,
|
|
270
|
+
GLOB_VUE,
|
|
271
|
+
GLOB_YAML,
|
|
272
|
+
GLOB_TOML,
|
|
273
|
+
GLOB_XML,
|
|
274
|
+
GLOB_HTML,
|
|
275
|
+
GLOB_SVG,
|
|
276
|
+
GLOB_ASTRO
|
|
277
277
|
];
|
|
278
278
|
const GLOB_EXCLUDE = [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
279
|
+
"**/node_modules",
|
|
280
|
+
"**/dist",
|
|
281
|
+
"**/package-lock.json",
|
|
282
|
+
"**/yarn.lock",
|
|
283
|
+
"**/pnpm-lock.yaml",
|
|
284
|
+
"**/bun.lockb",
|
|
285
|
+
"**/output",
|
|
286
|
+
"**/coverage",
|
|
287
|
+
"**/temp",
|
|
288
|
+
"**/.temp",
|
|
289
|
+
"**/tmp",
|
|
290
|
+
"**/.tmp",
|
|
291
|
+
"**/.history",
|
|
292
|
+
"**/.vitepress/cache",
|
|
293
|
+
"**/.nuxt",
|
|
294
|
+
"**/.next",
|
|
295
|
+
"**/.svelte-kit",
|
|
296
|
+
"**/.vercel",
|
|
297
|
+
"**/.changeset",
|
|
298
|
+
"**/.idea",
|
|
299
|
+
"**/.cache",
|
|
300
|
+
"**/.output",
|
|
301
|
+
"**/.vite-inspect",
|
|
302
|
+
"**/.yarn",
|
|
303
|
+
"**/vite.config.*.timestamp-*",
|
|
304
|
+
"**/CHANGELOG*.md",
|
|
305
|
+
"**/*.min.*",
|
|
306
|
+
"**/LICENSE*",
|
|
307
|
+
"**/__snapshots__",
|
|
308
|
+
"**/auto-import?(s).d.ts",
|
|
309
|
+
"**/components.d.ts"
|
|
310
310
|
];
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/configs/disables.ts
|
|
314
|
+
const name$13 = getFlatConfigName("disables");
|
|
313
315
|
function disables() {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
];
|
|
316
|
+
return [
|
|
317
|
+
{
|
|
318
|
+
name: name$13.script,
|
|
319
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
320
|
+
rules: {
|
|
321
|
+
"antfu/no-top-level-await": "off",
|
|
322
|
+
"no-console": "off",
|
|
323
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: `${name$13.base}/cli`,
|
|
328
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
329
|
+
rules: {
|
|
330
|
+
"antfu/no-top-level-await": "off",
|
|
331
|
+
"no-console": "off"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: `${name$13.base}/bin`,
|
|
336
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
337
|
+
rules: {
|
|
338
|
+
"antfu/no-import-dist": "off",
|
|
339
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: `${name$13.base}/dts`,
|
|
344
|
+
files: ["**/*.d.?([cm])ts"],
|
|
345
|
+
rules: {
|
|
346
|
+
"@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
347
|
+
"@eslint-community/eslint-comments/no-unlimited-disable": "off",
|
|
348
|
+
"import-x/no-duplicates": "off",
|
|
349
|
+
"no-restricted-syntax": "off",
|
|
350
|
+
"unused-imports/no-unused-vars": "off"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: name$13.commonjs,
|
|
355
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
356
|
+
rules: { "@typescript-eslint/no-require-imports": "off" }
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: `${name$13.base}/config-files`,
|
|
360
|
+
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
361
|
+
rules: {
|
|
362
|
+
"antfu/no-top-level-await": "off",
|
|
363
|
+
"no-console": "off",
|
|
364
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
];
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/parsers.ts
|
|
370
372
|
const parsers = {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
parserJsonc,
|
|
374
|
+
parserPlain: eslintPluginFormat.parserPlain,
|
|
375
|
+
parserTypescript: parser
|
|
374
376
|
};
|
|
377
|
+
var parsers_default = parsers;
|
|
375
378
|
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/configs/formatters.ts
|
|
376
381
|
const quoteStyleMap = {
|
|
377
|
-
|
|
378
|
-
|
|
382
|
+
single: "preferSingle",
|
|
383
|
+
double: "preferDouble"
|
|
379
384
|
};
|
|
380
385
|
const trailingCommasMap = {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
386
|
+
none: "never",
|
|
387
|
+
all: "always",
|
|
388
|
+
multiline: "onlyMultiLine"
|
|
384
389
|
};
|
|
385
|
-
const
|
|
390
|
+
const pluginFormat = memo(eslintPluginFormat, "eslint-plugin-format");
|
|
391
|
+
const name$12 = getFlatConfigName("formatters");
|
|
386
392
|
async function formatters(options = {}) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: `${name$c.rules}/yaml`,
|
|
512
|
-
files: [GLOB_YAML],
|
|
513
|
-
languageOptions: {
|
|
514
|
-
parser: parsers["parserPlain"]
|
|
515
|
-
},
|
|
516
|
-
rules: hasPlugin("yaml") ? {
|
|
517
|
-
"format/dprint": ["error", {
|
|
518
|
-
language: getPluginUrl("yaml"),
|
|
519
|
-
languageOptions: {
|
|
520
|
-
printWidth,
|
|
521
|
-
indentWidth,
|
|
522
|
-
lineBreak,
|
|
523
|
-
quotes: quoteStyleMap[quotes],
|
|
524
|
-
trailingComma: trailingComma === "none" ? false : true,
|
|
525
|
-
...dprintConfig?.yaml
|
|
526
|
-
}
|
|
527
|
-
}]
|
|
528
|
-
} : {}
|
|
529
|
-
}
|
|
530
|
-
];
|
|
393
|
+
const { dprintConfigPath = "dprint.json", printWidth = 120, indentWidth = 2, useTabs = false, semi = false, quotes = "single", jsxQuotes = "double", trailingComma = "multiline", endOfLine = "lf", extraJsonFiles = [] } = options;
|
|
394
|
+
const dprintConfig = await loadLocalFile(dprintConfigPath);
|
|
395
|
+
function hasPlugin(name$15) {
|
|
396
|
+
return dprintConfig?.plugins.some((url) => url.includes(name$15)) ?? false;
|
|
397
|
+
}
|
|
398
|
+
function getPluginUrl(name$15) {
|
|
399
|
+
return dprintConfig?.plugins.find((url) => url.includes(name$15)) ?? name$15;
|
|
400
|
+
}
|
|
401
|
+
const lineWidth = printWidth;
|
|
402
|
+
const newLineKind = endOfLine;
|
|
403
|
+
const lineBreak = newLineKind === "lf" ? "lf" : "crlf";
|
|
404
|
+
return [
|
|
405
|
+
{
|
|
406
|
+
name: name$12.setup,
|
|
407
|
+
plugins: { format: pluginFormat }
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: `${name$12.rules}/typescript`,
|
|
411
|
+
files: [GLOB_SRC],
|
|
412
|
+
rules: hasPlugin("typescript") ? { "format/dprint": ["error", {
|
|
413
|
+
language: getPluginUrl("typescript"),
|
|
414
|
+
languageOptions: {
|
|
415
|
+
lineWidth,
|
|
416
|
+
indentWidth,
|
|
417
|
+
useTabs,
|
|
418
|
+
newLineKind,
|
|
419
|
+
semiColons: semi ? "always" : "asi",
|
|
420
|
+
quoteStyle: quoteStyleMap[quotes],
|
|
421
|
+
"jsx.quoteStyle": quoteStyleMap[jsxQuotes],
|
|
422
|
+
trailingCommas: trailingCommasMap[trailingComma],
|
|
423
|
+
...dprintConfig?.typescript
|
|
424
|
+
}
|
|
425
|
+
}] } : {}
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: `${name$12.rules}/json`,
|
|
429
|
+
files: [
|
|
430
|
+
GLOB_JSON,
|
|
431
|
+
GLOB_JSON5,
|
|
432
|
+
GLOB_JSONC,
|
|
433
|
+
...extraJsonFiles
|
|
434
|
+
],
|
|
435
|
+
rules: hasPlugin("json") ? {
|
|
436
|
+
"jsonc/indent": "off",
|
|
437
|
+
"format/dprint": ["error", {
|
|
438
|
+
language: getPluginUrl("json"),
|
|
439
|
+
languageOptions: {
|
|
440
|
+
lineWidth,
|
|
441
|
+
indentWidth,
|
|
442
|
+
useTabs,
|
|
443
|
+
newLineKind,
|
|
444
|
+
...dprintConfig?.json
|
|
445
|
+
}
|
|
446
|
+
}]
|
|
447
|
+
} : {}
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
name: `${name$12.rules}/markdown`,
|
|
451
|
+
files: [GLOB_MARKDOWN],
|
|
452
|
+
languageOptions: { parser: parsers_default["parserPlain"] },
|
|
453
|
+
rules: hasPlugin("markdown") ? { "format/dprint": ["error", {
|
|
454
|
+
language: getPluginUrl("markdown"),
|
|
455
|
+
languageOptions: {
|
|
456
|
+
lineWidth,
|
|
457
|
+
newLineKind,
|
|
458
|
+
...dprintConfig?.markdown
|
|
459
|
+
}
|
|
460
|
+
}] } : {}
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
name: `${name$12.rules}/malva`,
|
|
464
|
+
files: [GLOB_STYLE, GLOB_POSTCSS],
|
|
465
|
+
languageOptions: { parser: parsers_default["parserPlain"] },
|
|
466
|
+
rules: hasPlugin("malva") ? { "format/dprint": ["error", {
|
|
467
|
+
language: getPluginUrl("malva"),
|
|
468
|
+
languageOptions: {
|
|
469
|
+
printWidth,
|
|
470
|
+
useTabs,
|
|
471
|
+
indentWidth,
|
|
472
|
+
lineBreak,
|
|
473
|
+
trailingComma: trailingComma === "all" ? true : false,
|
|
474
|
+
...dprintConfig?.malva
|
|
475
|
+
}
|
|
476
|
+
}] } : {}
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: `${name$12.rules}/markup`,
|
|
480
|
+
files: [
|
|
481
|
+
GLOB_HTML,
|
|
482
|
+
GLOB_VUE,
|
|
483
|
+
GLOB_SVELTE,
|
|
484
|
+
GLOB_ASTRO
|
|
485
|
+
],
|
|
486
|
+
languageOptions: { parser: parsers_default["parserPlain"] },
|
|
487
|
+
rules: hasPlugin("markup") ? { "format/dprint": ["error", {
|
|
488
|
+
language: getPluginUrl("markup"),
|
|
489
|
+
languageOptions: {
|
|
490
|
+
printWidth,
|
|
491
|
+
useTabs,
|
|
492
|
+
indentWidth,
|
|
493
|
+
lineBreak,
|
|
494
|
+
...dprintConfig?.markup
|
|
495
|
+
}
|
|
496
|
+
}] } : {}
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
name: `${name$12.rules}/yaml`,
|
|
500
|
+
files: [GLOB_YAML],
|
|
501
|
+
languageOptions: { parser: parsers_default["parserPlain"] },
|
|
502
|
+
rules: hasPlugin("yaml") ? { "format/dprint": ["error", {
|
|
503
|
+
language: getPluginUrl("yaml"),
|
|
504
|
+
languageOptions: {
|
|
505
|
+
printWidth,
|
|
506
|
+
indentWidth,
|
|
507
|
+
lineBreak,
|
|
508
|
+
quotes: quoteStyleMap[quotes],
|
|
509
|
+
trailingComma: trailingComma === "none" ? false : true,
|
|
510
|
+
...dprintConfig?.yaml
|
|
511
|
+
}
|
|
512
|
+
}] } : {}
|
|
513
|
+
}
|
|
514
|
+
];
|
|
531
515
|
}
|
|
532
516
|
|
|
533
|
-
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/configs/ignores.ts
|
|
519
|
+
const name$11 = getFlatConfigName("ignores");
|
|
534
520
|
function ignores(userIgnores = []) {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
},
|
|
540
|
-
gitignore({ name: `${name$b.base}/gitignore` })
|
|
541
|
-
];
|
|
521
|
+
return [{
|
|
522
|
+
name: `${name$11.base}/files`,
|
|
523
|
+
ignores: [...GLOB_EXCLUDE, ...userIgnores]
|
|
524
|
+
}, gitignore({ name: `${name$11.base}/gitignore` })];
|
|
542
525
|
}
|
|
543
526
|
|
|
544
|
-
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region src/configs/imports.ts
|
|
529
|
+
const pluginAntfu$2 = memo(eslintPluginAntfu, "eslint-plugin-antfu");
|
|
530
|
+
const pluginImportX$2 = memo(eslintPluginImportX, "eslint-plugin-import-x");
|
|
531
|
+
const pluginPerfectionist = memo(eslintPluginPerfectionist, "eslint-plugin-perfectionist");
|
|
532
|
+
const pluginUnusedImports$1 = memo(eslintPluginUnusedImports, "eslint-plugin-unused-imports");
|
|
533
|
+
const name$10 = getFlatConfigName("imports");
|
|
545
534
|
const files$6 = [GLOB_SRC];
|
|
546
535
|
function imports(options = {}) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
536
|
+
const { tsconfigRootDir = process.cwd() } = options;
|
|
537
|
+
return [
|
|
538
|
+
{
|
|
539
|
+
name: name$10.setup,
|
|
540
|
+
files: files$6,
|
|
541
|
+
plugins: {
|
|
542
|
+
"import-x": pluginImportX$2,
|
|
543
|
+
"unused-imports": pluginUnusedImports$1,
|
|
544
|
+
antfu: pluginAntfu$2,
|
|
545
|
+
perfectionist: pluginPerfectionist
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
name: name$10.rules,
|
|
550
|
+
files: files$6,
|
|
551
|
+
rules: {
|
|
552
|
+
...configs$1.recommended.rules,
|
|
553
|
+
"import-x/newline-after-import": ["error", { considerComments: false }],
|
|
554
|
+
"import-x/no-absolute-path": "error",
|
|
555
|
+
"import-x/no-empty-named-blocks": "error",
|
|
556
|
+
"import-x/no-mutable-exports": "error",
|
|
557
|
+
"import-x/no-useless-path-segments": "warn",
|
|
558
|
+
"import-x/no-webpack-loader-syntax": "error",
|
|
559
|
+
"import-x/no-relative-packages": "warn",
|
|
560
|
+
"unused-imports/no-unused-imports": "error",
|
|
561
|
+
"antfu/import-dedupe": "error",
|
|
562
|
+
"antfu/no-import-dist": "error",
|
|
563
|
+
"antfu/no-import-node-modules-by-path": "error"
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: name$10.stylistic,
|
|
568
|
+
files: files$6,
|
|
569
|
+
rules: {
|
|
570
|
+
"sort-imports": "off",
|
|
571
|
+
"perfectionist/sort-imports": ["error", {
|
|
572
|
+
groups: [
|
|
573
|
+
"type",
|
|
574
|
+
["builtin", "external"],
|
|
575
|
+
"internal-type",
|
|
576
|
+
"internal",
|
|
577
|
+
[
|
|
578
|
+
"parent-type",
|
|
579
|
+
"sibling-type",
|
|
580
|
+
"index-type"
|
|
581
|
+
],
|
|
582
|
+
[
|
|
583
|
+
"parent",
|
|
584
|
+
"sibling",
|
|
585
|
+
"index"
|
|
586
|
+
],
|
|
587
|
+
"object",
|
|
588
|
+
"unknown"
|
|
589
|
+
],
|
|
590
|
+
tsconfigRootDir,
|
|
591
|
+
order: "asc",
|
|
592
|
+
type: "natural"
|
|
593
|
+
}],
|
|
594
|
+
"perfectionist/sort-exports": ["error", {
|
|
595
|
+
order: "asc",
|
|
596
|
+
type: "natural"
|
|
597
|
+
}],
|
|
598
|
+
"perfectionist/sort-named-imports": ["error", {
|
|
599
|
+
order: "asc",
|
|
600
|
+
type: "natural"
|
|
601
|
+
}],
|
|
602
|
+
"perfectionist/sort-named-exports": ["error", {
|
|
603
|
+
order: "asc",
|
|
604
|
+
type: "natural"
|
|
605
|
+
}]
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
];
|
|
617
609
|
}
|
|
618
610
|
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/configs/javascript.ts
|
|
613
|
+
const pluginAntfu$1 = memo(eslintPluginAntfu, "eslint-plugin-antfu");
|
|
614
|
+
const pluginAutofix = memo(eslintPluginAutofix, "eslint-plugin-autofix");
|
|
615
|
+
const pluginImportX$1 = memo(eslintPluginImportX, "eslint-plugin-import-x");
|
|
616
|
+
const pluginUnusedImports = memo(eslintPluginUnusedImports, "eslint-plugin-unused-imports");
|
|
619
617
|
const name$9 = getFlatConfigName("javascript");
|
|
620
618
|
const files$5 = [GLOB_JS, GLOB_JSX];
|
|
621
|
-
const commonjsGlobalsOffList = Object.keys(globals.commonjs).map((key) => ({ [key]: "off" }));
|
|
619
|
+
const commonjsGlobalsOffList = Object.keys(globals$1.commonjs).map((key) => ({ [key]: "off" }));
|
|
622
620
|
const commonjsGlobalsOff = Object.assign({}, ...commonjsGlobalsOffList);
|
|
623
|
-
const extensions = [
|
|
621
|
+
const extensions = [
|
|
622
|
+
".js",
|
|
623
|
+
".jsx",
|
|
624
|
+
".cjs",
|
|
625
|
+
".mjs"
|
|
626
|
+
];
|
|
624
627
|
function javascript(options = {}) {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L191
|
|
705
|
-
"no-caller": "off",
|
|
706
|
-
"autofix/no-caller": "error",
|
|
707
|
-
// disallow usage of __proto__ property
|
|
708
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L275
|
|
709
|
-
"no-proto": "off",
|
|
710
|
-
"autofix/no-proto": "error",
|
|
711
|
-
// disallow unnecessary catch clauses
|
|
712
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L343
|
|
713
|
-
"no-useless-catch": "off",
|
|
714
|
-
"autofix/no-useless-catch": "error",
|
|
715
|
-
// disallow useless string concatenation
|
|
716
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L348
|
|
717
|
-
"no-useless-concat": "off",
|
|
718
|
-
"autofix/no-useless-concat": "error",
|
|
719
|
-
// require use of the second argument for parseInt()
|
|
720
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L382
|
|
721
|
-
radix: "off",
|
|
722
|
-
"autofix/radix": "error",
|
|
723
|
-
// ensure that the results of typeof are compared against a valid string
|
|
724
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L478
|
|
725
|
-
"valid-typeof": "off",
|
|
726
|
-
"autofix/valid-typeof": ["error", { requireStringLiterals: true }],
|
|
727
|
-
// disallow new operators with global non-constructor functions
|
|
728
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L483
|
|
729
|
-
"no-new-native-nonconstructor": "off",
|
|
730
|
-
"autofix/no-new-native-nonconstructor": "error",
|
|
731
|
-
// disallow use of Object.prototypes builtins directly
|
|
732
|
-
// Ref: https://github.com/SukkaW/eslint-config-sukka/blob/3b1c6e5098bd92459237b637a3a63aa60d4cb326/packages/eslint-config-sukka/src/modules/javascript.ts#L1069
|
|
733
|
-
"no-prototype-builtins": "off",
|
|
734
|
-
"autofix/no-prototype-builtins": "error",
|
|
735
|
-
// eslint-plugin-antfu
|
|
736
|
-
// https://github.com/antfu/eslint-plugin-antfu
|
|
737
|
-
"antfu/no-top-level-await": "error",
|
|
738
|
-
"antfu/top-level-function": "error"
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
];
|
|
628
|
+
const { env = { browser: true }, module = true } = options;
|
|
629
|
+
const sourceType = module ? "module" : "commonjs";
|
|
630
|
+
return [
|
|
631
|
+
{
|
|
632
|
+
name: name$9.setup,
|
|
633
|
+
files: files$5,
|
|
634
|
+
plugins: {
|
|
635
|
+
"import-x": pluginImportX$1,
|
|
636
|
+
"unused-imports": pluginUnusedImports,
|
|
637
|
+
autofix: pluginAutofix,
|
|
638
|
+
antfu: pluginAntfu$1
|
|
639
|
+
},
|
|
640
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
641
|
+
languageOptions: {
|
|
642
|
+
sourceType,
|
|
643
|
+
ecmaVersion: "latest",
|
|
644
|
+
parserOptions: { ecmaFeatures: { impliedStrict: true } },
|
|
645
|
+
globals: {
|
|
646
|
+
...globals$1.es2025,
|
|
647
|
+
...module ? {} : globals$1.commonjs,
|
|
648
|
+
...env.browser ? globals$1.browser : {},
|
|
649
|
+
...env.customGlobals
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
settings: {
|
|
653
|
+
"import-x/extensions": extensions,
|
|
654
|
+
"import-x/resolver-next": [createNodeResolver({ extensions })]
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: name$9.commonjs,
|
|
659
|
+
files: ["**/*.cjs"],
|
|
660
|
+
languageOptions: {
|
|
661
|
+
sourceType: "commonjs",
|
|
662
|
+
globals: { ...globals$1.commonjs }
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: name$9.module,
|
|
667
|
+
files: ["**/*.mjs"],
|
|
668
|
+
languageOptions: {
|
|
669
|
+
sourceType: "module",
|
|
670
|
+
globals: { ...commonjsGlobalsOff }
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: name$9.rules,
|
|
675
|
+
files: files$5,
|
|
676
|
+
rules: {
|
|
677
|
+
...js.configs.recommended.rules,
|
|
678
|
+
"no-unused-vars": ["error", {
|
|
679
|
+
vars: "all",
|
|
680
|
+
varsIgnorePattern: "^_",
|
|
681
|
+
args: "after-used",
|
|
682
|
+
argsIgnorePattern: "^_",
|
|
683
|
+
ignoreRestSiblings: true
|
|
684
|
+
}],
|
|
685
|
+
"unused-imports/no-unused-vars": "off",
|
|
686
|
+
"no-caller": "off",
|
|
687
|
+
"autofix/no-caller": "error",
|
|
688
|
+
"no-proto": "off",
|
|
689
|
+
"autofix/no-proto": "error",
|
|
690
|
+
"no-useless-catch": "off",
|
|
691
|
+
"autofix/no-useless-catch": "error",
|
|
692
|
+
"no-useless-concat": "off",
|
|
693
|
+
"autofix/no-useless-concat": "error",
|
|
694
|
+
radix: "off",
|
|
695
|
+
"autofix/radix": "error",
|
|
696
|
+
"valid-typeof": "off",
|
|
697
|
+
"autofix/valid-typeof": ["error", { requireStringLiterals: true }],
|
|
698
|
+
"no-new-native-nonconstructor": "off",
|
|
699
|
+
"autofix/no-new-native-nonconstructor": "error",
|
|
700
|
+
"no-prototype-builtins": "off",
|
|
701
|
+
"autofix/no-prototype-builtins": "error",
|
|
702
|
+
"antfu/no-top-level-await": "error",
|
|
703
|
+
"antfu/top-level-function": "error"
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
];
|
|
742
707
|
}
|
|
743
708
|
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region src/configs/json.ts
|
|
711
|
+
const pluginJson = memo(eslintPluginJson, "eslint-plugin-json");
|
|
712
|
+
const pluginJsonc = memo(eslintPluginJsonc, "eslint-plugin-jsonc");
|
|
744
713
|
const name$8 = getFlatConfigName("json");
|
|
745
|
-
const jsoncRecommendedWithJsonRuleList = pluginJsonc.configs["flat/recommended-with-json"].map(
|
|
746
|
-
(config) => config.rules
|
|
747
|
-
);
|
|
748
|
-
const jsoncRecommendedWithJsonRules = Object.assign(
|
|
749
|
-
{},
|
|
750
|
-
...jsoncRecommendedWithJsonRuleList
|
|
751
|
-
);
|
|
752
714
|
function json(options = {}) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
]
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
];
|
|
715
|
+
const { extraFiles = [], stylistic = { indentWidth: 2 } } = options;
|
|
716
|
+
const { indentWidth = 2 } = typeof stylistic === "object" ? stylistic : { indentWidth: 2 };
|
|
717
|
+
const files$7 = [
|
|
718
|
+
GLOB_JSON,
|
|
719
|
+
GLOB_JSON5,
|
|
720
|
+
GLOB_JSONC,
|
|
721
|
+
...extraFiles
|
|
722
|
+
];
|
|
723
|
+
return [
|
|
724
|
+
{
|
|
725
|
+
name: name$8.setup,
|
|
726
|
+
files: files$7,
|
|
727
|
+
plugins: {
|
|
728
|
+
json: pluginJson,
|
|
729
|
+
jsonc: pluginJsonc
|
|
730
|
+
},
|
|
731
|
+
language: "json/json",
|
|
732
|
+
languageOptions: { parser: parsers_default["parserJsonc"] }
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: name$8.rules,
|
|
736
|
+
files: files$7,
|
|
737
|
+
rules: { ...pluginJson.configs.recommended.rules }
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
name: name$8.stylistic,
|
|
741
|
+
files: files$7,
|
|
742
|
+
rules: stylistic ? {
|
|
743
|
+
"json/sort-keys": [
|
|
744
|
+
"error",
|
|
745
|
+
"asc",
|
|
746
|
+
{ natural: true }
|
|
747
|
+
],
|
|
748
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
749
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
750
|
+
"jsonc/comma-style": ["error", "last"],
|
|
751
|
+
"jsonc/indent": ["error", indentWidth],
|
|
752
|
+
"jsonc/key-spacing": ["error", {
|
|
753
|
+
afterColon: true,
|
|
754
|
+
beforeColon: false
|
|
755
|
+
}],
|
|
756
|
+
"jsonc/object-curly-newline": ["error", {
|
|
757
|
+
consistent: true,
|
|
758
|
+
multiline: true
|
|
759
|
+
}],
|
|
760
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
761
|
+
"jsonc/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
762
|
+
"jsonc/quote-props": "error",
|
|
763
|
+
"jsonc/quotes": "error"
|
|
764
|
+
} : {}
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: `${name$8.base}/package-json`,
|
|
768
|
+
files: ["**/package.json"],
|
|
769
|
+
rules: {
|
|
770
|
+
"json/sort-keys": "off",
|
|
771
|
+
"jsonc/sort-array-values": ["error", {
|
|
772
|
+
order: { type: "asc" },
|
|
773
|
+
pathPattern: "^files$"
|
|
774
|
+
}],
|
|
775
|
+
"jsonc/sort-keys": [
|
|
776
|
+
"error",
|
|
777
|
+
{
|
|
778
|
+
order: [
|
|
779
|
+
"publisher",
|
|
780
|
+
"name",
|
|
781
|
+
"displayName",
|
|
782
|
+
"type",
|
|
783
|
+
"version",
|
|
784
|
+
"private",
|
|
785
|
+
"packageManager",
|
|
786
|
+
"description",
|
|
787
|
+
"author",
|
|
788
|
+
"contributors",
|
|
789
|
+
"license",
|
|
790
|
+
"funding",
|
|
791
|
+
"homepage",
|
|
792
|
+
"repository",
|
|
793
|
+
"bugs",
|
|
794
|
+
"keywords",
|
|
795
|
+
"categories",
|
|
796
|
+
"sideEffects",
|
|
797
|
+
"exports",
|
|
798
|
+
"main",
|
|
799
|
+
"module",
|
|
800
|
+
"unpkg",
|
|
801
|
+
"jsdelivr",
|
|
802
|
+
"types",
|
|
803
|
+
"typesVersions",
|
|
804
|
+
"bin",
|
|
805
|
+
"icon",
|
|
806
|
+
"files",
|
|
807
|
+
"engines",
|
|
808
|
+
"activationEvents",
|
|
809
|
+
"contributes",
|
|
810
|
+
"publishConfig",
|
|
811
|
+
"scripts",
|
|
812
|
+
"peerDependencies",
|
|
813
|
+
"peerDependenciesMeta",
|
|
814
|
+
"dependencies",
|
|
815
|
+
"optionalDependencies",
|
|
816
|
+
"devDependencies",
|
|
817
|
+
"pnpm",
|
|
818
|
+
"overrides",
|
|
819
|
+
"resolutions",
|
|
820
|
+
"husky",
|
|
821
|
+
"simple-git-hooks",
|
|
822
|
+
"lint-staged",
|
|
823
|
+
"eslintConfig"
|
|
824
|
+
],
|
|
825
|
+
pathPattern: "^$"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
order: { type: "asc" },
|
|
829
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
order: { type: "asc" },
|
|
833
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
order: [
|
|
837
|
+
"types",
|
|
838
|
+
"import",
|
|
839
|
+
"require",
|
|
840
|
+
"default"
|
|
841
|
+
],
|
|
842
|
+
pathPattern: "^exports.*$"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
order: [
|
|
846
|
+
"pre-commit",
|
|
847
|
+
"prepare-commit-msg",
|
|
848
|
+
"commit-msg",
|
|
849
|
+
"post-commit",
|
|
850
|
+
"pre-rebase",
|
|
851
|
+
"post-rewrite",
|
|
852
|
+
"post-checkout",
|
|
853
|
+
"post-merge",
|
|
854
|
+
"pre-push",
|
|
855
|
+
"pre-auto-gc"
|
|
856
|
+
],
|
|
857
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
858
|
+
}
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: `${name$8.base}/tsconfig-json`,
|
|
864
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
865
|
+
rules: {
|
|
866
|
+
"json/sort-keys": "off",
|
|
867
|
+
"jsonc/sort-keys": [
|
|
868
|
+
"error",
|
|
869
|
+
{
|
|
870
|
+
order: [
|
|
871
|
+
"extends",
|
|
872
|
+
"compilerOptions",
|
|
873
|
+
"references",
|
|
874
|
+
"files",
|
|
875
|
+
"include",
|
|
876
|
+
"exclude"
|
|
877
|
+
],
|
|
878
|
+
pathPattern: "^$"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
order: [
|
|
882
|
+
"incremental",
|
|
883
|
+
"composite",
|
|
884
|
+
"tsBuildInfoFile",
|
|
885
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
886
|
+
"disableSolutionSearching",
|
|
887
|
+
"disableReferencedProjectLoad",
|
|
888
|
+
"target",
|
|
889
|
+
"jsx",
|
|
890
|
+
"jsxFactory",
|
|
891
|
+
"jsxFragmentFactory",
|
|
892
|
+
"jsxImportSource",
|
|
893
|
+
"lib",
|
|
894
|
+
"moduleDetection",
|
|
895
|
+
"noLib",
|
|
896
|
+
"reactNamespace",
|
|
897
|
+
"useDefineForClassFields",
|
|
898
|
+
"emitDecoratorMetadata",
|
|
899
|
+
"experimentalDecorators",
|
|
900
|
+
"baseUrl",
|
|
901
|
+
"rootDir",
|
|
902
|
+
"rootDirs",
|
|
903
|
+
"customConditions",
|
|
904
|
+
"module",
|
|
905
|
+
"moduleResolution",
|
|
906
|
+
"moduleSuffixes",
|
|
907
|
+
"noResolve",
|
|
908
|
+
"paths",
|
|
909
|
+
"resolveJsonModule",
|
|
910
|
+
"resolvePackageJsonExports",
|
|
911
|
+
"resolvePackageJsonImports",
|
|
912
|
+
"typeRoots",
|
|
913
|
+
"types",
|
|
914
|
+
"allowArbitraryExtensions",
|
|
915
|
+
"allowImportingTsExtensions",
|
|
916
|
+
"allowUmdGlobalAccess",
|
|
917
|
+
"allowJs",
|
|
918
|
+
"checkJs",
|
|
919
|
+
"maxNodeModuleJsDepth",
|
|
920
|
+
"strict",
|
|
921
|
+
"strictBindCallApply",
|
|
922
|
+
"strictFunctionTypes",
|
|
923
|
+
"strictNullChecks",
|
|
924
|
+
"strictPropertyInitialization",
|
|
925
|
+
"allowUnreachableCode",
|
|
926
|
+
"allowUnusedLabels",
|
|
927
|
+
"alwaysStrict",
|
|
928
|
+
"exactOptionalPropertyTypes",
|
|
929
|
+
"noFallthroughCasesInSwitch",
|
|
930
|
+
"noImplicitAny",
|
|
931
|
+
"noImplicitOverride",
|
|
932
|
+
"noImplicitReturns",
|
|
933
|
+
"noImplicitThis",
|
|
934
|
+
"noPropertyAccessFromIndexSignature",
|
|
935
|
+
"noUncheckedIndexedAccess",
|
|
936
|
+
"noUnusedLocals",
|
|
937
|
+
"noUnusedParameters",
|
|
938
|
+
"useUnknownInCatchVariables",
|
|
939
|
+
"declaration",
|
|
940
|
+
"declarationDir",
|
|
941
|
+
"declarationMap",
|
|
942
|
+
"downlevelIteration",
|
|
943
|
+
"emitBOM",
|
|
944
|
+
"emitDeclarationOnly",
|
|
945
|
+
"importHelpers",
|
|
946
|
+
"importsNotUsedAsValues",
|
|
947
|
+
"inlineSourceMap",
|
|
948
|
+
"inlineSources",
|
|
949
|
+
"mapRoot",
|
|
950
|
+
"newLine",
|
|
951
|
+
"noEmit",
|
|
952
|
+
"noEmitHelpers",
|
|
953
|
+
"noEmitOnError",
|
|
954
|
+
"outDir",
|
|
955
|
+
"outFile",
|
|
956
|
+
"preserveConstEnums",
|
|
957
|
+
"preserveValueImports",
|
|
958
|
+
"removeComments",
|
|
959
|
+
"sourceMap",
|
|
960
|
+
"sourceRoot",
|
|
961
|
+
"stripInternal",
|
|
962
|
+
"allowSyntheticDefaultImports",
|
|
963
|
+
"esModuleInterop",
|
|
964
|
+
"forceConsistentCasingInFileNames",
|
|
965
|
+
"isolatedDeclarations",
|
|
966
|
+
"isolatedModules",
|
|
967
|
+
"preserveSymlinks",
|
|
968
|
+
"verbatimModuleSyntax",
|
|
969
|
+
"skipDefaultLibCheck",
|
|
970
|
+
"skipLibCheck"
|
|
971
|
+
],
|
|
972
|
+
pathPattern: "^compilerOptions$"
|
|
973
|
+
}
|
|
974
|
+
]
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
];
|
|
1020
978
|
}
|
|
1021
979
|
|
|
980
|
+
//#endregion
|
|
981
|
+
//#region src/configs/jsx.ts
|
|
1022
982
|
const name$7 = getFlatConfigName("jsx");
|
|
1023
983
|
function jsx() {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
parserOptions: {
|
|
1030
|
-
ecmaFeatures: {
|
|
1031
|
-
jsx: true
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
];
|
|
984
|
+
return [{
|
|
985
|
+
name: name$7.setup,
|
|
986
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
987
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
|
|
988
|
+
}];
|
|
1037
989
|
}
|
|
1038
990
|
|
|
991
|
+
//#endregion
|
|
992
|
+
//#region src/configs/next-js.ts
|
|
993
|
+
const pluginNextJs = memo(eslintPluginNextJs, "eslint-plugin-next");
|
|
994
|
+
const pluginReactRefresh$1 = memo(eslintPluginReactRefresh, "eslint-plugin-react-refresh");
|
|
1039
995
|
const name$6 = getFlatConfigName("next-js");
|
|
1040
996
|
const files$4 = [GLOB_SRC];
|
|
1041
997
|
function nextJs() {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
"react-refresh/only-export-components": ["warn", {
|
|
1065
|
-
allowExportNames: [
|
|
1066
|
-
"config",
|
|
1067
|
-
"generateStaticParams",
|
|
1068
|
-
"metadata",
|
|
1069
|
-
"generateMetadata",
|
|
1070
|
-
"viewport",
|
|
1071
|
-
"generateViewport"
|
|
1072
|
-
]
|
|
1073
|
-
}]
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
];
|
|
998
|
+
return [{
|
|
999
|
+
name: name$6.setup,
|
|
1000
|
+
files: files$4,
|
|
1001
|
+
plugins: {
|
|
1002
|
+
"@next/next": pluginNextJs,
|
|
1003
|
+
"react-refresh": pluginReactRefresh$1
|
|
1004
|
+
}
|
|
1005
|
+
}, {
|
|
1006
|
+
name: name$6.rules,
|
|
1007
|
+
files: files$4,
|
|
1008
|
+
rules: {
|
|
1009
|
+
...pluginNextJs.flatConfig.coreWebVitals.rules,
|
|
1010
|
+
"react-refresh/only-export-components": ["warn", { allowExportNames: [
|
|
1011
|
+
"config",
|
|
1012
|
+
"generateStaticParams",
|
|
1013
|
+
"metadata",
|
|
1014
|
+
"generateMetadata",
|
|
1015
|
+
"viewport",
|
|
1016
|
+
"generateViewport"
|
|
1017
|
+
] }]
|
|
1018
|
+
}
|
|
1019
|
+
}];
|
|
1077
1020
|
}
|
|
1078
1021
|
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/configs/node-js.ts
|
|
1024
|
+
const pluginNode = memo(eslintPluginNode, "eslint-plugin-n");
|
|
1079
1025
|
const name$5 = getFlatConfigName("node-js");
|
|
1080
1026
|
const isModule = getPackageJson()?.type === "module";
|
|
1081
1027
|
const globalsCommonJs = {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1028
|
+
...globals$1.es2025,
|
|
1029
|
+
...globals$1.node,
|
|
1030
|
+
...globals$1.commonjs,
|
|
1031
|
+
__dirname: "readonly",
|
|
1032
|
+
__filename: "readonly"
|
|
1087
1033
|
};
|
|
1088
1034
|
const globalsModule = {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1035
|
+
...globals$1.es2025,
|
|
1036
|
+
...globals$1.node,
|
|
1037
|
+
__dirname: "off",
|
|
1038
|
+
__filename: "off",
|
|
1039
|
+
exports: "off",
|
|
1040
|
+
module: "off",
|
|
1041
|
+
require: "off"
|
|
1096
1042
|
};
|
|
1097
1043
|
function nodeJs(options = {}) {
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
globalReturn: true
|
|
1182
|
-
}
|
|
1183
|
-
},
|
|
1184
|
-
globals: {
|
|
1185
|
-
...globalsCommonJs
|
|
1186
|
-
}
|
|
1187
|
-
},
|
|
1188
|
-
rules: {
|
|
1189
|
-
strict: ["error", "global"],
|
|
1190
|
-
"node/no-unsupported-features/es-syntax": ["error", { ignores: [] }]
|
|
1191
|
-
}
|
|
1192
|
-
},
|
|
1193
|
-
{
|
|
1194
|
-
name: name$5.module,
|
|
1195
|
-
files: ["**/*.m[jt]s"],
|
|
1196
|
-
languageOptions: {
|
|
1197
|
-
sourceType: "module",
|
|
1198
|
-
parserOptions: {
|
|
1199
|
-
ecmaFeatures: {
|
|
1200
|
-
globalReturn: false
|
|
1201
|
-
}
|
|
1202
|
-
},
|
|
1203
|
-
globals: {
|
|
1204
|
-
...globalsModule
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
];
|
|
1044
|
+
const { module = isModule, extraFiles = [] } = options;
|
|
1045
|
+
const files$7 = [
|
|
1046
|
+
GLOB_JS,
|
|
1047
|
+
GLOB_TS,
|
|
1048
|
+
...extraFiles
|
|
1049
|
+
];
|
|
1050
|
+
return [
|
|
1051
|
+
{
|
|
1052
|
+
name: name$5.setup,
|
|
1053
|
+
files: files$7,
|
|
1054
|
+
plugins: { node: pluginNode },
|
|
1055
|
+
languageOptions: {
|
|
1056
|
+
ecmaVersion: "latest",
|
|
1057
|
+
parserOptions: { ecmaFeatures: { impliedStrict: true } }
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
name: name$5.rules,
|
|
1062
|
+
files: files$7,
|
|
1063
|
+
rules: {
|
|
1064
|
+
"node/no-deprecated-api": "error",
|
|
1065
|
+
"node/no-exports-assign": "error",
|
|
1066
|
+
"node/no-process-exit": "error",
|
|
1067
|
+
"node/no-unpublished-bin": "error",
|
|
1068
|
+
"node/no-unpublished-import": "error",
|
|
1069
|
+
"node/no-unpublished-require": "error",
|
|
1070
|
+
"node/no-unsupported-features/es-builtins": "error",
|
|
1071
|
+
"node/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }],
|
|
1072
|
+
"node/no-unsupported-features/node-builtins": "error",
|
|
1073
|
+
"node/process-exit-as-throw": "error",
|
|
1074
|
+
"node/hashbang": "error",
|
|
1075
|
+
"node/no-extraneous-import": "off",
|
|
1076
|
+
"node/no-extraneous-require": "off",
|
|
1077
|
+
"node/no-missing-import": "off",
|
|
1078
|
+
"node/no-missing-require": "off",
|
|
1079
|
+
"node/handle-callback-err": ["error", "^error$"],
|
|
1080
|
+
"node/no-new-require": "error",
|
|
1081
|
+
"node/no-path-concat": "error",
|
|
1082
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
1083
|
+
"node/prefer-global/console": ["error", "always"],
|
|
1084
|
+
"node/prefer-global/process": ["error", "never"],
|
|
1085
|
+
"node/prefer-global/text-decoder": ["error", "always"],
|
|
1086
|
+
"node/prefer-global/text-encoder": ["error", "always"],
|
|
1087
|
+
"node/prefer-global/url": ["error", "always"],
|
|
1088
|
+
"node/prefer-global/url-search-params": ["error", "always"],
|
|
1089
|
+
...!module && {
|
|
1090
|
+
strict: ["error", "global"],
|
|
1091
|
+
"node/no-unsupported-features/es-syntax": ["error", { ignores: [] }]
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
name: name$5.script,
|
|
1097
|
+
files: ["**/*.[jt]s"],
|
|
1098
|
+
languageOptions: {
|
|
1099
|
+
sourceType: module ? "module" : "commonjs",
|
|
1100
|
+
parserOptions: { ecmaFeatures: { globalReturn: !module } },
|
|
1101
|
+
globals: { ...module ? globalsModule : globalsCommonJs }
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
name: name$5.commonjs,
|
|
1106
|
+
files: ["**/*.c[jt]s"],
|
|
1107
|
+
languageOptions: {
|
|
1108
|
+
sourceType: "commonjs",
|
|
1109
|
+
parserOptions: { ecmaFeatures: { globalReturn: true } },
|
|
1110
|
+
globals: { ...globalsCommonJs }
|
|
1111
|
+
},
|
|
1112
|
+
rules: {
|
|
1113
|
+
strict: ["error", "global"],
|
|
1114
|
+
"node/no-unsupported-features/es-syntax": ["error", { ignores: [] }]
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
name: name$5.module,
|
|
1119
|
+
files: ["**/*.m[jt]s"],
|
|
1120
|
+
languageOptions: {
|
|
1121
|
+
sourceType: "module",
|
|
1122
|
+
parserOptions: { ecmaFeatures: { globalReturn: false } },
|
|
1123
|
+
globals: { ...globalsModule }
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
];
|
|
1209
1127
|
}
|
|
1210
1128
|
|
|
1129
|
+
//#endregion
|
|
1130
|
+
//#region src/configs/react.ts
|
|
1131
|
+
const reactPlugins$1 = eslintPluginReact.configs.all.plugins;
|
|
1132
|
+
const pluginJsxA11y = memo(eslint_plugin_jsx_a11y_minimal, "eslint-plugin-react-jsx-a11y");
|
|
1133
|
+
const pluginReact$1 = memo(reactPlugins$1["@eslint-react"], "eslint-plugin-react-x");
|
|
1134
|
+
const pluginReactCompiler = memo(eslintPluginReactCompiler, "eslint-plugin-react-compiler");
|
|
1135
|
+
const pluginReactDebug = memo(reactPlugins$1["@eslint-react/debug"], "eslint-plugin-react-debug");
|
|
1136
|
+
const pluginReactDom$1 = memo(reactPlugins$1["@eslint-react/dom"], "eslint-plugin-react-dom");
|
|
1137
|
+
const pluginReactHooks = memo(eslintPluginReactHooks, "eslint-plugin-react-hooks");
|
|
1138
|
+
const pluginReactHooksExtra = memo(reactPlugins$1["@eslint-react/hooks-extra"], "eslint-plugin-react-hooks-extra");
|
|
1139
|
+
const pluginReactHooksNamingConvention = memo(reactPlugins$1["@eslint-react/naming-convention"], "eslint-plugin-react-naming-convention");
|
|
1140
|
+
const pluginReactRefresh = memo(eslintPluginReactRefresh, "eslint-plugin-react-refresh");
|
|
1141
|
+
const pluginReactWebApi = memo(reactPlugins$1["@eslint-react/web-api"], "eslint-plugin-react-web-api");
|
|
1142
|
+
const pluginStylistic = memo(eslintPluginStylistic, "eslint-plugin-stylistic");
|
|
1211
1143
|
const name$4 = getFlatConfigName("react");
|
|
1212
1144
|
const files$3 = [GLOB_SRC];
|
|
1213
1145
|
function react(options = {}) {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
closingSlash: "never"
|
|
1348
|
-
}
|
|
1349
|
-
],
|
|
1350
|
-
"@stylistic/jsx/jsx-wrap-multilines": [
|
|
1351
|
-
"error",
|
|
1352
|
-
{
|
|
1353
|
-
arrow: "parens-new-line",
|
|
1354
|
-
assignment: "parens-new-line",
|
|
1355
|
-
condition: "parens-new-line",
|
|
1356
|
-
declaration: "parens-new-line",
|
|
1357
|
-
logical: "parens-new-line",
|
|
1358
|
-
prop: "parens-new-line",
|
|
1359
|
-
propertyValue: "parens-new-line",
|
|
1360
|
-
return: "parens-new-line"
|
|
1361
|
-
}
|
|
1362
|
-
],
|
|
1363
|
-
"@stylistic/jsx/jsx-sort-props": [
|
|
1364
|
-
"error",
|
|
1365
|
-
{
|
|
1366
|
-
callbacksLast: true,
|
|
1367
|
-
shorthandFirst: true,
|
|
1368
|
-
multiline: "last",
|
|
1369
|
-
reservedFirst: true
|
|
1370
|
-
}
|
|
1371
|
-
]
|
|
1372
|
-
} : {}
|
|
1373
|
-
}
|
|
1374
|
-
];
|
|
1146
|
+
const { stylistic = true, reactCompiler = false } = options;
|
|
1147
|
+
return [
|
|
1148
|
+
{
|
|
1149
|
+
name: name$4.setup,
|
|
1150
|
+
files: files$3,
|
|
1151
|
+
plugins: {
|
|
1152
|
+
"react-hooks": pluginReactHooks,
|
|
1153
|
+
"react-compiler": pluginReactCompiler,
|
|
1154
|
+
"react-refresh": pluginReactRefresh,
|
|
1155
|
+
"jsx-a11y": pluginJsxA11y,
|
|
1156
|
+
"@stylistic": pluginStylistic,
|
|
1157
|
+
"@eslint-react": pluginReact$1,
|
|
1158
|
+
"@eslint-react/dom": pluginReactDom$1,
|
|
1159
|
+
"@eslint-react/web-api": pluginReactWebApi,
|
|
1160
|
+
"@eslint-react/debug": pluginReactDebug,
|
|
1161
|
+
"@eslint-react/hooks-extra": pluginReactHooksExtra,
|
|
1162
|
+
"@eslint-react/naming-convention": pluginReactHooksNamingConvention
|
|
1163
|
+
},
|
|
1164
|
+
settings: { "react-x": {
|
|
1165
|
+
importSource: "react",
|
|
1166
|
+
jsxPragma: "createElement",
|
|
1167
|
+
jsxPragmaFrag: "Fragment",
|
|
1168
|
+
polymorphicPropName: "as",
|
|
1169
|
+
strict: true,
|
|
1170
|
+
strictImportCheck: true,
|
|
1171
|
+
version: "detect",
|
|
1172
|
+
additionalHooks: {
|
|
1173
|
+
useEffect: ["useIsomorphicLayoutEffect"],
|
|
1174
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
1175
|
+
}
|
|
1176
|
+
} }
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
name: name$4.rules,
|
|
1180
|
+
files: files$3,
|
|
1181
|
+
rules: {
|
|
1182
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1183
|
+
"react-hooks/exhaustive-deps": "error",
|
|
1184
|
+
"react-compiler/react-compiler": reactCompiler ? "error" : "off",
|
|
1185
|
+
"react-refresh/only-export-components": "warn",
|
|
1186
|
+
"jsx-a11y/alt-text": ["warn", {
|
|
1187
|
+
elements: ["img"],
|
|
1188
|
+
img: ["Image"]
|
|
1189
|
+
}],
|
|
1190
|
+
"jsx-a11y/aria-props": "warn",
|
|
1191
|
+
"jsx-a11y/aria-proptypes": "warn",
|
|
1192
|
+
"jsx-a11y/aria-role": "warn",
|
|
1193
|
+
"jsx-a11y/aria-unsupported-elements": "warn",
|
|
1194
|
+
"jsx-a11y/iframe-has-title": "warn",
|
|
1195
|
+
"jsx-a11y/no-access-key": "warn",
|
|
1196
|
+
"jsx-a11y/role-has-required-aria-props": "warn",
|
|
1197
|
+
"jsx-a11y/role-supports-aria-props": "warn",
|
|
1198
|
+
"jsx-a11y/tabindex-no-positive": "warn",
|
|
1199
|
+
...pluginReact$1.configs.recommended.rules,
|
|
1200
|
+
"@eslint-react/ensure-forward-ref-using-ref": "error",
|
|
1201
|
+
"@eslint-react/no-duplicate-jsx-props": "error",
|
|
1202
|
+
"@eslint-react/no-duplicate-key": "error",
|
|
1203
|
+
"@eslint-react/no-children-count": "error",
|
|
1204
|
+
"@eslint-react/no-children-for-each": "error",
|
|
1205
|
+
"@eslint-react/no-children-only": "error",
|
|
1206
|
+
"@eslint-react/no-children-to-array": "error",
|
|
1207
|
+
"@eslint-react/no-clone-element": "error",
|
|
1208
|
+
"@eslint-react/no-comment-textnodes": "error",
|
|
1209
|
+
"@eslint-react/no-implicit-key": "error",
|
|
1210
|
+
"@eslint-react/no-missing-component-display-name": "error",
|
|
1211
|
+
"@eslint-react/no-unstable-context-value": "error",
|
|
1212
|
+
"@eslint-react/dom/no-unsafe-target-blank": "off",
|
|
1213
|
+
"@eslint-react/dom/no-void-elements-with-children": "error",
|
|
1214
|
+
"@eslint-react/web-api/no-leaked-event-listener": "error",
|
|
1215
|
+
"@eslint-react/web-api/no-leaked-interval": "error",
|
|
1216
|
+
"@eslint-react/web-api/no-leaked-resize-observer": "error",
|
|
1217
|
+
"@eslint-react/web-api/no-leaked-timeout": "error",
|
|
1218
|
+
"@eslint-react/hooks-extra/no-unnecessary-use-callback": "error",
|
|
1219
|
+
"@eslint-react/hooks-extra/no-unnecessary-use-memo": "error",
|
|
1220
|
+
"@eslint-react/hooks-extra/no-useless-custom-hooks": "error",
|
|
1221
|
+
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "error",
|
|
1222
|
+
"@eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect": "error"
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
name: name$4.stylistic,
|
|
1227
|
+
files: files$3,
|
|
1228
|
+
rules: stylistic ? {
|
|
1229
|
+
"@eslint-react/prefer-destructuring-assignment": "error",
|
|
1230
|
+
"@eslint-react/prefer-react-namespace-import": "warn",
|
|
1231
|
+
"@eslint-react/prefer-shorthand-boolean": "error",
|
|
1232
|
+
"@eslint-react/prefer-shorthand-fragment": "off",
|
|
1233
|
+
"@eslint-react/avoid-shorthand-boolean": "off",
|
|
1234
|
+
"@eslint-react/avoid-shorthand-fragment": "error",
|
|
1235
|
+
"@stylistic/jsx-closing-bracket-location": "error",
|
|
1236
|
+
"@stylistic/jsx-closing-tag-location": "error",
|
|
1237
|
+
"@stylistic/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
|
|
1238
|
+
"@stylistic/jsx-equals-spacing": "error",
|
|
1239
|
+
"@stylistic/jsx-first-prop-new-line": ["error", "multiline"],
|
|
1240
|
+
"@stylistic/jsx-function-call-newline": ["error", "multiline"],
|
|
1241
|
+
"@stylistic/jsx-max-props-per-line": ["error", {
|
|
1242
|
+
maximum: 1,
|
|
1243
|
+
when: "multiline"
|
|
1244
|
+
}],
|
|
1245
|
+
"@stylistic/jsx-one-expression-per-line": ["error", { allow: "non-jsx" }],
|
|
1246
|
+
"@stylistic/jsx-pascal-case": ["error", {
|
|
1247
|
+
allowNamespace: true,
|
|
1248
|
+
ignore: ["motion"]
|
|
1249
|
+
}],
|
|
1250
|
+
"@stylistic/jsx-self-closing-comp": ["error", {
|
|
1251
|
+
component: true,
|
|
1252
|
+
html: true
|
|
1253
|
+
}],
|
|
1254
|
+
"@stylistic/jsx-tag-spacing": ["error", {
|
|
1255
|
+
afterOpening: "never",
|
|
1256
|
+
beforeClosing: "never",
|
|
1257
|
+
beforeSelfClosing: "always",
|
|
1258
|
+
closingSlash: "never"
|
|
1259
|
+
}],
|
|
1260
|
+
"@stylistic/jsx-wrap-multilines": ["error", {
|
|
1261
|
+
arrow: "parens-new-line",
|
|
1262
|
+
assignment: "parens-new-line",
|
|
1263
|
+
condition: "parens-new-line",
|
|
1264
|
+
declaration: "parens-new-line",
|
|
1265
|
+
logical: "parens-new-line",
|
|
1266
|
+
prop: "parens-new-line",
|
|
1267
|
+
propertyValue: "parens-new-line",
|
|
1268
|
+
return: "parens-new-line"
|
|
1269
|
+
}],
|
|
1270
|
+
"@stylistic/jsx-sort-props": ["error", {
|
|
1271
|
+
callbacksLast: true,
|
|
1272
|
+
shorthandFirst: true,
|
|
1273
|
+
multiline: "last",
|
|
1274
|
+
reservedFirst: true
|
|
1275
|
+
}]
|
|
1276
|
+
} : {}
|
|
1277
|
+
}
|
|
1278
|
+
];
|
|
1375
1279
|
}
|
|
1376
1280
|
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/configs/regexp.ts
|
|
1283
|
+
const pluginRegexp = memo(eslintPluginRegexp, "eslint-plugin-regexp");
|
|
1377
1284
|
const name$3 = getFlatConfigName("regexp");
|
|
1378
1285
|
const files$2 = [GLOB_SRC];
|
|
1379
1286
|
function regexp() {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
name: name$3.rules,
|
|
1390
|
-
files: files$2,
|
|
1391
|
-
rules: {
|
|
1392
|
-
// eslint-plugin-regexp
|
|
1393
|
-
// https://github.com/ota-meshi/eslint-plugin-regexp
|
|
1394
|
-
...pluginRegexp.configs["flat/recommended"].rules
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
];
|
|
1287
|
+
return [{
|
|
1288
|
+
name: name$3.setup,
|
|
1289
|
+
files: files$2,
|
|
1290
|
+
plugins: { regexp: pluginRegexp }
|
|
1291
|
+
}, {
|
|
1292
|
+
name: name$3.rules,
|
|
1293
|
+
files: files$2,
|
|
1294
|
+
rules: { ...pluginRegexp.configs["flat/recommended"].rules }
|
|
1295
|
+
}];
|
|
1398
1296
|
}
|
|
1399
1297
|
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region src/configs/tailwindcss.ts
|
|
1300
|
+
const pluginBetterTailwindCSS = memo(eslintPluginBetterTailwindcss, "eslint-plugin-better-tailwindcss");
|
|
1400
1301
|
const name$2 = getFlatConfigName("tailwindcss");
|
|
1401
|
-
const files$1 = [
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
"tailwindcss/no-unnecessary-arbitrary-value": "error"
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
];
|
|
1302
|
+
const files$1 = [
|
|
1303
|
+
GLOB_SRC,
|
|
1304
|
+
GLOB_STYLE,
|
|
1305
|
+
GLOB_POSTCSS,
|
|
1306
|
+
GLOB_HTML
|
|
1307
|
+
];
|
|
1308
|
+
function tailwindcss(options = {}) {
|
|
1309
|
+
return [{
|
|
1310
|
+
name: name$2.setup,
|
|
1311
|
+
files: files$1,
|
|
1312
|
+
plugins: { "better-tailwindcss": pluginBetterTailwindCSS },
|
|
1313
|
+
settings: { "better-tailwindcss": { ...options } }
|
|
1314
|
+
}, {
|
|
1315
|
+
name: name$2.rules,
|
|
1316
|
+
files: files$1,
|
|
1317
|
+
rules: {
|
|
1318
|
+
"better-tailwindcss/enforce-consistent-class-order": "error",
|
|
1319
|
+
"better-tailwindcss/enforce-consistent-variable-syntax": ["error", { syntax: "variable" }],
|
|
1320
|
+
"better-tailwindcss/enforce-consistent-important-position": "error",
|
|
1321
|
+
"better-tailwindcss/enforce-shorthand-classes": "error",
|
|
1322
|
+
"better-tailwindcss/no-duplicate-classes": "error",
|
|
1323
|
+
"better-tailwindcss/no-deprecated-classes": "error",
|
|
1324
|
+
"better-tailwindcss/no-unnecessary-whitespace": "error",
|
|
1325
|
+
"better-tailwindcss/no-unregistered-classes": "error",
|
|
1326
|
+
"better-tailwindcss/no-conflicting-classes": "error"
|
|
1327
|
+
}
|
|
1328
|
+
}];
|
|
1432
1329
|
}
|
|
1433
1330
|
|
|
1331
|
+
//#endregion
|
|
1332
|
+
//#region src/configs/typescript.ts
|
|
1333
|
+
const reactPlugins = eslintPluginReact.configs.all.plugins;
|
|
1334
|
+
const pluginAntfu = memo(eslintPluginAntfu, "eslint-plugin-antfu");
|
|
1335
|
+
const pluginImportX = memo(eslintPluginImportX, "eslint-plugin-import-x");
|
|
1336
|
+
const pluginReact = memo(reactPlugins["@eslint-react"], "eslint-plugin-react-x");
|
|
1337
|
+
const pluginReactDom = memo(reactPlugins["@eslint-react/dom"], "eslint-plugin-react-dom");
|
|
1338
|
+
const pluginTypescript = memo(plugin, "typescript-eslint");
|
|
1434
1339
|
const name$1 = getFlatConfigName("typescript");
|
|
1435
|
-
const typescriptStrictTypeCheckedRuleList = configs.strictTypeChecked.map(
|
|
1436
|
-
|
|
1437
|
-
);
|
|
1438
|
-
const
|
|
1439
|
-
{},
|
|
1440
|
-
...typescriptStrictTypeCheckedRuleList
|
|
1441
|
-
);
|
|
1442
|
-
const typescriptStylisticTypeCheckedRuleList = configs.stylisticTypeChecked.map(
|
|
1443
|
-
(config) => config.rules
|
|
1444
|
-
);
|
|
1445
|
-
const typescriptStylisticTypeCheckedRules = Object.assign(
|
|
1446
|
-
{},
|
|
1447
|
-
...typescriptStylisticTypeCheckedRuleList
|
|
1448
|
-
);
|
|
1340
|
+
const typescriptStrictTypeCheckedRuleList = configs.strictTypeChecked.map((config$1) => config$1.rules);
|
|
1341
|
+
const typescriptStrictTypeCheckedRules = Object.assign({}, ...typescriptStrictTypeCheckedRuleList);
|
|
1342
|
+
const typescriptStylisticTypeCheckedRuleList = configs.stylisticTypeChecked.map((config$1) => config$1.rules);
|
|
1343
|
+
const typescriptStylisticTypeCheckedRules = Object.assign({}, ...typescriptStylisticTypeCheckedRuleList);
|
|
1449
1344
|
const externalModuleFolders = ["node_modules", "node_modules/@types"];
|
|
1450
1345
|
function typescript(options = {}) {
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
"antfu/no-ts-export-equal": "error"
|
|
1574
|
-
}
|
|
1575
|
-
},
|
|
1576
|
-
{
|
|
1577
|
-
name: `${name$1.base}/react-type-checked`,
|
|
1578
|
-
files,
|
|
1579
|
-
plugins: {
|
|
1580
|
-
"@eslint-react": plugins["pluginReact"],
|
|
1581
|
-
"@eslint-react/dom": plugins["pluginReactDom"]
|
|
1582
|
-
},
|
|
1583
|
-
rules: reactTypeCheck ? {
|
|
1584
|
-
// Disables checking an asynchronous function passed as a JSX attribute expected to be a function that returns `void`
|
|
1585
|
-
"@typescript-eslint/no-misused-promises": ["error", {
|
|
1586
|
-
checksVoidReturn: { attributes: false }
|
|
1587
|
-
}],
|
|
1588
|
-
// @eslint-react/eslint-plugin
|
|
1589
|
-
// https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin
|
|
1590
|
-
// pluginReact.configs.['recommended-typescript'].rules
|
|
1591
|
-
"@eslint-react/dom/no-unknown-property": "off",
|
|
1592
|
-
"@eslint-react/no-duplicate-jsx-props": "off",
|
|
1593
|
-
"@eslint-react/use-jsx-vars": "off",
|
|
1594
|
-
// pluginReact.configs.['recommended-type-checked'].rules
|
|
1595
|
-
// https://eslint-react.xyz/docs/rules/no-leaked-conditional-rendering
|
|
1596
|
-
"@eslint-react/no-leaked-conditional-rendering": "error",
|
|
1597
|
-
"@eslint-react/prefer-read-only-props": "warn"
|
|
1598
|
-
} : {}
|
|
1599
|
-
},
|
|
1600
|
-
{
|
|
1601
|
-
files: ["**/*.cts"],
|
|
1602
|
-
rules: {
|
|
1603
|
-
"@typescript-eslint/no-require-imports": "off"
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
];
|
|
1346
|
+
const { isInEditor = false, tsconfigPath = true, tsconfigRootDir = process.cwd(), allowDefaultProject = [], extraFileExtensions = [], reactTypeCheck = false } = options;
|
|
1347
|
+
const files$7 = [
|
|
1348
|
+
GLOB_TS,
|
|
1349
|
+
GLOB_TSX,
|
|
1350
|
+
...extraFileExtensions.map((extension) => `**/*${extension}`)
|
|
1351
|
+
];
|
|
1352
|
+
const extensions$1 = [
|
|
1353
|
+
".cjs",
|
|
1354
|
+
".mjs",
|
|
1355
|
+
".cts",
|
|
1356
|
+
".mts",
|
|
1357
|
+
...defaultExtensions,
|
|
1358
|
+
...extraFileExtensions
|
|
1359
|
+
];
|
|
1360
|
+
if (process.versions["pnp"]) externalModuleFolders.push(".yarn");
|
|
1361
|
+
const tsProjectOptions = tsconfigPath === true ? { projectService: {
|
|
1362
|
+
allowDefaultProject,
|
|
1363
|
+
loadTypeScriptPlugins: isInEditor
|
|
1364
|
+
} } : { project: tsconfigPath };
|
|
1365
|
+
return [
|
|
1366
|
+
{
|
|
1367
|
+
name: name$1.setup,
|
|
1368
|
+
files: files$7,
|
|
1369
|
+
plugins: {
|
|
1370
|
+
"import-x": pluginImportX,
|
|
1371
|
+
"@typescript-eslint": pluginTypescript,
|
|
1372
|
+
antfu: pluginAntfu
|
|
1373
|
+
},
|
|
1374
|
+
languageOptions: {
|
|
1375
|
+
sourceType: "module",
|
|
1376
|
+
ecmaVersion: "latest",
|
|
1377
|
+
parser: parsers_default["parserTypescript"],
|
|
1378
|
+
parserOptions: {
|
|
1379
|
+
ecmaVersion: "latest",
|
|
1380
|
+
extraFileExtensions,
|
|
1381
|
+
jsxPragma: null,
|
|
1382
|
+
...tsProjectOptions,
|
|
1383
|
+
tsconfigRootDir,
|
|
1384
|
+
warnOnUnsupportedTypeScriptVersion: true
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
settings: {
|
|
1388
|
+
"import-x/extensions": extensions$1,
|
|
1389
|
+
"import-x/external-module-folders": externalModuleFolders,
|
|
1390
|
+
"import-x/parsers": { "@typescript-eslint/parser": [
|
|
1391
|
+
".ts",
|
|
1392
|
+
".tsx",
|
|
1393
|
+
".cts",
|
|
1394
|
+
".mts",
|
|
1395
|
+
...extraFileExtensions
|
|
1396
|
+
] },
|
|
1397
|
+
"import-x/resolver-next": [createTypeScriptImportResolver({
|
|
1398
|
+
alwaysTryTypes: true,
|
|
1399
|
+
project: tsconfigPath === true ? void 0 : tsconfigPath,
|
|
1400
|
+
extensions: extensions$1
|
|
1401
|
+
})]
|
|
1402
|
+
}
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
name: name$1.rules,
|
|
1406
|
+
files: files$7,
|
|
1407
|
+
rules: {
|
|
1408
|
+
...configs$1.typescript.rules,
|
|
1409
|
+
...typescriptStrictTypeCheckedRules,
|
|
1410
|
+
...typescriptStylisticTypeCheckedRules,
|
|
1411
|
+
"@typescript-eslint/ban-ts-comment": ["error", {
|
|
1412
|
+
minimumDescriptionLength: 10,
|
|
1413
|
+
"ts-check": false,
|
|
1414
|
+
"ts-expect-error": "allow-with-description",
|
|
1415
|
+
"ts-ignore": true,
|
|
1416
|
+
"ts-nocheck": true
|
|
1417
|
+
}],
|
|
1418
|
+
"@typescript-eslint/naming-convention": [
|
|
1419
|
+
"warn",
|
|
1420
|
+
{
|
|
1421
|
+
selector: "variable",
|
|
1422
|
+
format: [
|
|
1423
|
+
"camelCase",
|
|
1424
|
+
"PascalCase",
|
|
1425
|
+
"UPPER_CASE"
|
|
1426
|
+
],
|
|
1427
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
1428
|
+
trailingUnderscore: "forbid"
|
|
1429
|
+
},
|
|
1430
|
+
{
|
|
1431
|
+
selector: "function",
|
|
1432
|
+
format: ["camelCase", "PascalCase"],
|
|
1433
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
1434
|
+
trailingUnderscore: "forbid"
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
selector: "typeLike",
|
|
1438
|
+
format: ["PascalCase"],
|
|
1439
|
+
leadingUnderscore: "forbid",
|
|
1440
|
+
trailingUnderscore: "forbid"
|
|
1441
|
+
}
|
|
1442
|
+
],
|
|
1443
|
+
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
|
1444
|
+
"antfu/no-ts-export-equal": "error"
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
name: `${name$1.base}/react-type-checked`,
|
|
1449
|
+
files: files$7,
|
|
1450
|
+
plugins: {
|
|
1451
|
+
"@eslint-react": pluginReact,
|
|
1452
|
+
"@eslint-react/dom": pluginReactDom
|
|
1453
|
+
},
|
|
1454
|
+
rules: reactTypeCheck ? {
|
|
1455
|
+
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
|
|
1456
|
+
"@eslint-react/dom/no-unknown-property": "off",
|
|
1457
|
+
"@eslint-react/no-duplicate-jsx-props": "off",
|
|
1458
|
+
"@eslint-react/use-jsx-vars": "off",
|
|
1459
|
+
"@eslint-react/no-leaked-conditional-rendering": "error",
|
|
1460
|
+
"@eslint-react/prefer-read-only-props": "warn"
|
|
1461
|
+
} : {}
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
files: ["**/*.cts"],
|
|
1465
|
+
rules: { "@typescript-eslint/no-require-imports": "off" }
|
|
1466
|
+
}
|
|
1467
|
+
];
|
|
1607
1468
|
}
|
|
1608
1469
|
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region src/configs/unicorn.ts
|
|
1472
|
+
const pluginUnicorn = memo(eslintPluginUnicorn, "eslint-plugin-unicorn");
|
|
1609
1473
|
const name = getFlatConfigName("unicorn");
|
|
1610
1474
|
const files = [GLOB_SRC];
|
|
1611
1475
|
const allFiles = [...GLOB_ALL_SRC];
|
|
1612
1476
|
function unicorn() {
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
}
|
|
1644
|
-
},
|
|
1645
|
-
{
|
|
1646
|
-
name: `${name.rules}/src`,
|
|
1647
|
-
files,
|
|
1648
|
-
rules: {
|
|
1649
|
-
// eslint-plugin-unicorn
|
|
1650
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
1651
|
-
...pluginUnicorn.configs["flat/recommended"].rules
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
];
|
|
1477
|
+
return [
|
|
1478
|
+
{
|
|
1479
|
+
name: `${name.setup}/all-src`,
|
|
1480
|
+
files: allFiles,
|
|
1481
|
+
plugins: { unicorn: pluginUnicorn }
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
name: `${name.setup}/src`,
|
|
1485
|
+
files,
|
|
1486
|
+
languageOptions: { globals: { ...globals$1.builtin } }
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
name: `${name.rules}/all-src`,
|
|
1490
|
+
files: allFiles,
|
|
1491
|
+
rules: { "unicorn/filename-case": ["error", {
|
|
1492
|
+
cases: { kebabCase: true },
|
|
1493
|
+
ignore: [
|
|
1494
|
+
"README.md",
|
|
1495
|
+
"LICENSE.md",
|
|
1496
|
+
"CHANGELOG.md",
|
|
1497
|
+
"CODE_OF_CONDUCT.md"
|
|
1498
|
+
]
|
|
1499
|
+
}] }
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
name: `${name.rules}/src`,
|
|
1503
|
+
files,
|
|
1504
|
+
rules: { ...pluginUnicorn.configs.recommended.rules }
|
|
1505
|
+
}
|
|
1506
|
+
];
|
|
1655
1507
|
}
|
|
1656
1508
|
|
|
1509
|
+
//#endregion
|
|
1510
|
+
//#region src/factory.ts
|
|
1657
1511
|
function enabled(options, defaults = false) {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1512
|
+
if (typeof options === "boolean") return options;
|
|
1513
|
+
if (options === void 0) return defaults;
|
|
1514
|
+
if (options.enable) return true;
|
|
1515
|
+
return defaults;
|
|
1662
1516
|
}
|
|
1663
1517
|
function configOptions(options, defaultOptions) {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1518
|
+
const isInEditor = isInEditorEnv();
|
|
1519
|
+
if (options === void 0) return { isInEditor };
|
|
1520
|
+
if (typeof options === "boolean") return { isInEditor };
|
|
1521
|
+
return {
|
|
1522
|
+
...defaultOptions,
|
|
1523
|
+
...options,
|
|
1524
|
+
isInEditor
|
|
1525
|
+
};
|
|
1668
1526
|
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Construct an array of ESLint flat config items.
|
|
1529
|
+
*
|
|
1530
|
+
* @param options
|
|
1531
|
+
* The options for generating the ESLint configurations.
|
|
1532
|
+
* @param userConfigs
|
|
1533
|
+
* The user configurations to be merged with the generated configurations.
|
|
1534
|
+
* @returns The merged ESLint configurations.
|
|
1535
|
+
*/
|
|
1669
1536
|
async function config(options, ...userConfigs) {
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
)
|
|
1695
|
-
);
|
|
1696
|
-
}
|
|
1697
|
-
if (enabled(options?.react, isPackageExists("next"))) {
|
|
1698
|
-
configs.push(nextJs());
|
|
1699
|
-
}
|
|
1700
|
-
if (enabled(options?.node, isPackageExists("@types/node"))) {
|
|
1701
|
-
configs.push(nodeJs(configOptions(options?.node)));
|
|
1702
|
-
}
|
|
1703
|
-
if (enabled(void 0, isPackageExists("tailwindcss"))) {
|
|
1704
|
-
configs.push(tailwindcss());
|
|
1705
|
-
}
|
|
1706
|
-
configs.push(regexp(), unicorn(), disables());
|
|
1707
|
-
if (enabled(options?.format, isPackageExists("dprint"))) {
|
|
1708
|
-
const jsonOptions = configOptions(options?.json);
|
|
1709
|
-
configs.push(
|
|
1710
|
-
formatters(
|
|
1711
|
-
configOptions(options?.format, {
|
|
1712
|
-
extraJsonFiles: jsonOptions.extraFiles
|
|
1713
|
-
})
|
|
1714
|
-
)
|
|
1715
|
-
);
|
|
1716
|
-
}
|
|
1717
|
-
let composer = new FlatConfigComposer(...configs);
|
|
1718
|
-
const _userConfigs = userConfigs;
|
|
1719
|
-
composer = composer.append(..._userConfigs);
|
|
1720
|
-
return composer;
|
|
1537
|
+
const configs$2 = [];
|
|
1538
|
+
const enableTypeScript = enabled(options?.typescript, isPackageExists("typescript"));
|
|
1539
|
+
const enableReact = enabled(options?.react, isPackageExists("react"));
|
|
1540
|
+
const importsOption = enableTypeScript ? configOptions(options?.typescript) : {};
|
|
1541
|
+
configs$2.push(ignores(options?.ignores), comments(), imports(importsOption));
|
|
1542
|
+
if (enabled(options?.javascript, true)) configs$2.push(javascript(configOptions(options?.javascript)));
|
|
1543
|
+
if (enableTypeScript) configs$2.push(typescript(configOptions(options?.typescript, { reactTypeCheck: enableReact })));
|
|
1544
|
+
if (enabled(options?.json, true)) {
|
|
1545
|
+
const formatOption = configOptions(options?.format, { indentWidth: 2 });
|
|
1546
|
+
configs$2.push(json(configOptions(options?.json, { stylistic: formatOption })));
|
|
1547
|
+
}
|
|
1548
|
+
if (enableReact) configs$2.push(jsx(), react(configOptions(options?.react, { reactCompiler: isPackageExists("babel-plugin-react-compiler") || isPackageExists("react-compiler-webpack") })));
|
|
1549
|
+
if (enabled(options?.react, isPackageExists("next"))) configs$2.push(nextJs());
|
|
1550
|
+
if (enabled(options?.node, isPackageExists("@types/node"))) configs$2.push(nodeJs(configOptions(options?.node)));
|
|
1551
|
+
if (enabled(options?.tailwindcss, isPackageExists("tailwindcss"))) configs$2.push(tailwindcss(configOptions(options?.tailwindcss)));
|
|
1552
|
+
configs$2.push(regexp(), unicorn(), disables());
|
|
1553
|
+
if (enabled(options?.format, isPackageExists("dprint"))) {
|
|
1554
|
+
const jsonOptions = configOptions(options?.json);
|
|
1555
|
+
configs$2.push(formatters(configOptions(options?.format, { extraJsonFiles: jsonOptions.extraFiles })));
|
|
1556
|
+
}
|
|
1557
|
+
let composer = new FlatConfigComposer(...configs$2);
|
|
1558
|
+
const _userConfigs = userConfigs;
|
|
1559
|
+
composer = composer.append(..._userConfigs);
|
|
1560
|
+
return composer;
|
|
1721
1561
|
}
|
|
1722
1562
|
|
|
1723
|
-
|
|
1563
|
+
//#endregion
|
|
1564
|
+
export { combine, comments, config as default, disables, formatters, getFlatConfigName, getPackageJson, globals, ignores, imports, isInEditorEnv, isInGitHooksOrLintStaged, javascript, json, jsx, loadLocalFile, memo, nextJs, nodeJs, react, regexp, tailwindcss, typescript, unicorn };
|