@biscuittin/eslint-config 0.0.6 → 0.0.7

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