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