@dhzh/eslint-config 1.26.0 → 1.27.1

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.cjs CHANGED
@@ -1,1849 +1,1447 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- defineConfig: () => defineConfig4
34
- });
35
- module.exports = __toCommonJS(index_exports);
36
-
37
- // src/configs/react.ts
38
- var import_eslint_plugin = __toESM(require("@eslint-react/eslint-plugin"), 1);
39
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
40
- var import_eslint_plugin_react_refresh = __toESM(require("eslint-plugin-react-refresh"), 1);
41
- var import_eslint_plugin_react_compiler = __toESM(require("eslint-plugin-react-compiler"), 1);
42
- var import_eslint_plugin_react_google_translate = __toESM(require("eslint-plugin-react-google-translate"), 1);
43
- var import_local_pkg = require("local-pkg");
44
- var import_config = require("eslint/config");
45
-
46
- // src/consts.ts
47
- var RULE_PREFIX = "tinywaves";
48
- var GLOB_YML = "**/*.y?(a)ml";
49
- var GLOB_TOML = "**/*.toml";
50
- var GLOB_JSON = "**/*.json";
51
- var GLOB_JSON5 = "**/*.json5";
52
- var GLOB_JSONC = "**/*.jsonc";
53
- var GLOB_PACKAGE_JSON = "**/package.json";
54
- var GLOB_HTML = "**/*.htm?(l)";
55
- var GLOB_CSS = "**/*.css";
56
- var GLOB_POSTCSS = "**/*.{p,post}css";
57
- var GLOB_LESS = "**/*.less";
58
- var GLOB_SCSS = "**/*.scss";
59
- var GLOB_GRAPHQL = "**/*.{g,graph}ql";
60
- var GLOB_XML = "**/*.xml";
61
- var GLOB_SVG = "**/*.svg";
62
- var GLOB_VUE = "**/*.vue";
63
- var GLOB_JSON_SRC = [
64
- GLOB_JSON,
65
- GLOB_JSON5,
66
- GLOB_JSONC,
67
- GLOB_PACKAGE_JSON
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chunk = require("./chunk-CKQMccvm.cjs");
3
+ let _eslint_react_eslint_plugin = require("@eslint-react/eslint-plugin");
4
+ _eslint_react_eslint_plugin = require_chunk.__toESM(_eslint_react_eslint_plugin, 1);
5
+ let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
6
+ eslint_plugin_react_hooks = require_chunk.__toESM(eslint_plugin_react_hooks, 1);
7
+ let eslint_plugin_react_refresh = require("eslint-plugin-react-refresh");
8
+ eslint_plugin_react_refresh = require_chunk.__toESM(eslint_plugin_react_refresh, 1);
9
+ let eslint_plugin_react_compiler = require("eslint-plugin-react-compiler");
10
+ eslint_plugin_react_compiler = require_chunk.__toESM(eslint_plugin_react_compiler, 1);
11
+ let eslint_plugin_react_google_translate = require("eslint-plugin-react-google-translate");
12
+ eslint_plugin_react_google_translate = require_chunk.__toESM(eslint_plugin_react_google_translate, 1);
13
+ let local_pkg = require("local-pkg");
14
+ let eslint_config = require("eslint/config");
15
+ let _eslint_js = require("@eslint/js");
16
+ _eslint_js = require_chunk.__toESM(_eslint_js, 1);
17
+ let typescript_eslint = require("typescript-eslint");
18
+ typescript_eslint = require_chunk.__toESM(typescript_eslint, 1);
19
+ let eslint_plugin_vue = require("eslint-plugin-vue");
20
+ eslint_plugin_vue = require_chunk.__toESM(eslint_plugin_vue, 1);
21
+ let globals = require("globals");
22
+ globals = require_chunk.__toESM(globals, 1);
23
+ let eslint_merge_processors = require("eslint-merge-processors");
24
+ let eslint_processor_vue_blocks = require("eslint-processor-vue-blocks");
25
+ eslint_processor_vue_blocks = require_chunk.__toESM(eslint_processor_vue_blocks, 1);
26
+ let _stylistic_eslint_plugin = require("@stylistic/eslint-plugin");
27
+ _stylistic_eslint_plugin = require_chunk.__toESM(_stylistic_eslint_plugin, 1);
28
+ let eslint_plugin_antfu = require("eslint-plugin-antfu");
29
+ eslint_plugin_antfu = require_chunk.__toESM(eslint_plugin_antfu, 1);
30
+ let node_process = require("node:process");
31
+ node_process = require_chunk.__toESM(node_process, 1);
32
+ let eslint_plugin_n = require("eslint-plugin-n");
33
+ eslint_plugin_n = require_chunk.__toESM(eslint_plugin_n, 1);
34
+ let eslint_plugin_jsonc = require("eslint-plugin-jsonc");
35
+ eslint_plugin_jsonc = require_chunk.__toESM(eslint_plugin_jsonc, 1);
36
+ let eslint_plugin_package_json = require("eslint-plugin-package-json");
37
+ eslint_plugin_package_json = require_chunk.__toESM(eslint_plugin_package_json, 1);
38
+ let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
39
+ eslint_plugin_unicorn = require_chunk.__toESM(eslint_plugin_unicorn, 1);
40
+ let eslint_plugin_import_x = require("eslint-plugin-import-x");
41
+ eslint_plugin_import_x = require_chunk.__toESM(eslint_plugin_import_x, 1);
42
+ let eslint_plugin_unused_imports = require("eslint-plugin-unused-imports");
43
+ eslint_plugin_unused_imports = require_chunk.__toESM(eslint_plugin_unused_imports, 1);
44
+ let eslint_plugin_simple_import_sort = require("eslint-plugin-simple-import-sort");
45
+ eslint_plugin_simple_import_sort = require_chunk.__toESM(eslint_plugin_simple_import_sort, 1);
46
+ let eslint_plugin_format = require("eslint-plugin-format");
47
+ eslint_plugin_format = require_chunk.__toESM(eslint_plugin_format, 1);
48
+ let eslint_plugin_tailwindcss = require("eslint-plugin-tailwindcss");
49
+ eslint_plugin_tailwindcss = require_chunk.__toESM(eslint_plugin_tailwindcss, 1);
50
+ let _unocss_eslint_config_flat = require("@unocss/eslint-config/flat");
51
+ _unocss_eslint_config_flat = require_chunk.__toESM(_unocss_eslint_config_flat, 1);
52
+ let eslint_plugin_yml = require("eslint-plugin-yml");
53
+ eslint_plugin_yml = require_chunk.__toESM(eslint_plugin_yml, 1);
54
+ let eslint_plugin_toml = require("eslint-plugin-toml");
55
+ eslint_plugin_toml = require_chunk.__toESM(eslint_plugin_toml, 1);
56
+ let toml_eslint_parser = require("toml-eslint-parser");
57
+ toml_eslint_parser = require_chunk.__toESM(toml_eslint_parser, 1);
58
+ let eslint_plugin_regexp = require("eslint-plugin-regexp");
59
+ eslint_plugin_regexp = require_chunk.__toESM(eslint_plugin_regexp, 1);
60
+ let _eslint_community_eslint_plugin_eslint_comments_configs = require("@eslint-community/eslint-plugin-eslint-comments/configs");
61
+ _eslint_community_eslint_plugin_eslint_comments_configs = require_chunk.__toESM(_eslint_community_eslint_plugin_eslint_comments_configs, 1);
62
+ //#region src/consts.ts
63
+ const RULE_PREFIX = "tinywaves";
64
+ const GLOB_YML = "**/*.y?(a)ml";
65
+ const GLOB_TOML = "**/*.toml";
66
+ const GLOB_JSON = "**/*.json";
67
+ const GLOB_JSON5 = "**/*.json5";
68
+ const GLOB_JSONC = "**/*.jsonc";
69
+ const GLOB_PACKAGE_JSON = "**/package.json";
70
+ const GLOB_HTML = "**/*.htm?(l)";
71
+ const GLOB_CSS = "**/*.css";
72
+ const GLOB_POSTCSS = "**/*.{p,post}css";
73
+ const GLOB_LESS = "**/*.less";
74
+ const GLOB_SCSS = "**/*.scss";
75
+ const GLOB_GRAPHQL = "**/*.{g,graph}ql";
76
+ const GLOB_XML = "**/*.xml";
77
+ const GLOB_SVG = "**/*.svg";
78
+ const GLOB_VUE = "**/*.vue";
79
+ const GLOB_JSON_SRC = [
80
+ GLOB_JSON,
81
+ GLOB_JSON5,
82
+ GLOB_JSONC,
83
+ GLOB_PACKAGE_JSON
68
84
  ];
69
- var GLOB_TS_SRC = [
70
- "**/*.cts",
71
- "**/*.mts",
72
- "**/*.ts",
73
- "**/*.tsx"
85
+ const GLOB_TS_SRC = [
86
+ "**/*.cts",
87
+ "**/*.mts",
88
+ "**/*.ts",
89
+ "**/*.tsx"
74
90
  ];
75
- var GLOB_JS_SRC = [
76
- "**/*.cjs",
77
- "**/*.mjs",
78
- "**/*.js",
79
- "**/*.jsx"
91
+ const GLOB_JS_SRC = [
92
+ "**/*.cjs",
93
+ "**/*.mjs",
94
+ "**/*.js",
95
+ "**/*.jsx"
80
96
  ];
81
- var GLOB_JSX_SRC = [
82
- "**/*.jsx",
83
- "**/*.tsx"
84
- ];
85
- var GLOB_SRC = [
86
- ...GLOB_TS_SRC,
87
- ...GLOB_JS_SRC
88
- ];
89
- var GLOB_SRC_EXT = GLOB_SRC.map((item) => item.replace("**/*.", ""));
90
- var GLOB_TESTS = GLOB_SRC_EXT.flatMap((item) => [
91
- `**/__tests__/**/*.${item}`,
92
- `**/*.spec.${item}`,
93
- `**/*.test.${item}`,
94
- `**/*.bench.${item}`,
95
- `**/*.benchmark.${item}`
97
+ const GLOB_JSX_SRC = ["**/*.jsx", "**/*.tsx"];
98
+ const GLOB_SRC = [...GLOB_TS_SRC, ...GLOB_JS_SRC];
99
+ const GLOB_SRC_EXT = GLOB_SRC.map((item) => item.replace("**/*.", ""));
100
+ GLOB_SRC_EXT.flatMap((item) => [
101
+ `**/__tests__/**/*.${item}`,
102
+ `**/*.spec.${item}`,
103
+ `**/*.test.${item}`,
104
+ `**/*.bench.${item}`,
105
+ `**/*.benchmark.${item}`
96
106
  ]);
97
- var GLOB_EXCLUDE = [
98
- "**/node_modules",
99
- "**/dist",
100
- "**/package-lock.json",
101
- "**/yarn.lock",
102
- "**/pnpm-lock.yaml",
103
- "**/bun.lockb",
104
- "**/output",
105
- "**/coverage",
106
- "**/temp",
107
- "**/.temp",
108
- "**/tmp",
109
- "**/.tmp",
110
- "**/.history",
111
- "**/.vitepress/cache",
112
- "**/.nuxt",
113
- "**/.next",
114
- "**/.svelte-kit",
115
- "**/.vercel",
116
- "**/.changeset",
117
- "**/.idea",
118
- "**/.cache",
119
- "**/.output",
120
- "**/.vite-inspect",
121
- "**/.yarn",
122
- "**/vite.config.*.timestamp-*",
123
- "**/CHANGELOG*.md",
124
- "**/*.min.*",
125
- "**/LICENSE*",
126
- "**/__snapshots__",
127
- "**/auto-import?(s).d.ts",
128
- "**/components.d.ts"
107
+ const GLOB_EXCLUDE = [
108
+ "**/node_modules",
109
+ "**/dist",
110
+ "**/package-lock.json",
111
+ "**/yarn.lock",
112
+ "**/pnpm-lock.yaml",
113
+ "**/bun.lockb",
114
+ "**/output",
115
+ "**/coverage",
116
+ "**/temp",
117
+ "**/.temp",
118
+ "**/tmp",
119
+ "**/.tmp",
120
+ "**/.history",
121
+ "**/.vitepress/cache",
122
+ "**/.nuxt",
123
+ "**/.next",
124
+ "**/.svelte-kit",
125
+ "**/.vercel",
126
+ "**/.changeset",
127
+ "**/.idea",
128
+ "**/.cache",
129
+ "**/.output",
130
+ "**/.vite-inspect",
131
+ "**/.yarn",
132
+ "**/vite.config.*.timestamp-*",
133
+ "**/CHANGELOG*.md",
134
+ "**/*.min.*",
135
+ "**/LICENSE*",
136
+ "**/__snapshots__",
137
+ "**/auto-import?(s).d.ts",
138
+ "**/components.d.ts"
129
139
  ];
130
-
131
- // src/utils.ts
132
- var parserPlain = {
133
- meta: {
134
- name: "parser-plain"
135
- },
136
- parseForESLint: (code) => ({
137
- ast: {
138
- body: [],
139
- comments: [],
140
- loc: {
141
- end: code.length,
142
- start: 0
143
- },
144
- range: [0, code.length],
145
- tokens: [],
146
- type: "Program"
147
- },
148
- scopeManager: null,
149
- services: {
150
- isPlain: true
151
- },
152
- visitorKeys: {
153
- Program: []
154
- }
155
- })
140
+ //#endregion
141
+ //#region src/utils.ts
142
+ const parserPlain = {
143
+ meta: { name: "parser-plain" },
144
+ parseForESLint: (code) => ({
145
+ ast: {
146
+ body: [],
147
+ comments: [],
148
+ loc: {
149
+ end: code.length,
150
+ start: 0
151
+ },
152
+ range: [0, code.length],
153
+ tokens: [],
154
+ type: "Program"
155
+ },
156
+ scopeManager: null,
157
+ services: { isPlain: true },
158
+ visitorKeys: { Program: [] }
159
+ })
156
160
  };
157
- var mergeRule = (...rules) => {
158
- let finalLevel;
159
- let finalOptions = {};
160
- for (const rule of rules) {
161
- if (!rule) {
162
- continue;
163
- }
164
- if (!Array.isArray(rule)) {
165
- finalLevel = rule;
166
- continue;
167
- }
168
- const [level, options] = rule;
169
- finalLevel = level;
170
- if (options && typeof options === "object") {
171
- finalOptions = {
172
- ...finalOptions,
173
- ...options
174
- };
175
- }
176
- }
177
- if (Object.keys(finalOptions).length === 0) {
178
- return finalLevel;
179
- }
180
- return [finalLevel, finalOptions];
161
+ const mergeRule = (...rules) => {
162
+ let finalLevel;
163
+ let finalOptions = {};
164
+ for (const rule of rules) {
165
+ if (!rule) continue;
166
+ if (!Array.isArray(rule)) {
167
+ finalLevel = rule;
168
+ continue;
169
+ }
170
+ const [level, options] = rule;
171
+ finalLevel = level;
172
+ if (options && typeof options === "object") finalOptions = {
173
+ ...finalOptions,
174
+ ...options
175
+ };
176
+ }
177
+ if (Object.keys(finalOptions).length === 0) return finalLevel;
178
+ return [finalLevel, finalOptions];
181
179
  };
182
-
183
- // src/configs/react.ts
184
- var ReactRefreshAllowConstantExportPackages = ["vite"];
185
- var RemixPackages = [
186
- "@remix-run/node",
187
- "@remix-run/react",
188
- "@remix-run/serve",
189
- "@remix-run/dev"
180
+ //#endregion
181
+ //#region src/configs/react.ts
182
+ const ReactRefreshAllowConstantExportPackages = ["vite"];
183
+ const RemixPackages = [
184
+ "@remix-run/node",
185
+ "@remix-run/react",
186
+ "@remix-run/serve",
187
+ "@remix-run/dev"
190
188
  ];
191
- var ReactRouterPackages = [
192
- "@react-router/node",
193
- "@react-router/react",
194
- "@react-router/serve",
195
- "@react-router/dev"
189
+ const ReactRouterPackages = [
190
+ "@react-router/node",
191
+ "@react-router/react",
192
+ "@react-router/serve",
193
+ "@react-router/dev"
196
194
  ];
197
- var NextJsPackages = ["next"];
198
- var ExpoPackages = ["expo"];
195
+ const NextJsPackages = ["next"];
196
+ const ExpoPackages = ["expo"];
199
197
  function react(options = {}) {
200
- const {
201
- language = "typescript",
202
- overrides = { compiler: {}, core: {}, hooks: {}, refresh: {}, googleTranslate: {} }
203
- } = options;
204
- const config = language === "typescript" ? import_eslint_plugin.default.configs["recommended-type-checked"] : import_eslint_plugin.default.configs.recommended;
205
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, import_local_pkg.isPackageExists)(i));
206
- const isUsingRemix = RemixPackages.some((i) => (0, import_local_pkg.isPackageExists)(i));
207
- const isUsingReactRouter = ReactRouterPackages.some((i) => (0, import_local_pkg.isPackageExists)(i));
208
- const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg.isPackageExists)(i));
209
- const isUsingExpo = ExpoPackages.some((i) => (0, import_local_pkg.isPackageExists)(i));
210
- return [
211
- {
212
- ...config,
213
- name: `${RULE_PREFIX}/react/core/shared`,
214
- files: GLOB_SRC
215
- },
216
- {
217
- name: `${RULE_PREFIX}/react/core/customize`,
218
- files: GLOB_SRC,
219
- rules: {
220
- "@eslint-react/no-missing-context-display-name": "warn",
221
- "@eslint-react/no-missing-component-display-name": "off",
222
- "@eslint-react/dom-no-hydrate": "error",
223
- "@eslint-react/jsx-no-useless-fragment": [
224
- "warn",
225
- {
226
- allowEmptyFragment: true,
227
- allowExpressions: true
228
- }
229
- ],
230
- "@eslint-react/no-unnecessary-use-prefix": "warn",
231
- "@eslint-react/naming-convention-context-name": "warn",
232
- ...language === "typescript" ? {
233
- "@eslint-react/no-leaked-conditional-rendering": "warn"
234
- } : {},
235
- ...overrides.core
236
- }
237
- },
238
- ...(0, import_config.defineConfig)([import_eslint_plugin_react_hooks.default.configs.flat["recommended-latest"]]).map((item) => ({
239
- ...item,
240
- name: `${RULE_PREFIX}/react/hooks/shared`,
241
- files: GLOB_SRC
242
- })),
243
- {
244
- name: `${RULE_PREFIX}/react/hooks/customize`,
245
- files: GLOB_SRC,
246
- rules: overrides.hooks || {}
247
- },
248
- {
249
- ...import_eslint_plugin_react_refresh.default.configs.recommended,
250
- name: `${RULE_PREFIX}/react/refresh/shared`,
251
- files: GLOB_JSX_SRC
252
- },
253
- {
254
- name: `${RULE_PREFIX}/react/refresh/customize`,
255
- files: GLOB_JSX_SRC,
256
- rules: {
257
- "react-refresh/only-export-components": mergeRule(
258
- ["warn", { allowConstantExport: isAllowConstantExport }],
259
- [
260
- "warn",
261
- {
262
- allowExportNames: [
263
- ...isUsingNext ? [
264
- "dynamic",
265
- "dynamicParams",
266
- "revalidate",
267
- "fetchCache",
268
- "runtime",
269
- "preferredRegion",
270
- "maxDuration",
271
- "config",
272
- "generateMetadata",
273
- "generateViewport",
274
- // https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
275
- "experimental_ppr",
276
- // https://nextjs.org/docs/app/api-reference/functions/generate-metadata
277
- "metadata",
278
- // https://nextjs.org/docs/app/api-reference/functions/generate-viewport
279
- "viewport",
280
- // https://nextjs.org/docs/app/api-reference/functions/generate-image-metadata
281
- "generateImageMetadata",
282
- // https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps
283
- "generateSitemaps",
284
- // https://nextjs.org/docs/app/api-reference/functions/generate-static-params
285
- "generateStaticParams"
286
- ] : [],
287
- ...isUsingRemix || isUsingReactRouter ? [
288
- "meta",
289
- "links",
290
- "headers",
291
- "loader",
292
- "action"
293
- ] : [],
294
- ...isUsingExpo ? ["unstable_settings"] : []
295
- ]
296
- }
297
- ]
298
- ),
299
- ...overrides.refresh
300
- }
301
- },
302
- {
303
- ...import_eslint_plugin_react_compiler.default.configs.recommended,
304
- name: `${RULE_PREFIX}/react/compiler/shared`,
305
- files: GLOB_SRC
306
- },
307
- {
308
- name: `${RULE_PREFIX}/react/compiler/customize`,
309
- files: GLOB_SRC,
310
- rules: overrides.compiler || {}
311
- },
312
- {
313
- name: `${RULE_PREFIX}/react/google-translate`,
314
- files: GLOB_JSX_SRC,
315
- plugins: {
316
- "react-google-translate": import_eslint_plugin_react_google_translate.default
317
- },
318
- rules: {
319
- "react-google-translate/no-conditional-text-nodes-with-siblings": "warn",
320
- "react-google-translate/no-return-text-nodes": "warn",
321
- ...overrides.googleTranslate
322
- }
323
- }
324
- ];
198
+ const { language = "typescript", overrides = {
199
+ compiler: {},
200
+ core: {},
201
+ hooks: {},
202
+ refresh: {},
203
+ googleTranslate: {}
204
+ } } = options;
205
+ const config = language === "typescript" ? _eslint_react_eslint_plugin.default.configs["recommended-type-checked"] : _eslint_react_eslint_plugin.default.configs.recommended;
206
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => (0, local_pkg.isPackageExists)(i));
207
+ const isUsingRemix = RemixPackages.some((i) => (0, local_pkg.isPackageExists)(i));
208
+ const isUsingReactRouter = ReactRouterPackages.some((i) => (0, local_pkg.isPackageExists)(i));
209
+ const isUsingNext = NextJsPackages.some((i) => (0, local_pkg.isPackageExists)(i));
210
+ const isUsingExpo = ExpoPackages.some((i) => (0, local_pkg.isPackageExists)(i));
211
+ return [
212
+ {
213
+ ...config,
214
+ name: `${RULE_PREFIX}/react/core/shared`,
215
+ files: GLOB_SRC
216
+ },
217
+ {
218
+ name: `${RULE_PREFIX}/react/core/customize`,
219
+ files: GLOB_SRC,
220
+ rules: {
221
+ "@eslint-react/no-missing-context-display-name": "warn",
222
+ "@eslint-react/no-missing-component-display-name": "off",
223
+ "@eslint-react/dom-no-hydrate": "error",
224
+ "@eslint-react/jsx-no-useless-fragment": ["warn", {
225
+ allowEmptyFragment: true,
226
+ allowExpressions: true
227
+ }],
228
+ "@eslint-react/no-unnecessary-use-prefix": "warn",
229
+ "@eslint-react/naming-convention-context-name": "warn",
230
+ ...language === "typescript" ? { "@eslint-react/no-leaked-conditional-rendering": "warn" } : {},
231
+ ...overrides.core
232
+ }
233
+ },
234
+ ...(0, eslint_config.defineConfig)([eslint_plugin_react_hooks.default.configs.flat["recommended-latest"]]).map((item) => ({
235
+ ...item,
236
+ name: `${RULE_PREFIX}/react/hooks/shared`,
237
+ files: GLOB_SRC
238
+ })),
239
+ {
240
+ name: `${RULE_PREFIX}/react/hooks/customize`,
241
+ files: GLOB_SRC,
242
+ rules: overrides.hooks || {}
243
+ },
244
+ {
245
+ ...eslint_plugin_react_refresh.default.configs.recommended,
246
+ name: `${RULE_PREFIX}/react/refresh/shared`,
247
+ files: GLOB_JSX_SRC
248
+ },
249
+ {
250
+ name: `${RULE_PREFIX}/react/refresh/customize`,
251
+ files: GLOB_JSX_SRC,
252
+ rules: {
253
+ "react-refresh/only-export-components": mergeRule(["warn", { allowConstantExport: isAllowConstantExport }], ["warn", { allowExportNames: [
254
+ ...isUsingNext ? [
255
+ "dynamic",
256
+ "dynamicParams",
257
+ "revalidate",
258
+ "fetchCache",
259
+ "runtime",
260
+ "preferredRegion",
261
+ "maxDuration",
262
+ "config",
263
+ "generateMetadata",
264
+ "generateViewport",
265
+ "experimental_ppr",
266
+ "metadata",
267
+ "viewport",
268
+ "generateImageMetadata",
269
+ "generateSitemaps",
270
+ "generateStaticParams"
271
+ ] : [],
272
+ ...isUsingRemix || isUsingReactRouter ? [
273
+ "meta",
274
+ "links",
275
+ "headers",
276
+ "loader",
277
+ "action"
278
+ ] : [],
279
+ ...isUsingExpo ? ["unstable_settings"] : []
280
+ ] }]),
281
+ ...overrides.refresh
282
+ }
283
+ },
284
+ {
285
+ ...eslint_plugin_react_compiler.default.configs.recommended,
286
+ name: `${RULE_PREFIX}/react/compiler/shared`,
287
+ files: GLOB_SRC
288
+ },
289
+ {
290
+ name: `${RULE_PREFIX}/react/compiler/customize`,
291
+ files: GLOB_SRC,
292
+ rules: overrides.compiler || {}
293
+ },
294
+ {
295
+ name: `${RULE_PREFIX}/react/google-translate`,
296
+ files: GLOB_JSX_SRC,
297
+ plugins: { "react-google-translate": eslint_plugin_react_google_translate.default },
298
+ rules: {
299
+ "react-google-translate/no-conditional-text-nodes-with-siblings": "warn",
300
+ "react-google-translate/no-return-text-nodes": "warn",
301
+ ...overrides.googleTranslate
302
+ }
303
+ }
304
+ ];
325
305
  }
326
-
327
- // src/configs/vue.ts
328
- var import_config2 = require("eslint/config");
329
- var import_js = __toESM(require("@eslint/js"), 1);
330
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
331
- var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
332
- var import_globals = __toESM(require("globals"), 1);
333
- var import_eslint_merge_processors = require("eslint-merge-processors");
334
- var import_eslint_processor_vue_blocks = __toESM(require("eslint-processor-vue-blocks"), 1);
306
+ //#endregion
307
+ //#region src/configs/vue.ts
335
308
  function vue(options = {}) {
336
- const { overrides = {} } = options;
337
- return (0, import_config2.defineConfig)(
338
- {
339
- ...import_js.default.configs.recommended,
340
- name: `${RULE_PREFIX}/vue/shared/javascript`,
341
- files: [GLOB_VUE]
342
- },
343
- import_typescript_eslint.default.configs.recommended.map((item) => ({
344
- ...item,
345
- name: `${RULE_PREFIX}/vue/shared/typescript/${item.name?.replace("typescript-eslint/", "")}`,
346
- files: [GLOB_VUE]
347
- })),
348
- import_eslint_plugin_vue.default.configs["flat/recommended"].map((item) => ({
349
- ...item,
350
- name: `${RULE_PREFIX}/vue/shared/${item.name?.replace("vue/", "")}`,
351
- files: [GLOB_VUE]
352
- })),
353
- {
354
- name: `${RULE_PREFIX}/vue/customize`,
355
- files: [GLOB_VUE],
356
- languageOptions: {
357
- ecmaVersion: "latest",
358
- sourceType: "module",
359
- globals: import_globals.default.browser,
360
- parserOptions: {
361
- parser: import_typescript_eslint.default.parser
362
- }
363
- },
364
- processor: (0, import_eslint_merge_processors.mergeProcessors)([
365
- import_eslint_plugin_vue.default.processors[".vue"],
366
- (0, import_eslint_processor_vue_blocks.default)({
367
- blocks: {
368
- styles: true,
369
- customBlocks: true,
370
- script: false,
371
- template: false
372
- }
373
- })
374
- ]),
375
- rules: overrides
376
- }
377
- );
309
+ const { overrides = {} } = options;
310
+ return (0, eslint_config.defineConfig)({
311
+ ..._eslint_js.default.configs.recommended,
312
+ name: `${RULE_PREFIX}/vue/shared/javascript`,
313
+ files: [GLOB_VUE]
314
+ }, typescript_eslint.default.configs.recommended.map((item) => ({
315
+ ...item,
316
+ name: `${RULE_PREFIX}/vue/shared/typescript/${item.name?.replace("typescript-eslint/", "")}`,
317
+ files: [GLOB_VUE]
318
+ })), eslint_plugin_vue.default.configs["flat/recommended"].map((item) => ({
319
+ ...item,
320
+ name: `${RULE_PREFIX}/vue/shared/${item.name?.replace("vue/", "")}`,
321
+ files: [GLOB_VUE]
322
+ })), {
323
+ name: `${RULE_PREFIX}/vue/customize`,
324
+ files: [GLOB_VUE],
325
+ languageOptions: {
326
+ ecmaVersion: "latest",
327
+ sourceType: "module",
328
+ globals: globals.default.browser,
329
+ parserOptions: { parser: typescript_eslint.default.parser }
330
+ },
331
+ processor: (0, eslint_merge_processors.mergeProcessors)([eslint_plugin_vue.default.processors[".vue"], (0, eslint_processor_vue_blocks.default)({ blocks: {
332
+ styles: true,
333
+ customBlocks: true,
334
+ script: false,
335
+ template: false
336
+ } })]),
337
+ rules: overrides
338
+ });
378
339
  }
379
-
380
- // src/configs/stylistic.ts
381
- var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
382
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
340
+ //#endregion
341
+ //#region src/configs/stylistic.ts
383
342
  function stylistic(options = {}) {
384
- const { overrides = {} } = options;
385
- const jsxIgnoreNodes = [
386
- "TemplateLiteral *",
387
- "TSUnionType",
388
- "TSIntersectionType",
389
- "TSTypeParameterInstantiation",
390
- "FunctionExpression > .params[decorators.length > 0]",
391
- "FunctionExpression > .params > :matches(Decorator, :not(:first-child))"
392
- ];
393
- const nonJsxIgnoreNodes = [
394
- "JSXOpeningElement",
395
- "JSXClosingElement"
396
- ];
397
- const basicIndentRuleOptions = {
398
- ArrayExpression: 1,
399
- CallExpression: {
400
- arguments: 1
401
- },
402
- flatTernaryExpressions: false,
403
- FunctionDeclaration: {
404
- body: 1,
405
- parameters: 1
406
- },
407
- FunctionExpression: {
408
- body: 1,
409
- parameters: 1
410
- },
411
- ignoreComments: false,
412
- ImportDeclaration: 1,
413
- MemberExpression: 1,
414
- ObjectExpression: 1,
415
- offsetTernaryExpressions: true,
416
- outerIIFEBody: 1,
417
- SwitchCase: 1,
418
- VariableDeclarator: 1
419
- };
420
- return [
421
- {
422
- ...import_eslint_plugin2.default.configs.customize({
423
- arrowParens: true,
424
- semi: true,
425
- braceStyle: "1tbs"
426
- }),
427
- name: `${RULE_PREFIX}/stylistic/shared`,
428
- files: [...GLOB_SRC, ...GLOB_JSON_SRC, GLOB_VUE]
429
- },
430
- {
431
- name: `${RULE_PREFIX}/stylistic/customize`,
432
- files: [...GLOB_SRC, ...GLOB_JSON_SRC, GLOB_VUE],
433
- plugins: {
434
- stylistic: import_eslint_plugin2.default,
435
- antfu: import_eslint_plugin_antfu.default
436
- },
437
- rules: {
438
- "curly": ["error", "all"],
439
- "object-shorthand": "error",
440
- "prefer-destructuring": [
441
- "error",
442
- {
443
- VariableDeclarator: {
444
- array: false,
445
- object: true
446
- },
447
- AssignmentExpression: {
448
- array: false,
449
- object: false
450
- }
451
- },
452
- {
453
- enforceForRenamedProperties: false
454
- }
455
- ],
456
- "prefer-template": "error",
457
- "stylistic/array-bracket-newline": [
458
- "error",
459
- {
460
- multiline: true
461
- }
462
- ],
463
- "stylistic/array-element-newline": ["error", "consistent"],
464
- "stylistic/brace-style": [
465
- "error",
466
- "1tbs",
467
- {
468
- allowSingleLine: false
469
- }
470
- ],
471
- "stylistic/function-call-spacing": ["error", "never"],
472
- "stylistic/function-paren-newline": "off",
473
- "stylistic/indent": [
474
- "error",
475
- 2,
476
- {
477
- ...basicIndentRuleOptions,
478
- ignoredNodes: [
479
- ...jsxIgnoreNodes,
480
- ...nonJsxIgnoreNodes
481
- ]
482
- }
483
- ],
484
- "stylistic/key-spacing": [
485
- "error",
486
- {
487
- beforeColon: false,
488
- afterColon: true,
489
- mode: "strict"
490
- }
491
- ],
492
- "stylistic/keyword-spacing": [
493
- "error",
494
- {
495
- before: true,
496
- after: true
497
- }
498
- ],
499
- "stylistic/line-comment-position": "off",
500
- "stylistic/linebreak-style": ["error", "unix"],
501
- "stylistic/lines-around-comment": "off",
502
- "stylistic/new-parens": ["error", "always"],
503
- "stylistic/no-confusing-arrow": [
504
- "error",
505
- {
506
- allowParens: true,
507
- onlyOneSimpleParam: true
508
- }
509
- ],
510
- "stylistic/no-extra-semi": "error",
511
- "stylistic/object-property-newline": [
512
- "error",
513
- {
514
- allowAllPropertiesOnSameLine: true
515
- }
516
- ],
517
- "stylistic/space-before-function-paren": [
518
- "error",
519
- {
520
- named: "never",
521
- anonymous: "always",
522
- asyncArrow: "always",
523
- catch: "always"
524
- }
525
- ],
526
- "stylistic/switch-colon-spacing": [
527
- "error",
528
- {
529
- after: true,
530
- before: false
531
- }
532
- ],
533
- "stylistic/type-annotation-spacing": "error",
534
- "stylistic/wrap-regex": "error",
535
- "stylistic/quotes": [
536
- "error",
537
- "single",
538
- {
539
- allowTemplateLiterals: true,
540
- avoidEscape: true
541
- }
542
- ],
543
- "stylistic/no-tabs": "off",
544
- "antfu/consistent-chaining": "error",
545
- "antfu/consistent-list-newline": "error",
546
- "antfu/top-level-function": "off",
547
- "antfu/curly": "off",
548
- ...overrides
549
- }
550
- },
551
- {
552
- name: `${RULE_PREFIX}/stylistic/customize/jsx`,
553
- files: [...GLOB_JSX_SRC, GLOB_VUE],
554
- plugins: {
555
- stylistic: import_eslint_plugin2.default
556
- },
557
- rules: {
558
- "stylistic/indent": [
559
- "error",
560
- 2,
561
- {
562
- ...basicIndentRuleOptions,
563
- ignoredNodes: jsxIgnoreNodes
564
- }
565
- ],
566
- "stylistic/jsx-closing-bracket-location": [
567
- "error",
568
- {
569
- nonEmpty: "tag-aligned",
570
- selfClosing: "tag-aligned"
571
- }
572
- ],
573
- "stylistic/jsx-closing-tag-location": ["error", "tag-aligned"],
574
- "stylistic/jsx-curly-brace-presence": [
575
- "error",
576
- {
577
- props: "never",
578
- children: "never",
579
- propElementValues: "always"
580
- }
581
- ],
582
- "stylistic/jsx-curly-newline": [
583
- "error",
584
- {
585
- singleline: "consistent",
586
- multiline: "consistent"
587
- }
588
- ],
589
- "stylistic/jsx-curly-spacing": [
590
- "error",
591
- {
592
- when: "never",
593
- attributes: {
594
- when: "never"
595
- },
596
- children: {
597
- when: "never"
598
- }
599
- }
600
- ],
601
- "stylistic/jsx-first-prop-new-line": ["error", "multiline"],
602
- "stylistic/jsx-one-expression-per-line": [
603
- "error",
604
- {
605
- allow: "non-jsx"
606
- }
607
- ],
608
- "stylistic/jsx-pascal-case": [
609
- "error",
610
- {
611
- allowAllCaps: false,
612
- allowLeadingUnderscore: false,
613
- allowNamespace: true
614
- }
615
- ],
616
- "stylistic/jsx-props-no-multi-spaces": "error",
617
- "stylistic/jsx-quotes": ["error", "prefer-double"],
618
- "stylistic/jsx-self-closing-comp": [
619
- "error",
620
- {
621
- component: true,
622
- html: true
623
- }
624
- ],
625
- "stylistic/jsx-sort-props": "off",
626
- "stylistic/jsx-indent-props": "off",
627
- ...overrides
628
- }
629
- }
630
- ];
343
+ const { overrides = {} } = options;
344
+ const jsxIgnoreNodes = [
345
+ "TemplateLiteral *",
346
+ "TSUnionType",
347
+ "TSIntersectionType",
348
+ "TSTypeParameterInstantiation",
349
+ "FunctionExpression > .params[decorators.length > 0]",
350
+ "FunctionExpression > .params > :matches(Decorator, :not(:first-child))"
351
+ ];
352
+ const nonJsxIgnoreNodes = ["JSXOpeningElement", "JSXClosingElement"];
353
+ const basicIndentRuleOptions = {
354
+ ArrayExpression: 1,
355
+ CallExpression: { arguments: 1 },
356
+ flatTernaryExpressions: false,
357
+ FunctionDeclaration: {
358
+ body: 1,
359
+ parameters: 1
360
+ },
361
+ FunctionExpression: {
362
+ body: 1,
363
+ parameters: 1
364
+ },
365
+ ignoreComments: false,
366
+ ImportDeclaration: 1,
367
+ MemberExpression: 1,
368
+ ObjectExpression: 1,
369
+ offsetTernaryExpressions: true,
370
+ outerIIFEBody: 1,
371
+ SwitchCase: 1,
372
+ VariableDeclarator: 1
373
+ };
374
+ return [
375
+ {
376
+ ..._stylistic_eslint_plugin.default.configs.customize({
377
+ arrowParens: true,
378
+ semi: true,
379
+ braceStyle: "1tbs"
380
+ }),
381
+ name: `${RULE_PREFIX}/stylistic/shared`,
382
+ files: [
383
+ ...GLOB_SRC,
384
+ ...GLOB_JSON_SRC,
385
+ GLOB_VUE
386
+ ]
387
+ },
388
+ {
389
+ name: `${RULE_PREFIX}/stylistic/customize`,
390
+ files: [
391
+ ...GLOB_SRC,
392
+ ...GLOB_JSON_SRC,
393
+ GLOB_VUE
394
+ ],
395
+ plugins: {
396
+ stylistic: _stylistic_eslint_plugin.default,
397
+ antfu: eslint_plugin_antfu.default
398
+ },
399
+ rules: {
400
+ "curly": ["error", "all"],
401
+ "object-shorthand": "error",
402
+ "prefer-destructuring": [
403
+ "error",
404
+ {
405
+ VariableDeclarator: {
406
+ array: false,
407
+ object: true
408
+ },
409
+ AssignmentExpression: {
410
+ array: false,
411
+ object: false
412
+ }
413
+ },
414
+ { enforceForRenamedProperties: false }
415
+ ],
416
+ "prefer-template": "error",
417
+ "stylistic/array-bracket-newline": ["error", { multiline: true }],
418
+ "stylistic/array-element-newline": ["error", "consistent"],
419
+ "stylistic/brace-style": [
420
+ "error",
421
+ "1tbs",
422
+ { allowSingleLine: false }
423
+ ],
424
+ "stylistic/function-call-spacing": ["error", "never"],
425
+ "stylistic/function-paren-newline": "off",
426
+ "stylistic/indent": [
427
+ "error",
428
+ 2,
429
+ {
430
+ ...basicIndentRuleOptions,
431
+ ignoredNodes: [...jsxIgnoreNodes, ...nonJsxIgnoreNodes]
432
+ }
433
+ ],
434
+ "stylistic/key-spacing": ["error", {
435
+ beforeColon: false,
436
+ afterColon: true,
437
+ mode: "strict"
438
+ }],
439
+ "stylistic/keyword-spacing": ["error", {
440
+ before: true,
441
+ after: true
442
+ }],
443
+ "stylistic/line-comment-position": "off",
444
+ "stylistic/linebreak-style": ["error", "unix"],
445
+ "stylistic/lines-around-comment": "off",
446
+ "stylistic/new-parens": ["error", "always"],
447
+ "stylistic/no-confusing-arrow": ["error", {
448
+ allowParens: true,
449
+ onlyOneSimpleParam: true
450
+ }],
451
+ "stylistic/no-extra-semi": "error",
452
+ "stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
453
+ "stylistic/space-before-function-paren": ["error", {
454
+ named: "never",
455
+ anonymous: "always",
456
+ asyncArrow: "always",
457
+ catch: "always"
458
+ }],
459
+ "stylistic/switch-colon-spacing": ["error", {
460
+ after: true,
461
+ before: false
462
+ }],
463
+ "stylistic/type-annotation-spacing": "error",
464
+ "stylistic/wrap-regex": "error",
465
+ "stylistic/quotes": [
466
+ "error",
467
+ "single",
468
+ {
469
+ allowTemplateLiterals: true,
470
+ avoidEscape: true
471
+ }
472
+ ],
473
+ "stylistic/no-tabs": "off",
474
+ "antfu/consistent-chaining": "error",
475
+ "antfu/consistent-list-newline": "error",
476
+ "antfu/top-level-function": "off",
477
+ "antfu/curly": "off",
478
+ ...overrides
479
+ }
480
+ },
481
+ {
482
+ name: `${RULE_PREFIX}/stylistic/customize/jsx`,
483
+ files: [...GLOB_JSX_SRC, GLOB_VUE],
484
+ plugins: { stylistic: _stylistic_eslint_plugin.default },
485
+ rules: {
486
+ "stylistic/indent": [
487
+ "error",
488
+ 2,
489
+ {
490
+ ...basicIndentRuleOptions,
491
+ ignoredNodes: jsxIgnoreNodes
492
+ }
493
+ ],
494
+ "stylistic/jsx-closing-bracket-location": ["error", {
495
+ nonEmpty: "tag-aligned",
496
+ selfClosing: "tag-aligned"
497
+ }],
498
+ "stylistic/jsx-closing-tag-location": ["error", "tag-aligned"],
499
+ "stylistic/jsx-curly-brace-presence": ["error", {
500
+ props: "never",
501
+ children: "never",
502
+ propElementValues: "always"
503
+ }],
504
+ "stylistic/jsx-curly-newline": ["error", {
505
+ singleline: "consistent",
506
+ multiline: "consistent"
507
+ }],
508
+ "stylistic/jsx-curly-spacing": ["error", {
509
+ when: "never",
510
+ attributes: { when: "never" },
511
+ children: { when: "never" }
512
+ }],
513
+ "stylistic/jsx-first-prop-new-line": ["error", "multiline"],
514
+ "stylistic/jsx-one-expression-per-line": ["error", { allow: "non-jsx" }],
515
+ "stylistic/jsx-pascal-case": ["error", {
516
+ allowAllCaps: false,
517
+ allowLeadingUnderscore: false,
518
+ allowNamespace: true
519
+ }],
520
+ "stylistic/jsx-props-no-multi-spaces": "error",
521
+ "stylistic/jsx-quotes": ["error", "prefer-double"],
522
+ "stylistic/jsx-self-closing-comp": ["error", {
523
+ component: true,
524
+ html: true
525
+ }],
526
+ "stylistic/jsx-sort-props": "off",
527
+ "stylistic/jsx-indent-props": "off",
528
+ ...overrides
529
+ }
530
+ }
531
+ ];
631
532
  }
632
-
633
- // src/configs/typescript.ts
634
- var import_node_process = __toESM(require("process"), 1);
635
- var import_config3 = require("eslint/config");
636
- var import_typescript_eslint2 = __toESM(require("typescript-eslint"), 1);
533
+ //#endregion
534
+ //#region src/configs/typescript.ts
637
535
  function typescript(options = {}) {
638
- const { overrides = {}, typeSafe = false, strict = false } = options;
639
- return [
640
- ...(0, import_config3.defineConfig)(
641
- import_typescript_eslint2.default.configs.base,
642
- import_typescript_eslint2.default.configs.recommendedTypeChecked,
643
- import_typescript_eslint2.default.configs.strictTypeChecked,
644
- import_typescript_eslint2.default.configs.stylisticTypeChecked
645
- ).map((item) => ({
646
- ...item,
647
- name: `${RULE_PREFIX}/typescript/shared/${item.name?.replace("typescript-eslint/", "")}`,
648
- files: GLOB_TS_SRC
649
- })),
650
- {
651
- name: `${RULE_PREFIX}/typescript/customize`,
652
- files: GLOB_TS_SRC,
653
- languageOptions: {
654
- parserOptions: {
655
- projectService: true,
656
- tsconfigRootDir: import_node_process.default.cwd()
657
- },
658
- sourceType: "module"
659
- },
660
- rules: {
661
- "@typescript-eslint/consistent-type-imports": [
662
- "error",
663
- {
664
- disallowTypeAnnotations: false
665
- }
666
- ],
667
- "@typescript-eslint/no-import-type-side-effects": "error",
668
- "@typescript-eslint/method-signature-style": ["error", "property"],
669
- "no-unused-expressions": "off",
670
- "@typescript-eslint/no-unused-expressions": [
671
- "error",
672
- {
673
- allowShortCircuit: true,
674
- allowTernary: true
675
- }
676
- ],
677
- "@typescript-eslint/no-dynamic-delete": "off",
678
- "@typescript-eslint/no-empty-object-type": [
679
- "error",
680
- {
681
- allowInterfaces: "with-single-extends",
682
- allowObjectTypes: "never",
683
- allowWithName: "Props$"
684
- }
685
- ],
686
- "@typescript-eslint/no-non-null-assertion": "off",
687
- "@typescript-eslint/ban-ts-comment": "off",
688
- "@typescript-eslint/no-explicit-any": "off",
689
- "@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
690
- "@typescript-eslint/await-thenable": "error",
691
- "@typescript-eslint/no-floating-promises": "error",
692
- "@typescript-eslint/consistent-type-exports": "error",
693
- "@typescript-eslint/no-misused-promises": [
694
- "error",
695
- {
696
- checksVoidReturn: {
697
- arguments: false,
698
- attributes: false
699
- }
700
- }
701
- ],
702
- "@typescript-eslint/restrict-template-expressions": ["error", {}],
703
- "@typescript-eslint/no-deprecated": "warn",
704
- "@typescript-eslint/no-empty-function": "off",
705
- "@typescript-eslint/consistent-type-definitions": "off",
706
- "@typescript-eslint/array-type": [
707
- "error",
708
- {
709
- default: "array-simple"
710
- }
711
- ],
712
- "@typescript-eslint/prefer-nullish-coalescing": "off",
713
- "@typescript-eslint/no-confusing-void-expression": [
714
- "error",
715
- {
716
- ignoreArrowShorthand: true
717
- }
718
- ],
719
- ...typeSafe ? {} : {
720
- "@typescript-eslint/no-unsafe-assignment": "off",
721
- "@typescript-eslint/no-unsafe-member-access": "off",
722
- "@typescript-eslint/no-unsafe-call": "off",
723
- "@typescript-eslint/no-unsafe-return": "off",
724
- "@typescript-eslint/no-unsafe-argument": "off"
725
- },
726
- ...strict ? {} : {
727
- "@typescript-eslint/no-extraneous-class": "off"
728
- },
729
- ...overrides
730
- }
731
- }
732
- ];
536
+ const { overrides = {}, typeSafe = false, strict = false } = options;
537
+ return [...(0, eslint_config.defineConfig)(typescript_eslint.default.configs.base, typescript_eslint.default.configs.recommendedTypeChecked, typescript_eslint.default.configs.strictTypeChecked, typescript_eslint.default.configs.stylisticTypeChecked).map((item) => ({
538
+ ...item,
539
+ name: `${RULE_PREFIX}/typescript/shared/${item.name?.replace("typescript-eslint/", "")}`,
540
+ files: GLOB_TS_SRC
541
+ })), {
542
+ name: `${RULE_PREFIX}/typescript/customize`,
543
+ files: GLOB_TS_SRC,
544
+ languageOptions: {
545
+ parserOptions: {
546
+ projectService: true,
547
+ tsconfigRootDir: node_process.default.cwd()
548
+ },
549
+ sourceType: "module"
550
+ },
551
+ rules: {
552
+ "@typescript-eslint/consistent-type-imports": ["error", { disallowTypeAnnotations: false }],
553
+ "@typescript-eslint/no-import-type-side-effects": "error",
554
+ "@typescript-eslint/method-signature-style": ["error", "property"],
555
+ "no-unused-expressions": "off",
556
+ "@typescript-eslint/no-unused-expressions": ["error", {
557
+ allowShortCircuit: true,
558
+ allowTernary: true
559
+ }],
560
+ "@typescript-eslint/no-dynamic-delete": "off",
561
+ "@typescript-eslint/no-empty-object-type": ["error", {
562
+ allowInterfaces: "with-single-extends",
563
+ allowObjectTypes: "never",
564
+ allowWithName: "Props$"
565
+ }],
566
+ "@typescript-eslint/no-non-null-assertion": "off",
567
+ "@typescript-eslint/ban-ts-comment": "off",
568
+ "@typescript-eslint/no-explicit-any": "off",
569
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
570
+ "@typescript-eslint/await-thenable": "error",
571
+ "@typescript-eslint/no-floating-promises": "error",
572
+ "@typescript-eslint/consistent-type-exports": "error",
573
+ "@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: {
574
+ arguments: false,
575
+ attributes: false
576
+ } }],
577
+ "@typescript-eslint/restrict-template-expressions": ["error", {}],
578
+ "@typescript-eslint/no-deprecated": "warn",
579
+ "@typescript-eslint/no-empty-function": "off",
580
+ "@typescript-eslint/consistent-type-definitions": "off",
581
+ "@typescript-eslint/array-type": ["error", { default: "array-simple" }],
582
+ "@typescript-eslint/prefer-nullish-coalescing": "off",
583
+ "@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
584
+ ...typeSafe ? {} : {
585
+ "@typescript-eslint/no-unsafe-assignment": "off",
586
+ "@typescript-eslint/no-unsafe-member-access": "off",
587
+ "@typescript-eslint/no-unsafe-call": "off",
588
+ "@typescript-eslint/no-unsafe-return": "off",
589
+ "@typescript-eslint/no-unsafe-argument": "off"
590
+ },
591
+ ...strict ? {} : { "@typescript-eslint/no-extraneous-class": "off" },
592
+ ...overrides
593
+ }
594
+ }];
733
595
  }
734
-
735
- // src/configs/javascript.ts
736
- var import_js2 = __toESM(require("@eslint/js"), 1);
737
- var import_eslint_plugin_antfu2 = __toESM(require("eslint-plugin-antfu"), 1);
738
- var import_globals2 = __toESM(require("globals"), 1);
596
+ //#endregion
597
+ //#region src/configs/javascript.ts
739
598
  function javascript(options = {}) {
740
- const { overrides = {} } = options;
741
- return [
742
- {
743
- name: `${RULE_PREFIX}/javascript/shared`,
744
- files: GLOB_SRC,
745
- languageOptions: {
746
- ecmaVersion: 2022,
747
- globals: {
748
- ...import_globals2.default.browser,
749
- ...import_globals2.default.es2021,
750
- ...import_globals2.default.node,
751
- document: "readonly",
752
- navigator: "readonly",
753
- window: "readonly"
754
- },
755
- parserOptions: {
756
- ecmaFeatures: {
757
- jsx: true
758
- },
759
- ecmaVersion: 2022,
760
- sourceType: "module"
761
- },
762
- sourceType: "module"
763
- },
764
- linterOptions: {
765
- reportUnusedDisableDirectives: true
766
- },
767
- rules: import_js2.default.configs.recommended.rules
768
- },
769
- {
770
- name: `${RULE_PREFIX}/javascript/customize`,
771
- files: GLOB_SRC,
772
- plugins: {
773
- antfu: import_eslint_plugin_antfu2.default
774
- },
775
- rules: {
776
- "arrow-body-style": ["error", "as-needed"],
777
- "func-style": [
778
- "warn",
779
- "declaration",
780
- {
781
- allowArrowFunctions: true
782
- }
783
- ],
784
- "no-empty-function": "off",
785
- "prefer-destructuring": "off",
786
- "capitalized-comments": "off",
787
- "id-length": "off",
788
- "accessor-pairs": [
789
- "error",
790
- {
791
- enforceForClassMembers: true,
792
- setWithoutGet: true
793
- }
794
- ],
795
- "antfu/no-top-level-await": "error",
796
- // https://x.com/karlhorky/status/1773632485055680875
797
- "array-callback-return": "error",
798
- "block-scoped-var": "error",
799
- "constructor-super": "error",
800
- "default-case-last": "error",
801
- "dot-notation": [
802
- "error",
803
- {
804
- allowKeywords: true
805
- }
806
- ],
807
- "eqeqeq": ["error", "smart"],
808
- "new-cap": [
809
- "error",
810
- {
811
- capIsNew: false,
812
- newIsCap: true,
813
- properties: true
814
- }
815
- ],
816
- "no-alert": "error",
817
- "no-array-constructor": "error",
818
- "no-async-promise-executor": "error",
819
- "no-caller": "error",
820
- "no-case-declarations": "error",
821
- "no-class-assign": "error",
822
- "no-compare-neg-zero": "error",
823
- "no-cond-assign": ["error", "always"],
824
- "no-console": [
825
- "error",
826
- {
827
- allow: ["warn", "error", "info"]
828
- }
829
- ],
830
- "no-const-assign": "error",
831
- "no-control-regex": "error",
832
- "no-debugger": "error",
833
- "no-delete-var": "error",
834
- "no-dupe-args": "error",
835
- "no-dupe-class-members": "error",
836
- "no-dupe-keys": "error",
837
- "no-duplicate-case": "error",
838
- "no-empty": [
839
- "error",
840
- {
841
- allowEmptyCatch: true
842
- }
843
- ],
844
- "no-empty-character-class": "error",
845
- "no-empty-pattern": "error",
846
- "no-eval": "error",
847
- "no-ex-assign": "error",
848
- "no-extend-native": "error",
849
- "no-extra-bind": "error",
850
- "no-extra-boolean-cast": "error",
851
- "no-fallthrough": "error",
852
- "no-func-assign": "error",
853
- "no-global-assign": "error",
854
- "no-implied-eval": "error",
855
- "no-import-assign": "error",
856
- "no-invalid-regexp": "error",
857
- "no-irregular-whitespace": "error",
858
- "no-iterator": "error",
859
- "no-labels": [
860
- "error",
861
- {
862
- allowLoop: false,
863
- allowSwitch: false
864
- }
865
- ],
866
- "no-lone-blocks": "error",
867
- "no-loss-of-precision": "error",
868
- "no-misleading-character-class": "error",
869
- "no-multi-str": "error",
870
- "no-new": "error",
871
- "no-new-func": "error",
872
- "no-new-native-nonconstructor": "error",
873
- "no-new-wrappers": "error",
874
- "no-obj-calls": "error",
875
- "no-octal": "error",
876
- "no-octal-escape": "error",
877
- // https://twitter.com/ryanflorence/status/1786394911895683512
878
- "no-param-reassign": "warn",
879
- "no-proto": "error",
880
- "no-prototype-builtins": "error",
881
- "no-redeclare": [
882
- "error",
883
- {
884
- builtinGlobals: false
885
- }
886
- ],
887
- "no-regex-spaces": "error",
888
- "no-restricted-globals": [
889
- "error",
890
- {
891
- message: "Use `globalThis` instead.",
892
- name: "global"
893
- },
894
- {
895
- message: "Use `globalThis` instead.",
896
- name: "self"
897
- }
898
- ],
899
- "no-restricted-properties": [
900
- "error",
901
- {
902
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
903
- property: "__proto__"
904
- },
905
- {
906
- message: "Use `Object.defineProperty` instead.",
907
- property: "__defineGetter__"
908
- },
909
- {
910
- message: "Use `Object.defineProperty` instead.",
911
- property: "__defineSetter__"
912
- },
913
- {
914
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
915
- property: "__lookupGetter__"
916
- },
917
- {
918
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
919
- property: "__lookupSetter__"
920
- }
921
- ],
922
- "no-restricted-syntax": [
923
- "error",
924
- "TSEnumDeclaration[const=true]",
925
- "TSExportAssignment"
926
- ],
927
- "no-self-assign": [
928
- "error",
929
- {
930
- props: true
931
- }
932
- ],
933
- "no-self-compare": "error",
934
- "no-sequences": "error",
935
- "no-shadow-restricted-names": "error",
936
- "no-sparse-arrays": "error",
937
- "no-template-curly-in-string": "error",
938
- "no-this-before-super": "error",
939
- "no-throw-literal": "error",
940
- "no-undef": "error",
941
- "no-undef-init": "error",
942
- "no-unexpected-multiline": "error",
943
- "no-unmodified-loop-condition": "error",
944
- "no-unneeded-ternary": [
945
- "error",
946
- {
947
- defaultAssignment: false
948
- }
949
- ],
950
- "no-unreachable": "error",
951
- "no-unreachable-loop": "error",
952
- "no-unsafe-finally": "error",
953
- "no-unsafe-negation": "error",
954
- "no-unused-expressions": [
955
- "error",
956
- {
957
- allowShortCircuit: true,
958
- allowTaggedTemplates: true,
959
- allowTernary: true
960
- }
961
- ],
962
- "no-unused-vars": [
963
- "error",
964
- {
965
- args: "none",
966
- caughtErrors: "none",
967
- ignoreRestSiblings: true,
968
- vars: "all"
969
- }
970
- ],
971
- "no-use-before-define": [
972
- "error",
973
- {
974
- classes: false,
975
- functions: false,
976
- variables: true
977
- }
978
- ],
979
- "no-useless-backreference": "error",
980
- "no-useless-call": "error",
981
- "no-useless-catch": "error",
982
- "no-useless-computed-key": "error",
983
- "no-useless-constructor": "error",
984
- "no-useless-rename": "error",
985
- "no-useless-return": "error",
986
- "no-var": "error",
987
- "no-with": "error",
988
- "object-shorthand": [
989
- "error",
990
- "always",
991
- {
992
- avoidQuotes: true,
993
- ignoreConstructors: false
994
- }
995
- ],
996
- "one-var": [
997
- "error",
998
- {
999
- initialized: "never"
1000
- }
1001
- ],
1002
- "prefer-arrow-callback": [
1003
- "error",
1004
- {
1005
- allowNamedFunctions: false,
1006
- allowUnboundThis: true
1007
- }
1008
- ],
1009
- "prefer-const": [
1010
- "error",
1011
- {
1012
- destructuring: "all",
1013
- ignoreReadBeforeAssign: true
1014
- }
1015
- ],
1016
- "prefer-exponentiation-operator": "error",
1017
- "prefer-promise-reject-errors": "error",
1018
- "prefer-regex-literals": [
1019
- "error",
1020
- {
1021
- disallowRedundantWrapping: true
1022
- }
1023
- ],
1024
- "prefer-rest-params": "error",
1025
- "prefer-spread": "error",
1026
- "prefer-template": "error",
1027
- "symbol-description": "error",
1028
- "unicode-bom": ["error", "never"],
1029
- "use-isnan": [
1030
- "error",
1031
- {
1032
- enforceForIndexOf: true,
1033
- enforceForSwitchCase: true
1034
- }
1035
- ],
1036
- "valid-typeof": [
1037
- "error",
1038
- {
1039
- requireStringLiterals: true
1040
- }
1041
- ],
1042
- "vars-on-top": "error",
1043
- "yoda": ["error", "never"],
1044
- ...overrides
1045
- }
1046
- }
1047
- ];
599
+ const { overrides = {} } = options;
600
+ return [{
601
+ name: `${RULE_PREFIX}/javascript/shared`,
602
+ files: GLOB_SRC,
603
+ languageOptions: {
604
+ ecmaVersion: 2022,
605
+ globals: {
606
+ ...globals.default.browser,
607
+ ...globals.default.es2021,
608
+ ...globals.default.node,
609
+ document: "readonly",
610
+ navigator: "readonly",
611
+ window: "readonly"
612
+ },
613
+ parserOptions: {
614
+ ecmaFeatures: { jsx: true },
615
+ ecmaVersion: 2022,
616
+ sourceType: "module"
617
+ },
618
+ sourceType: "module"
619
+ },
620
+ linterOptions: { reportUnusedDisableDirectives: true },
621
+ rules: _eslint_js.default.configs.recommended.rules
622
+ }, {
623
+ name: `${RULE_PREFIX}/javascript/customize`,
624
+ files: GLOB_SRC,
625
+ plugins: { antfu: eslint_plugin_antfu.default },
626
+ rules: {
627
+ "arrow-body-style": ["error", "as-needed"],
628
+ "func-style": [
629
+ "warn",
630
+ "declaration",
631
+ { allowArrowFunctions: true }
632
+ ],
633
+ "no-empty-function": "off",
634
+ "prefer-destructuring": "off",
635
+ "capitalized-comments": "off",
636
+ "id-length": "off",
637
+ "accessor-pairs": ["error", {
638
+ enforceForClassMembers: true,
639
+ setWithoutGet: true
640
+ }],
641
+ "antfu/no-top-level-await": "error",
642
+ "array-callback-return": "error",
643
+ "block-scoped-var": "error",
644
+ "constructor-super": "error",
645
+ "default-case-last": "error",
646
+ "dot-notation": ["error", { allowKeywords: true }],
647
+ "eqeqeq": ["error", "smart"],
648
+ "new-cap": ["error", {
649
+ capIsNew: false,
650
+ newIsCap: true,
651
+ properties: true
652
+ }],
653
+ "no-alert": "error",
654
+ "no-array-constructor": "error",
655
+ "no-async-promise-executor": "error",
656
+ "no-caller": "error",
657
+ "no-case-declarations": "error",
658
+ "no-class-assign": "error",
659
+ "no-compare-neg-zero": "error",
660
+ "no-cond-assign": ["error", "always"],
661
+ "no-console": ["error", { allow: [
662
+ "warn",
663
+ "error",
664
+ "info"
665
+ ] }],
666
+ "no-const-assign": "error",
667
+ "no-control-regex": "error",
668
+ "no-debugger": "error",
669
+ "no-delete-var": "error",
670
+ "no-dupe-args": "error",
671
+ "no-dupe-class-members": "error",
672
+ "no-dupe-keys": "error",
673
+ "no-duplicate-case": "error",
674
+ "no-empty": ["error", { allowEmptyCatch: true }],
675
+ "no-empty-character-class": "error",
676
+ "no-empty-pattern": "error",
677
+ "no-eval": "error",
678
+ "no-ex-assign": "error",
679
+ "no-extend-native": "error",
680
+ "no-extra-bind": "error",
681
+ "no-extra-boolean-cast": "error",
682
+ "no-fallthrough": "error",
683
+ "no-func-assign": "error",
684
+ "no-global-assign": "error",
685
+ "no-implied-eval": "error",
686
+ "no-import-assign": "error",
687
+ "no-invalid-regexp": "error",
688
+ "no-irregular-whitespace": "error",
689
+ "no-iterator": "error",
690
+ "no-labels": ["error", {
691
+ allowLoop: false,
692
+ allowSwitch: false
693
+ }],
694
+ "no-lone-blocks": "error",
695
+ "no-loss-of-precision": "error",
696
+ "no-misleading-character-class": "error",
697
+ "no-multi-str": "error",
698
+ "no-new": "error",
699
+ "no-new-func": "error",
700
+ "no-new-native-nonconstructor": "error",
701
+ "no-new-wrappers": "error",
702
+ "no-obj-calls": "error",
703
+ "no-octal": "error",
704
+ "no-octal-escape": "error",
705
+ "no-param-reassign": "warn",
706
+ "no-proto": "error",
707
+ "no-prototype-builtins": "error",
708
+ "no-redeclare": ["error", { builtinGlobals: false }],
709
+ "no-regex-spaces": "error",
710
+ "no-restricted-globals": [
711
+ "error",
712
+ {
713
+ message: "Use `globalThis` instead.",
714
+ name: "global"
715
+ },
716
+ {
717
+ message: "Use `globalThis` instead.",
718
+ name: "self"
719
+ }
720
+ ],
721
+ "no-restricted-properties": [
722
+ "error",
723
+ {
724
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
725
+ property: "__proto__"
726
+ },
727
+ {
728
+ message: "Use `Object.defineProperty` instead.",
729
+ property: "__defineGetter__"
730
+ },
731
+ {
732
+ message: "Use `Object.defineProperty` instead.",
733
+ property: "__defineSetter__"
734
+ },
735
+ {
736
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
737
+ property: "__lookupGetter__"
738
+ },
739
+ {
740
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
741
+ property: "__lookupSetter__"
742
+ }
743
+ ],
744
+ "no-restricted-syntax": [
745
+ "error",
746
+ "TSEnumDeclaration[const=true]",
747
+ "TSExportAssignment"
748
+ ],
749
+ "no-self-assign": ["error", { props: true }],
750
+ "no-self-compare": "error",
751
+ "no-sequences": "error",
752
+ "no-shadow-restricted-names": "error",
753
+ "no-sparse-arrays": "error",
754
+ "no-template-curly-in-string": "error",
755
+ "no-this-before-super": "error",
756
+ "no-throw-literal": "error",
757
+ "no-undef": "error",
758
+ "no-undef-init": "error",
759
+ "no-unexpected-multiline": "error",
760
+ "no-unmodified-loop-condition": "error",
761
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
762
+ "no-unreachable": "error",
763
+ "no-unreachable-loop": "error",
764
+ "no-unsafe-finally": "error",
765
+ "no-unsafe-negation": "error",
766
+ "no-unused-expressions": ["error", {
767
+ allowShortCircuit: true,
768
+ allowTaggedTemplates: true,
769
+ allowTernary: true
770
+ }],
771
+ "no-unused-vars": ["error", {
772
+ args: "none",
773
+ caughtErrors: "none",
774
+ ignoreRestSiblings: true,
775
+ vars: "all"
776
+ }],
777
+ "no-use-before-define": ["error", {
778
+ classes: false,
779
+ functions: false,
780
+ variables: true
781
+ }],
782
+ "no-useless-backreference": "error",
783
+ "no-useless-call": "error",
784
+ "no-useless-catch": "error",
785
+ "no-useless-computed-key": "error",
786
+ "no-useless-constructor": "error",
787
+ "no-useless-rename": "error",
788
+ "no-useless-return": "error",
789
+ "no-var": "error",
790
+ "no-with": "error",
791
+ "object-shorthand": [
792
+ "error",
793
+ "always",
794
+ {
795
+ avoidQuotes: true,
796
+ ignoreConstructors: false
797
+ }
798
+ ],
799
+ "one-var": ["error", { initialized: "never" }],
800
+ "prefer-arrow-callback": ["error", {
801
+ allowNamedFunctions: false,
802
+ allowUnboundThis: true
803
+ }],
804
+ "prefer-const": ["error", {
805
+ destructuring: "all",
806
+ ignoreReadBeforeAssign: true
807
+ }],
808
+ "prefer-exponentiation-operator": "error",
809
+ "prefer-promise-reject-errors": "error",
810
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
811
+ "prefer-rest-params": "error",
812
+ "prefer-spread": "error",
813
+ "prefer-template": "error",
814
+ "symbol-description": "error",
815
+ "unicode-bom": ["error", "never"],
816
+ "use-isnan": ["error", {
817
+ enforceForIndexOf: true,
818
+ enforceForSwitchCase: true
819
+ }],
820
+ "valid-typeof": ["error", { requireStringLiterals: true }],
821
+ "vars-on-top": "error",
822
+ "yoda": ["error", "never"],
823
+ ...overrides
824
+ }
825
+ }];
1048
826
  }
1049
-
1050
- // src/configs/node.ts
1051
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
827
+ //#endregion
828
+ //#region src/configs/node.ts
1052
829
  function node(options = {}) {
1053
- const { overrides = {} } = options;
1054
- const config = import_eslint_plugin_n.default.configs["flat/recommended"];
1055
- return [
1056
- {
1057
- ...config,
1058
- name: `${RULE_PREFIX}/node/shared`,
1059
- files: GLOB_SRC
1060
- },
1061
- {
1062
- name: `${RULE_PREFIX}/node/customize`,
1063
- files: GLOB_SRC,
1064
- rules: {
1065
- "n/handle-callback-err": ["error", "^(err|error)$"],
1066
- "n/no-new-require": "error",
1067
- "n/no-path-concat": "error",
1068
- "n/prefer-global/buffer": ["error", "never"],
1069
- "n/prefer-global/process": ["error", "never"],
1070
- "n/no-missing-import": "off",
1071
- ...overrides
1072
- }
1073
- }
1074
- ];
830
+ const { overrides = {} } = options;
831
+ return [{
832
+ ...eslint_plugin_n.default.configs["flat/recommended"],
833
+ name: `${RULE_PREFIX}/node/shared`,
834
+ files: GLOB_SRC
835
+ }, {
836
+ name: `${RULE_PREFIX}/node/customize`,
837
+ files: GLOB_SRC,
838
+ rules: {
839
+ "n/handle-callback-err": ["error", "^(err|error)$"],
840
+ "n/no-new-require": "error",
841
+ "n/no-path-concat": "error",
842
+ "n/prefer-global/buffer": ["error", "never"],
843
+ "n/prefer-global/process": ["error", "never"],
844
+ "n/no-missing-import": "off",
845
+ ...overrides
846
+ }
847
+ }];
1075
848
  }
1076
-
1077
- // src/configs/json.ts
1078
- var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
1079
- var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
849
+ //#endregion
850
+ //#region src/configs/json.ts
1080
851
  function json(options = {}) {
1081
- const {
1082
- overrides = { core: {}, packageJson: {} },
1083
- indent = 2,
1084
- packageJsonRequireType = true
1085
- } = options;
1086
- return [
1087
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-json"].map((item) => ({
1088
- ...item,
1089
- name: `${RULE_PREFIX}/json/shared/json`,
1090
- files: [GLOB_JSON]
1091
- })),
1092
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].map((item) => ({
1093
- ...item,
1094
- name: `${RULE_PREFIX}/json/shared/jsonc`,
1095
- files: [GLOB_JSONC]
1096
- })),
1097
- ...import_eslint_plugin_jsonc.default.configs["recommended-with-json5"].map((item) => ({
1098
- ...item,
1099
- name: `${RULE_PREFIX}/json/shared/json5`,
1100
- files: [GLOB_JSON5]
1101
- })),
1102
- {
1103
- name: `${RULE_PREFIX}/json/customize`,
1104
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
1105
- rules: {
1106
- "jsonc/array-bracket-spacing": ["error", "never"],
1107
- "jsonc/comma-dangle": ["error", "never"],
1108
- "jsonc/comma-style": ["error", "last"],
1109
- "jsonc/indent": ["error", indent],
1110
- "jsonc/no-comments": "off",
1111
- "jsonc/key-spacing": [
1112
- "error",
1113
- {
1114
- afterColon: true,
1115
- beforeColon: false
1116
- }
1117
- ],
1118
- "jsonc/object-curly-newline": [
1119
- "error",
1120
- {
1121
- consistent: true,
1122
- multiline: true
1123
- }
1124
- ],
1125
- "jsonc/object-curly-spacing": ["error", "always"],
1126
- "jsonc/quote-props": "error",
1127
- "jsonc/quotes": "error",
1128
- "jsonc/no-bigint-literals": "error",
1129
- "jsonc/object-property-newline": [
1130
- "error",
1131
- {
1132
- allowMultiplePropertiesPerLine: true
1133
- }
1134
- ],
1135
- "jsonc/no-binary-expression": "error",
1136
- "jsonc/no-binary-numeric-literals": "error",
1137
- "jsonc/no-dupe-keys": "error",
1138
- "jsonc/no-escape-sequence-in-identifier": "error",
1139
- "jsonc/no-floating-decimal": "error",
1140
- "jsonc/no-hexadecimal-numeric-literals": "error",
1141
- "jsonc/no-infinity": "error",
1142
- "jsonc/no-multi-str": "error",
1143
- "jsonc/no-nan": "error",
1144
- "jsonc/no-number-props": "error",
1145
- "jsonc/no-numeric-separators": "error",
1146
- "jsonc/no-octal": "error",
1147
- "jsonc/no-octal-escape": "error",
1148
- "jsonc/no-octal-numeric-literals": "error",
1149
- "jsonc/no-parenthesized": "error",
1150
- "jsonc/no-plus-sign": "error",
1151
- "jsonc/no-regexp-literals": "error",
1152
- "jsonc/no-sparse-arrays": "error",
1153
- "jsonc/no-template-literals": "error",
1154
- "jsonc/no-undefined-value": "error",
1155
- "jsonc/no-unicode-codepoint-escapes": "error",
1156
- "jsonc/no-useless-escape": "error",
1157
- "jsonc/space-unary-ops": "error",
1158
- "jsonc/valid-json-number": "error",
1159
- "jsonc/vue-custom-block/no-parsing-error": "error",
1160
- ...overrides.core
1161
- }
1162
- },
1163
- {
1164
- ...import_eslint_plugin_package_json.default.configs.recommended,
1165
- name: `${RULE_PREFIX}/json/shared/package.json`,
1166
- files: [GLOB_PACKAGE_JSON]
1167
- },
1168
- {
1169
- name: `${RULE_PREFIX}/json/customize/package.json`,
1170
- files: [GLOB_PACKAGE_JSON],
1171
- rules: {
1172
- "package-json/order-properties": [
1173
- "error",
1174
- {
1175
- order: [
1176
- "publisher",
1177
- "name",
1178
- "displayName",
1179
- "type",
1180
- "version",
1181
- "private",
1182
- "packageManager",
1183
- "description",
1184
- "author",
1185
- "contributors",
1186
- "license",
1187
- "funding",
1188
- "homepage",
1189
- "repository",
1190
- "bugs",
1191
- "keywords",
1192
- "categories",
1193
- "sideEffects",
1194
- "exports",
1195
- "main",
1196
- "module",
1197
- "unpkg",
1198
- "jsdelivr",
1199
- "types",
1200
- "typesVersions",
1201
- "bin",
1202
- "icon",
1203
- "files",
1204
- "engines",
1205
- "activationEvents",
1206
- "contributes",
1207
- "scripts",
1208
- "release-it",
1209
- "peerDependencies",
1210
- "peerDependenciesMeta",
1211
- "dependencies",
1212
- "optionalDependencies",
1213
- "devDependencies",
1214
- "pnpm",
1215
- "overrides",
1216
- "resolutions",
1217
- "husky",
1218
- "simple-git-hooks",
1219
- "lint-staged",
1220
- "eslintConfig"
1221
- ]
1222
- }
1223
- ],
1224
- "package-json/require-type": packageJsonRequireType ? "error" : "off",
1225
- ...overrides.packageJson
1226
- }
1227
- }
1228
- ];
852
+ const { overrides = {
853
+ core: {},
854
+ packageJson: {}
855
+ }, indent = 2, packageJsonRequireType = true } = options;
856
+ return [
857
+ ...eslint_plugin_jsonc.default.configs["recommended-with-json"].map((item) => ({
858
+ ...item,
859
+ name: `${RULE_PREFIX}/json/shared/json`,
860
+ files: [GLOB_JSON]
861
+ })),
862
+ ...eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].map((item) => ({
863
+ ...item,
864
+ name: `${RULE_PREFIX}/json/shared/jsonc`,
865
+ files: [GLOB_JSONC]
866
+ })),
867
+ ...eslint_plugin_jsonc.default.configs["recommended-with-json5"].map((item) => ({
868
+ ...item,
869
+ name: `${RULE_PREFIX}/json/shared/json5`,
870
+ files: [GLOB_JSON5]
871
+ })),
872
+ {
873
+ name: `${RULE_PREFIX}/json/customize`,
874
+ files: [
875
+ GLOB_JSON,
876
+ GLOB_JSON5,
877
+ GLOB_JSONC
878
+ ],
879
+ rules: {
880
+ "jsonc/array-bracket-spacing": ["error", "never"],
881
+ "jsonc/comma-dangle": ["error", "never"],
882
+ "jsonc/comma-style": ["error", "last"],
883
+ "jsonc/indent": ["error", indent],
884
+ "jsonc/no-comments": "off",
885
+ "jsonc/key-spacing": ["error", {
886
+ afterColon: true,
887
+ beforeColon: false
888
+ }],
889
+ "jsonc/object-curly-newline": ["error", {
890
+ consistent: true,
891
+ multiline: true
892
+ }],
893
+ "jsonc/object-curly-spacing": ["error", "always"],
894
+ "jsonc/quote-props": "error",
895
+ "jsonc/quotes": "error",
896
+ "jsonc/no-bigint-literals": "error",
897
+ "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
898
+ "jsonc/no-binary-expression": "error",
899
+ "jsonc/no-binary-numeric-literals": "error",
900
+ "jsonc/no-dupe-keys": "error",
901
+ "jsonc/no-escape-sequence-in-identifier": "error",
902
+ "jsonc/no-floating-decimal": "error",
903
+ "jsonc/no-hexadecimal-numeric-literals": "error",
904
+ "jsonc/no-infinity": "error",
905
+ "jsonc/no-multi-str": "error",
906
+ "jsonc/no-nan": "error",
907
+ "jsonc/no-number-props": "error",
908
+ "jsonc/no-numeric-separators": "error",
909
+ "jsonc/no-octal": "error",
910
+ "jsonc/no-octal-escape": "error",
911
+ "jsonc/no-octal-numeric-literals": "error",
912
+ "jsonc/no-parenthesized": "error",
913
+ "jsonc/no-plus-sign": "error",
914
+ "jsonc/no-regexp-literals": "error",
915
+ "jsonc/no-sparse-arrays": "error",
916
+ "jsonc/no-template-literals": "error",
917
+ "jsonc/no-undefined-value": "error",
918
+ "jsonc/no-unicode-codepoint-escapes": "error",
919
+ "jsonc/no-useless-escape": "error",
920
+ "jsonc/space-unary-ops": "error",
921
+ "jsonc/valid-json-number": "error",
922
+ "jsonc/vue-custom-block/no-parsing-error": "error",
923
+ ...overrides.core
924
+ }
925
+ },
926
+ {
927
+ ...eslint_plugin_package_json.default.configs.recommended,
928
+ name: `${RULE_PREFIX}/json/shared/package.json`,
929
+ files: [GLOB_PACKAGE_JSON]
930
+ },
931
+ {
932
+ name: `${RULE_PREFIX}/json/customize/package.json`,
933
+ files: [GLOB_PACKAGE_JSON],
934
+ rules: {
935
+ "package-json/order-properties": ["error", { order: [
936
+ "publisher",
937
+ "name",
938
+ "displayName",
939
+ "type",
940
+ "version",
941
+ "private",
942
+ "packageManager",
943
+ "description",
944
+ "author",
945
+ "contributors",
946
+ "license",
947
+ "funding",
948
+ "homepage",
949
+ "repository",
950
+ "bugs",
951
+ "keywords",
952
+ "categories",
953
+ "sideEffects",
954
+ "exports",
955
+ "main",
956
+ "module",
957
+ "unpkg",
958
+ "jsdelivr",
959
+ "types",
960
+ "typesVersions",
961
+ "bin",
962
+ "icon",
963
+ "files",
964
+ "engines",
965
+ "activationEvents",
966
+ "contributes",
967
+ "scripts",
968
+ "release-it",
969
+ "peerDependencies",
970
+ "peerDependenciesMeta",
971
+ "dependencies",
972
+ "optionalDependencies",
973
+ "devDependencies",
974
+ "pnpm",
975
+ "overrides",
976
+ "resolutions",
977
+ "husky",
978
+ "simple-git-hooks",
979
+ "lint-staged",
980
+ "eslintConfig"
981
+ ] }],
982
+ "package-json/require-type": packageJsonRequireType ? "error" : "off",
983
+ ...overrides.packageJson
984
+ }
985
+ }
986
+ ];
1229
987
  }
1230
-
1231
- // src/configs/unicorn.ts
1232
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
988
+ //#endregion
989
+ //#region src/configs/unicorn.ts
1233
990
  function unicorn(options = {}) {
1234
- const { overrides = {} } = options;
1235
- return [
1236
- {
1237
- ...import_eslint_plugin_unicorn.default.configs.recommended,
1238
- name: `${RULE_PREFIX}/unicorn/shared`,
1239
- files: GLOB_SRC
1240
- },
1241
- {
1242
- name: `${RULE_PREFIX}/unicorn/customize`,
1243
- files: GLOB_SRC,
1244
- rules: {
1245
- // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1109#issuecomment-782689255
1246
- "unicorn/consistent-destructuring": "off",
1247
- "unicorn/prevent-abbreviations": "off",
1248
- // https://github.com/orgs/web-infra-dev/discussions/10
1249
- "unicorn/prefer-top-level-await": "off",
1250
- "unicorn/no-unreadable-array-destructuring": "off",
1251
- // https://github.com/sindresorhus/meta/discussions/7
1252
- "unicorn/no-null": "off",
1253
- "unicorn/consistent-empty-array-spread": "error",
1254
- "unicorn/error-message": "error",
1255
- "unicorn/escape-case": "error",
1256
- "unicorn/no-hex-escape": "error",
1257
- "unicorn/new-for-builtins": "error",
1258
- "unicorn/no-instanceof-builtins": "error",
1259
- "unicorn/no-new-array": "error",
1260
- "unicorn/no-new-buffer": "error",
1261
- "unicorn/number-literal-case": "error",
1262
- "unicorn/prefer-dom-node-text-content": "error",
1263
- "unicorn/prefer-includes": "error",
1264
- "unicorn/prefer-node-protocol": "error",
1265
- "unicorn/prefer-query-selector": "off",
1266
- "unicorn/prefer-number-properties": "error",
1267
- "unicorn/prefer-string-starts-ends-with": "error",
1268
- "unicorn/prefer-type-error": "error",
1269
- "unicorn/throw-new-error": "error",
1270
- ...overrides
1271
- }
1272
- }
1273
- ];
991
+ const { overrides = {} } = options;
992
+ return [{
993
+ ...eslint_plugin_unicorn.default.configs.recommended,
994
+ name: `${RULE_PREFIX}/unicorn/shared`,
995
+ files: GLOB_SRC
996
+ }, {
997
+ name: `${RULE_PREFIX}/unicorn/customize`,
998
+ files: GLOB_SRC,
999
+ rules: {
1000
+ "unicorn/consistent-destructuring": "off",
1001
+ "unicorn/prevent-abbreviations": "off",
1002
+ "unicorn/prefer-top-level-await": "off",
1003
+ "unicorn/no-unreadable-array-destructuring": "off",
1004
+ "unicorn/no-null": "off",
1005
+ "unicorn/consistent-empty-array-spread": "error",
1006
+ "unicorn/error-message": "error",
1007
+ "unicorn/escape-case": "error",
1008
+ "unicorn/no-hex-escape": "error",
1009
+ "unicorn/new-for-builtins": "error",
1010
+ "unicorn/no-instanceof-builtins": "error",
1011
+ "unicorn/no-new-array": "error",
1012
+ "unicorn/no-new-buffer": "error",
1013
+ "unicorn/number-literal-case": "error",
1014
+ "unicorn/prefer-dom-node-text-content": "error",
1015
+ "unicorn/prefer-includes": "error",
1016
+ "unicorn/prefer-node-protocol": "error",
1017
+ "unicorn/prefer-query-selector": "off",
1018
+ "unicorn/prefer-number-properties": "error",
1019
+ "unicorn/prefer-string-starts-ends-with": "error",
1020
+ "unicorn/prefer-type-error": "error",
1021
+ "unicorn/throw-new-error": "error",
1022
+ ...overrides
1023
+ }
1024
+ }];
1274
1025
  }
1275
-
1276
- // src/configs/imports.ts
1277
- var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
1278
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
1279
- var import_eslint_plugin_antfu3 = __toESM(require("eslint-plugin-antfu"), 1);
1280
- var import_eslint_plugin_simple_import_sort = __toESM(require("eslint-plugin-simple-import-sort"), 1);
1026
+ //#endregion
1027
+ //#region src/configs/imports.ts
1281
1028
  function imports(options = {}) {
1282
- const { overrides = {}, closeOrder = true } = options;
1283
- return [
1284
- {
1285
- name: `${RULE_PREFIX}/imports/customize`,
1286
- files: GLOB_SRC,
1287
- plugins: {
1288
- "antfu": import_eslint_plugin_antfu3.default,
1289
- "import-x": import_eslint_plugin_import_x.default,
1290
- "unused-imports": import_eslint_plugin_unused_imports.default,
1291
- "simple-import-sort": import_eslint_plugin_simple_import_sort.default
1292
- },
1293
- rules: {
1294
- "sort-imports": "off",
1295
- "no-unused-vars": "off",
1296
- "no-duplicate-imports": "off",
1297
- "@typescript-eslint/no-unused-vars": "off",
1298
- "antfu/import-dedupe": "error",
1299
- "antfu/no-import-dist": "error",
1300
- "antfu/no-import-node-modules-by-path": "error",
1301
- "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
1302
- "import-x/first": "error",
1303
- "import-x/no-duplicates": "error",
1304
- "import-x/no-mutable-exports": "error",
1305
- "import-x/no-named-default": "error",
1306
- "import-x/no-self-import": "error",
1307
- "import-x/no-webpack-loader-syntax": "error",
1308
- "import-x/order": "off",
1309
- "import-x/newline-after-import": [
1310
- "error",
1311
- {
1312
- count: 1
1313
- }
1314
- ],
1315
- "unused-imports/no-unused-imports": "warn",
1316
- "unused-imports/no-unused-vars": [
1317
- "error",
1318
- {
1319
- args: "after-used",
1320
- argsIgnorePattern: "^_",
1321
- ignoreRestSiblings: true,
1322
- vars: "all",
1323
- varsIgnorePattern: "^_"
1324
- }
1325
- ],
1326
- "simple-import-sort/imports": closeOrder ? "off" : "error",
1327
- "simple-import-sort/exports": closeOrder ? "off" : "error",
1328
- ...overrides
1329
- }
1330
- }
1331
- ];
1029
+ const { overrides = {}, closeOrder = true } = options;
1030
+ return [{
1031
+ name: `${RULE_PREFIX}/imports/customize`,
1032
+ files: GLOB_SRC,
1033
+ plugins: {
1034
+ "antfu": eslint_plugin_antfu.default,
1035
+ "import-x": eslint_plugin_import_x.default,
1036
+ "unused-imports": eslint_plugin_unused_imports.default,
1037
+ "simple-import-sort": eslint_plugin_simple_import_sort.default
1038
+ },
1039
+ rules: {
1040
+ "sort-imports": "off",
1041
+ "no-unused-vars": "off",
1042
+ "no-duplicate-imports": "off",
1043
+ "@typescript-eslint/no-unused-vars": "off",
1044
+ "antfu/import-dedupe": "error",
1045
+ "antfu/no-import-dist": "error",
1046
+ "antfu/no-import-node-modules-by-path": "error",
1047
+ "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
1048
+ "import-x/first": "error",
1049
+ "import-x/no-duplicates": "error",
1050
+ "import-x/no-mutable-exports": "error",
1051
+ "import-x/no-named-default": "error",
1052
+ "import-x/no-self-import": "error",
1053
+ "import-x/no-webpack-loader-syntax": "error",
1054
+ "import-x/order": "off",
1055
+ "import-x/newline-after-import": ["error", { count: 1 }],
1056
+ "unused-imports/no-unused-imports": "warn",
1057
+ "unused-imports/no-unused-vars": ["error", {
1058
+ args: "after-used",
1059
+ argsIgnorePattern: "^_",
1060
+ ignoreRestSiblings: true,
1061
+ vars: "all",
1062
+ varsIgnorePattern: "^_"
1063
+ }],
1064
+ "simple-import-sort/imports": closeOrder ? "off" : "error",
1065
+ "simple-import-sort/exports": closeOrder ? "off" : "error",
1066
+ ...overrides
1067
+ }
1068
+ }];
1332
1069
  }
1333
-
1334
- // src/configs/format.ts
1335
- var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
1336
- var mergePrettierOptions = (options, overrides) => ({
1337
- ...options,
1338
- ...overrides,
1339
- plugins: [...overrides.plugins || []]
1070
+ //#endregion
1071
+ //#region src/configs/format.ts
1072
+ const mergePrettierOptions = (options, overrides) => ({
1073
+ ...options,
1074
+ ...overrides,
1075
+ plugins: [...overrides.plugins || []]
1340
1076
  });
1341
1077
  function format(options = {}) {
1342
- const {
1343
- enable = {
1344
- html: true,
1345
- css: true,
1346
- graphql: true,
1347
- xml: true,
1348
- svg: true
1349
- },
1350
- customPrettierOptions = {}
1351
- } = options;
1352
- const configs2 = [];
1353
- if (!enable) {
1354
- return configs2;
1355
- }
1356
- const prettierOptions = Object.assign(
1357
- {
1358
- printWidth: 120,
1359
- tabWidth: 2,
1360
- semi: true,
1361
- singleQuote: true,
1362
- quoteProps: "consistent",
1363
- jsxSingleQuote: false,
1364
- trailingComma: "all",
1365
- bracketSpacing: true,
1366
- bracketSameLine: false,
1367
- arrowParens: "always",
1368
- useTabs: false,
1369
- endOfLine: "lf",
1370
- singleAttributePerLine: false
1371
- },
1372
- customPrettierOptions
1373
- );
1374
- const prettierXmlOptions = {
1375
- xmlQuoteAttributes: "double",
1376
- xmlSelfClosingSpace: true,
1377
- xmlSortAttributesByKey: false,
1378
- xmlWhitespaceSensitivity: "ignore"
1379
- };
1380
- configs2.push({
1381
- name: `${RULE_PREFIX}/format`,
1382
- plugins: {
1383
- format: import_eslint_plugin_format.default
1384
- }
1385
- });
1386
- if (enable.html) {
1387
- configs2.push({
1388
- name: `${RULE_PREFIX}/format/html`,
1389
- files: [GLOB_HTML],
1390
- languageOptions: {
1391
- parser: parserPlain
1392
- },
1393
- rules: {
1394
- "format/prettier": [
1395
- "error",
1396
- mergePrettierOptions(prettierOptions, {
1397
- parser: "html"
1398
- })
1399
- ]
1400
- }
1401
- });
1402
- }
1403
- if (enable.css) {
1404
- configs2.push(
1405
- {
1406
- name: `${RULE_PREFIX}/format/css`,
1407
- files: [GLOB_CSS, GLOB_POSTCSS],
1408
- languageOptions: {
1409
- parser: parserPlain
1410
- },
1411
- rules: {
1412
- "format/prettier": [
1413
- "error",
1414
- mergePrettierOptions(prettierOptions, {
1415
- parser: "css"
1416
- })
1417
- ]
1418
- }
1419
- },
1420
- {
1421
- name: `${RULE_PREFIX}/format/scss`,
1422
- files: [GLOB_SCSS],
1423
- languageOptions: {
1424
- parser: parserPlain
1425
- },
1426
- rules: {
1427
- "format/prettier": [
1428
- "error",
1429
- mergePrettierOptions(prettierOptions, {
1430
- parser: "scss"
1431
- })
1432
- ]
1433
- }
1434
- },
1435
- {
1436
- name: `${RULE_PREFIX}/format/less`,
1437
- files: [GLOB_LESS],
1438
- languageOptions: {
1439
- parser: parserPlain
1440
- },
1441
- rules: {
1442
- "format/prettier": [
1443
- "error",
1444
- mergePrettierOptions(prettierOptions, {
1445
- parser: "less"
1446
- })
1447
- ]
1448
- }
1449
- }
1450
- );
1451
- }
1452
- if (enable.graphql) {
1453
- configs2.push({
1454
- name: `${RULE_PREFIX}/format/graphql`,
1455
- files: [GLOB_GRAPHQL],
1456
- languageOptions: {
1457
- parser: parserPlain
1458
- },
1459
- rules: {
1460
- "format/prettier": [
1461
- "error",
1462
- mergePrettierOptions(prettierOptions, {
1463
- parser: "graphql"
1464
- })
1465
- ]
1466
- }
1467
- });
1468
- }
1469
- if (enable.xml) {
1470
- configs2.push({
1471
- name: `${RULE_PREFIX}/format/xml`,
1472
- files: [GLOB_XML],
1473
- languageOptions: {
1474
- parser: parserPlain
1475
- },
1476
- rules: {
1477
- "format/prettier": [
1478
- "error",
1479
- mergePrettierOptions(
1480
- {
1481
- ...prettierXmlOptions,
1482
- ...prettierOptions
1483
- },
1484
- {
1485
- parser: "xml",
1486
- plugins: ["@prettier/plugin-xml"]
1487
- }
1488
- )
1489
- ]
1490
- }
1491
- });
1492
- }
1493
- if (enable.svg) {
1494
- configs2.push({
1495
- name: `${RULE_PREFIX}/format/svg`,
1496
- files: [GLOB_SVG],
1497
- languageOptions: {
1498
- parser: parserPlain
1499
- },
1500
- rules: {
1501
- "format/prettier": [
1502
- "error",
1503
- mergePrettierOptions(
1504
- {
1505
- ...prettierXmlOptions,
1506
- ...prettierOptions
1507
- },
1508
- {
1509
- parser: "xml",
1510
- plugins: ["@prettier/plugin-xml"]
1511
- }
1512
- )
1513
- ]
1514
- }
1515
- });
1516
- }
1517
- return configs2;
1078
+ const { enable = {
1079
+ html: true,
1080
+ css: true,
1081
+ graphql: true,
1082
+ xml: true,
1083
+ svg: true
1084
+ }, customPrettierOptions = {} } = options;
1085
+ const configs = [];
1086
+ if (!enable) return configs;
1087
+ const prettierOptions = Object.assign({
1088
+ printWidth: 120,
1089
+ tabWidth: 2,
1090
+ semi: true,
1091
+ singleQuote: true,
1092
+ quoteProps: "consistent",
1093
+ jsxSingleQuote: false,
1094
+ trailingComma: "all",
1095
+ bracketSpacing: true,
1096
+ bracketSameLine: false,
1097
+ arrowParens: "always",
1098
+ useTabs: false,
1099
+ endOfLine: "lf",
1100
+ singleAttributePerLine: false
1101
+ }, customPrettierOptions);
1102
+ const prettierXmlOptions = {
1103
+ xmlQuoteAttributes: "double",
1104
+ xmlSelfClosingSpace: true,
1105
+ xmlSortAttributesByKey: false,
1106
+ xmlWhitespaceSensitivity: "ignore"
1107
+ };
1108
+ configs.push({
1109
+ name: `${RULE_PREFIX}/format`,
1110
+ plugins: { format: eslint_plugin_format.default }
1111
+ });
1112
+ if (enable.html) configs.push({
1113
+ name: `${RULE_PREFIX}/format/html`,
1114
+ files: [GLOB_HTML],
1115
+ languageOptions: { parser: parserPlain },
1116
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
1117
+ });
1118
+ if (enable.css) configs.push({
1119
+ name: `${RULE_PREFIX}/format/css`,
1120
+ files: [GLOB_CSS, GLOB_POSTCSS],
1121
+ languageOptions: { parser: parserPlain },
1122
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "css" })] }
1123
+ }, {
1124
+ name: `${RULE_PREFIX}/format/scss`,
1125
+ files: [GLOB_SCSS],
1126
+ languageOptions: { parser: parserPlain },
1127
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
1128
+ }, {
1129
+ name: `${RULE_PREFIX}/format/less`,
1130
+ files: [GLOB_LESS],
1131
+ languageOptions: { parser: parserPlain },
1132
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
1133
+ });
1134
+ if (enable.graphql) configs.push({
1135
+ name: `${RULE_PREFIX}/format/graphql`,
1136
+ files: [GLOB_GRAPHQL],
1137
+ languageOptions: { parser: parserPlain },
1138
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
1139
+ });
1140
+ if (enable.xml) configs.push({
1141
+ name: `${RULE_PREFIX}/format/xml`,
1142
+ files: [GLOB_XML],
1143
+ languageOptions: { parser: parserPlain },
1144
+ rules: { "format/prettier": ["error", mergePrettierOptions({
1145
+ ...prettierXmlOptions,
1146
+ ...prettierOptions
1147
+ }, {
1148
+ parser: "xml",
1149
+ plugins: ["@prettier/plugin-xml"]
1150
+ })] }
1151
+ });
1152
+ if (enable.svg) configs.push({
1153
+ name: `${RULE_PREFIX}/format/svg`,
1154
+ files: [GLOB_SVG],
1155
+ languageOptions: { parser: parserPlain },
1156
+ rules: { "format/prettier": ["error", mergePrettierOptions({
1157
+ ...prettierXmlOptions,
1158
+ ...prettierOptions
1159
+ }, {
1160
+ parser: "xml",
1161
+ plugins: ["@prettier/plugin-xml"]
1162
+ })] }
1163
+ });
1164
+ return configs;
1518
1165
  }
1519
-
1520
- // src/configs/tailwindcss.ts
1521
- var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
1522
- var import_local_pkg2 = require("local-pkg");
1166
+ //#endregion
1167
+ //#region src/configs/tailwindcss.ts
1523
1168
  function tailwindcss(options = {}) {
1524
- const { overrides = {} } = options;
1525
- return (0, import_local_pkg2.isPackageExists)("tailwindcss") ? [
1526
- ...import_eslint_plugin_tailwindcss.default.configs["flat/recommended"].map((item) => ({
1527
- ...item,
1528
- name: `${RULE_PREFIX}/tailwindcss/shared/${item.name?.replace("tailwindcss:", "")}`,
1529
- files: GLOB_SRC
1530
- })),
1531
- {
1532
- name: `${RULE_PREFIX}/tailwindcss/customize`,
1533
- files: GLOB_SRC,
1534
- rules: {
1535
- "tailwindcss/no-custom-classname": "off",
1536
- ...overrides
1537
- }
1538
- }
1539
- ] : [];
1169
+ const { overrides = {} } = options;
1170
+ return (0, local_pkg.isPackageExists)("tailwindcss") ? [...eslint_plugin_tailwindcss.default.configs["flat/recommended"].map((item) => ({
1171
+ ...item,
1172
+ name: `${RULE_PREFIX}/tailwindcss/shared/${item.name?.replace("tailwindcss:", "")}`,
1173
+ files: GLOB_SRC
1174
+ })), {
1175
+ name: `${RULE_PREFIX}/tailwindcss/customize`,
1176
+ files: GLOB_SRC,
1177
+ rules: {
1178
+ "tailwindcss/no-custom-classname": "off",
1179
+ ...overrides
1180
+ }
1181
+ }] : [];
1540
1182
  }
1541
-
1542
- // src/configs/unocss.ts
1543
- var import_flat = __toESM(require("@unocss/eslint-config/flat"), 1);
1544
- var import_local_pkg3 = require("local-pkg");
1183
+ //#endregion
1184
+ //#region src/configs/unocss.ts
1545
1185
  function unocss(options = {}) {
1546
- const { overrides = {} } = options;
1547
- const isUnocssEnabled = (0, import_local_pkg3.isPackageExists)("unocss");
1548
- if (!isUnocssEnabled) {
1549
- return [];
1550
- }
1551
- return [
1552
- {
1553
- ...import_flat.default,
1554
- name: `${RULE_PREFIX}/unocss/shared`,
1555
- files: GLOB_SRC
1556
- },
1557
- {
1558
- name: `${RULE_PREFIX}/unocss/customize`,
1559
- files: GLOB_SRC,
1560
- rules: overrides
1561
- }
1562
- ];
1186
+ const { overrides = {} } = options;
1187
+ if (!(0, local_pkg.isPackageExists)("unocss")) return [];
1188
+ return [{
1189
+ ..._unocss_eslint_config_flat.default,
1190
+ name: `${RULE_PREFIX}/unocss/shared`,
1191
+ files: GLOB_SRC
1192
+ }, {
1193
+ name: `${RULE_PREFIX}/unocss/customize`,
1194
+ files: GLOB_SRC,
1195
+ rules: overrides
1196
+ }];
1563
1197
  }
1564
-
1565
- // src/configs/yml.ts
1566
- var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
1198
+ //#endregion
1199
+ //#region src/configs/yml.ts
1567
1200
  function yml(options = {}) {
1568
- const { overrides = {}, indent = 2, quotes = "single" } = options;
1569
- return [
1570
- ...import_eslint_plugin_yml.default.configs.recommended.map((item) => ({
1571
- ...item,
1572
- name: `${RULE_PREFIX}/yml/shared`,
1573
- files: [GLOB_YML]
1574
- })),
1575
- {
1576
- name: `${RULE_PREFIX}/yml/customize`,
1577
- files: [GLOB_YML],
1578
- rules: {
1579
- "yml/block-mapping": "error",
1580
- "yml/block-sequence": "error",
1581
- "yml/no-empty-key": "error",
1582
- "yml/no-empty-sequence-entry": "error",
1583
- "yml/no-irregular-whitespace": "error",
1584
- "yml/plain-scalar": "error",
1585
- "yml/block-mapping-question-indicator-newline": "error",
1586
- "yml/block-sequence-hyphen-indicator-newline": "error",
1587
- "yml/flow-mapping-curly-newline": "error",
1588
- "yml/flow-mapping-curly-spacing": "error",
1589
- "yml/flow-sequence-bracket-newline": "error",
1590
- "yml/flow-sequence-bracket-spacing": "error",
1591
- "yml/indent": ["error", indent],
1592
- "yml/key-spacing": "error",
1593
- "yml/no-tab-indent": "error",
1594
- "yml/quotes": [
1595
- "error",
1596
- {
1597
- avoidEscape: true,
1598
- prefer: quotes
1599
- }
1600
- ],
1601
- "yml/spaced-comment": "error",
1602
- ...overrides
1603
- }
1604
- },
1605
- {
1606
- name: `${RULE_PREFIX}/yml/customize/pnpm-workspace.yaml`,
1607
- files: ["pnpm-workspace.yaml"],
1608
- rules: {
1609
- "yml/sort-keys": [
1610
- "error",
1611
- {
1612
- order: [
1613
- "packages",
1614
- "overrides",
1615
- "patchedDependencies",
1616
- "hoistPattern",
1617
- "catalog",
1618
- "catalogs",
1619
- "allowedDeprecatedVersions",
1620
- "allowNonAppliedPatches",
1621
- "configDependencies",
1622
- "ignoredBuiltDependencies",
1623
- "ignoredOptionalDependencies",
1624
- "neverBuiltDependencies",
1625
- "onlyBuiltDependencies",
1626
- "onlyBuiltDependenciesFile",
1627
- "packageExtensions",
1628
- "peerDependencyRules",
1629
- "supportedArchitectures"
1630
- ],
1631
- pathPattern: "^$"
1632
- },
1633
- {
1634
- order: {
1635
- type: "asc"
1636
- },
1637
- pathPattern: ".*"
1638
- }
1639
- ]
1640
- }
1641
- }
1642
- ];
1201
+ const { overrides = {}, indent = 2, quotes = "single" } = options;
1202
+ return [
1203
+ ...eslint_plugin_yml.default.configs.recommended.map((item) => ({
1204
+ ...item,
1205
+ name: `${RULE_PREFIX}/yml/shared`,
1206
+ files: [GLOB_YML]
1207
+ })),
1208
+ {
1209
+ name: `${RULE_PREFIX}/yml/customize`,
1210
+ files: [GLOB_YML],
1211
+ rules: {
1212
+ "yml/block-mapping": "error",
1213
+ "yml/block-sequence": "error",
1214
+ "yml/no-empty-key": "error",
1215
+ "yml/no-empty-sequence-entry": "error",
1216
+ "yml/no-irregular-whitespace": "error",
1217
+ "yml/plain-scalar": "error",
1218
+ "yml/block-mapping-question-indicator-newline": "error",
1219
+ "yml/block-sequence-hyphen-indicator-newline": "error",
1220
+ "yml/flow-mapping-curly-newline": "error",
1221
+ "yml/flow-mapping-curly-spacing": "error",
1222
+ "yml/flow-sequence-bracket-newline": "error",
1223
+ "yml/flow-sequence-bracket-spacing": "error",
1224
+ "yml/indent": ["error", indent],
1225
+ "yml/key-spacing": "error",
1226
+ "yml/no-tab-indent": "error",
1227
+ "yml/quotes": ["error", {
1228
+ avoidEscape: true,
1229
+ prefer: quotes
1230
+ }],
1231
+ "yml/spaced-comment": "error",
1232
+ ...overrides
1233
+ }
1234
+ },
1235
+ {
1236
+ name: `${RULE_PREFIX}/yml/customize/pnpm-workspace.yaml`,
1237
+ files: ["pnpm-workspace.yaml"],
1238
+ rules: { "yml/sort-keys": [
1239
+ "error",
1240
+ {
1241
+ order: [
1242
+ "packages",
1243
+ "overrides",
1244
+ "patchedDependencies",
1245
+ "hoistPattern",
1246
+ "catalog",
1247
+ "catalogs",
1248
+ "allowedDeprecatedVersions",
1249
+ "allowNonAppliedPatches",
1250
+ "configDependencies",
1251
+ "ignoredBuiltDependencies",
1252
+ "ignoredOptionalDependencies",
1253
+ "neverBuiltDependencies",
1254
+ "onlyBuiltDependencies",
1255
+ "onlyBuiltDependenciesFile",
1256
+ "packageExtensions",
1257
+ "peerDependencyRules",
1258
+ "supportedArchitectures"
1259
+ ],
1260
+ pathPattern: "^$"
1261
+ },
1262
+ {
1263
+ order: { type: "asc" },
1264
+ pathPattern: ".*"
1265
+ }
1266
+ ] }
1267
+ }
1268
+ ];
1643
1269
  }
1644
-
1645
- // src/configs/toml.ts
1646
- var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
1647
- var parserToml = __toESM(require("toml-eslint-parser"), 1);
1270
+ //#endregion
1271
+ //#region src/configs/toml.ts
1648
1272
  function toml(options = {}) {
1649
- const { overrides = {}, indent = 2 } = options;
1650
- return [
1651
- ...import_eslint_plugin_toml.default.configs.recommended.map((item) => ({
1652
- ...item,
1653
- name: `${RULE_PREFIX}/toml/shared`,
1654
- files: [GLOB_TOML]
1655
- })),
1656
- {
1657
- name: `${RULE_PREFIX}/toml/customize`,
1658
- files: [GLOB_TOML],
1659
- languageOptions: {
1660
- parser: parserToml
1661
- },
1662
- rules: {
1663
- "toml/comma-style": "error",
1664
- "toml/keys-order": "error",
1665
- "toml/no-space-dots": "error",
1666
- "toml/no-unreadable-number-separator": "error",
1667
- "toml/precision-of-fractional-seconds": "error",
1668
- "toml/precision-of-integer": "error",
1669
- "toml/tables-order": "error",
1670
- "toml/array-bracket-newline": "error",
1671
- "toml/array-bracket-spacing": "error",
1672
- "toml/array-element-newline": "error",
1673
- "toml/indent": ["error", indent],
1674
- "toml/inline-table-curly-spacing": "error",
1675
- "toml/key-spacing": "error",
1676
- "toml/padding-line-between-pairs": "error",
1677
- "toml/padding-line-between-tables": "error",
1678
- "toml/quoted-keys": "error",
1679
- "toml/spaced-comment": "error",
1680
- "toml/table-bracket-spacing": "error",
1681
- ...overrides
1682
- }
1683
- }
1684
- ];
1273
+ const { overrides = {}, indent = 2 } = options;
1274
+ return [...eslint_plugin_toml.default.configs.recommended.map((item) => ({
1275
+ ...item,
1276
+ name: `${RULE_PREFIX}/toml/shared`,
1277
+ files: [GLOB_TOML]
1278
+ })), {
1279
+ name: `${RULE_PREFIX}/toml/customize`,
1280
+ files: [GLOB_TOML],
1281
+ languageOptions: { parser: toml_eslint_parser },
1282
+ rules: {
1283
+ "toml/comma-style": "error",
1284
+ "toml/keys-order": "error",
1285
+ "toml/no-space-dots": "error",
1286
+ "toml/no-unreadable-number-separator": "error",
1287
+ "toml/precision-of-fractional-seconds": "error",
1288
+ "toml/precision-of-integer": "error",
1289
+ "toml/tables-order": "error",
1290
+ "toml/array-bracket-newline": "error",
1291
+ "toml/array-bracket-spacing": "error",
1292
+ "toml/array-element-newline": "error",
1293
+ "toml/indent": ["error", indent],
1294
+ "toml/inline-table-curly-spacing": "error",
1295
+ "toml/key-spacing": "error",
1296
+ "toml/padding-line-between-pairs": "error",
1297
+ "toml/padding-line-between-tables": "error",
1298
+ "toml/quoted-keys": "error",
1299
+ "toml/spaced-comment": "error",
1300
+ "toml/table-bracket-spacing": "error",
1301
+ ...overrides
1302
+ }
1303
+ }];
1685
1304
  }
1686
-
1687
- // src/configs/regexp.ts
1688
- var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
1305
+ //#endregion
1306
+ //#region src/configs/regexp.ts
1689
1307
  function regexp(options = {}) {
1690
- const { overrides = {} } = options;
1691
- return [
1692
- {
1693
- ...pluginRegexp.configs.recommended,
1694
- name: `${RULE_PREFIX}/regexp/shared`,
1695
- files: GLOB_SRC
1696
- },
1697
- {
1698
- name: `${RULE_PREFIX}/regexp/customize`,
1699
- files: GLOB_SRC,
1700
- rules: overrides
1701
- }
1702
- ];
1308
+ const { overrides = {} } = options;
1309
+ return [{
1310
+ ...eslint_plugin_regexp.configs.recommended,
1311
+ name: `${RULE_PREFIX}/regexp/shared`,
1312
+ files: GLOB_SRC
1313
+ }, {
1314
+ name: `${RULE_PREFIX}/regexp/customize`,
1315
+ files: GLOB_SRC,
1316
+ rules: overrides
1317
+ }];
1703
1318
  }
1704
-
1705
- // src/configs/ignores.ts
1319
+ //#endregion
1320
+ //#region src/configs/ignores.ts
1706
1321
  function ignores(ignorePatterns) {
1707
- return [
1708
- {
1709
- name: `${RULE_PREFIX}/ignores`,
1710
- ignores: [
1711
- ...GLOB_EXCLUDE,
1712
- ...ignorePatterns
1713
- ]
1714
- }
1715
- ];
1322
+ return [{
1323
+ name: `${RULE_PREFIX}/ignores`,
1324
+ ignores: [...GLOB_EXCLUDE, ...ignorePatterns]
1325
+ }];
1716
1326
  }
1717
-
1718
- // src/configs/eslint-comments.ts
1719
- var import_configs = __toESM(require("@eslint-community/eslint-plugin-eslint-comments/configs"), 1);
1327
+ //#endregion
1328
+ //#region src/configs/eslint-comments.ts
1720
1329
  function eslintComments(options = {}) {
1721
- const { overrides = {} } = options;
1722
- return [
1723
- {
1724
- ...import_configs.default.recommended,
1725
- name: `${RULE_PREFIX}/eslint-comments/shared`
1726
- },
1727
- {
1728
- name: `${RULE_PREFIX}/eslint-comments/customize`,
1729
- rules: overrides
1730
- }
1731
- ];
1330
+ const { overrides = {} } = options;
1331
+ return [{
1332
+ ..._eslint_community_eslint_plugin_eslint_comments_configs.default.recommended,
1333
+ name: `${RULE_PREFIX}/eslint-comments/shared`
1334
+ }, {
1335
+ name: `${RULE_PREFIX}/eslint-comments/customize`,
1336
+ rules: overrides
1337
+ }];
1732
1338
  }
1733
-
1734
- // src/configs/disables.ts
1339
+ //#endregion
1340
+ //#region src/configs/disables.ts
1735
1341
  function disables(options = {}) {
1736
- const { overrides = { scripts: {}, cli: {}, bin: {}, dts: {}, cjs: {}, config: {} } } = options;
1737
- return [
1738
- {
1739
- name: `${RULE_PREFIX}/disables/scripts`,
1740
- files: GLOB_SRC.map((item) => `**/scripts/${item}`),
1741
- rules: {
1742
- "antfu/no-top-level-await": "off",
1743
- "no-console": "off",
1744
- "@typescript-eslint/explicit-function-return-type": "off",
1745
- ...overrides.scripts
1746
- }
1747
- },
1748
- {
1749
- name: `${RULE_PREFIX}/disables/cli`,
1750
- files: [
1751
- ...GLOB_SRC.map((item) => `**/cli/${item}`),
1752
- ...GLOB_SRC_EXT.map((item) => `**/cli.${item}`)
1753
- ],
1754
- rules: {
1755
- "antfu/no-top-level-await": "off",
1756
- "no-console": "off",
1757
- ...overrides.cli
1758
- }
1759
- },
1760
- {
1761
- name: `${RULE_PREFIX}/disables/bin`,
1762
- files: [
1763
- "**/bin/**/*",
1764
- ...GLOB_SRC_EXT.map((item) => `**/bin.${item}`)
1765
- ],
1766
- rules: {
1767
- "antfu/no-import-dist": "off",
1768
- "antfu/no-import-node-modules-by-path": "off",
1769
- ...overrides.bin
1770
- }
1771
- },
1772
- {
1773
- name: `${RULE_PREFIX}/disables/dts`,
1774
- files: ["**/*.d.?([cm])ts"],
1775
- rules: {
1776
- "eslint-comments/no-unlimited-disable": "off",
1777
- "import/no-duplicates": "off",
1778
- "no-restricted-syntax": "off",
1779
- "unused-imports/no-unused-vars": "off",
1780
- ...overrides.dts
1781
- }
1782
- },
1783
- {
1784
- name: `${RULE_PREFIX}/disables/cjs`,
1785
- files: ["**/*.js", "**/*.cjs"],
1786
- rules: {
1787
- "ts/no-require-imports": "off",
1788
- ...overrides.cjs
1789
- }
1790
- },
1791
- {
1792
- name: `${RULE_PREFIX}/disables/config`,
1793
- files: [
1794
- ...GLOB_SRC_EXT.map((item) => `**/*.config.${item}`),
1795
- ...GLOB_SRC_EXT.map((item) => `**/*.config.*.${item}`)
1796
- ],
1797
- rules: {
1798
- "antfu/no-top-level-await": "off",
1799
- "no-console": "off",
1800
- "ts/explicit-function-return-type": "off",
1801
- ...overrides.config
1802
- }
1803
- }
1804
- ];
1342
+ const { overrides = {
1343
+ scripts: {},
1344
+ cli: {},
1345
+ bin: {},
1346
+ dts: {},
1347
+ cjs: {},
1348
+ config: {}
1349
+ } } = options;
1350
+ return [
1351
+ {
1352
+ name: `${RULE_PREFIX}/disables/scripts`,
1353
+ files: GLOB_SRC.map((item) => `**/scripts/${item}`),
1354
+ rules: {
1355
+ "antfu/no-top-level-await": "off",
1356
+ "no-console": "off",
1357
+ "@typescript-eslint/explicit-function-return-type": "off",
1358
+ ...overrides.scripts
1359
+ }
1360
+ },
1361
+ {
1362
+ name: `${RULE_PREFIX}/disables/cli`,
1363
+ files: [...GLOB_SRC.map((item) => `**/cli/${item}`), ...GLOB_SRC_EXT.map((item) => `**/cli.${item}`)],
1364
+ rules: {
1365
+ "antfu/no-top-level-await": "off",
1366
+ "no-console": "off",
1367
+ ...overrides.cli
1368
+ }
1369
+ },
1370
+ {
1371
+ name: `${RULE_PREFIX}/disables/bin`,
1372
+ files: ["**/bin/**/*", ...GLOB_SRC_EXT.map((item) => `**/bin.${item}`)],
1373
+ rules: {
1374
+ "antfu/no-import-dist": "off",
1375
+ "antfu/no-import-node-modules-by-path": "off",
1376
+ ...overrides.bin
1377
+ }
1378
+ },
1379
+ {
1380
+ name: `${RULE_PREFIX}/disables/dts`,
1381
+ files: ["**/*.d.?([cm])ts"],
1382
+ rules: {
1383
+ "eslint-comments/no-unlimited-disable": "off",
1384
+ "import/no-duplicates": "off",
1385
+ "no-restricted-syntax": "off",
1386
+ "unused-imports/no-unused-vars": "off",
1387
+ ...overrides.dts
1388
+ }
1389
+ },
1390
+ {
1391
+ name: `${RULE_PREFIX}/disables/cjs`,
1392
+ files: ["**/*.js", "**/*.cjs"],
1393
+ rules: {
1394
+ "ts/no-require-imports": "off",
1395
+ ...overrides.cjs
1396
+ }
1397
+ },
1398
+ {
1399
+ name: `${RULE_PREFIX}/disables/config`,
1400
+ files: [...GLOB_SRC_EXT.map((item) => `**/*.config.${item}`), ...GLOB_SRC_EXT.map((item) => `**/*.config.*.${item}`)],
1401
+ rules: {
1402
+ "antfu/no-top-level-await": "off",
1403
+ "no-console": "off",
1404
+ "ts/explicit-function-return-type": "off",
1405
+ ...overrides.config
1406
+ }
1407
+ }
1408
+ ];
1805
1409
  }
1806
-
1807
- // src/configs/language-options.ts
1410
+ //#endregion
1411
+ //#region src/configs/language-options.ts
1808
1412
  function languageOptions(options = {}) {
1809
- const { sourceType = "module" } = options;
1810
- return [
1811
- {
1812
- name: `${RULE_PREFIX}/language-options`,
1813
- files: GLOB_SRC,
1814
- languageOptions: {
1815
- sourceType
1816
- }
1817
- }
1818
- ];
1413
+ const { sourceType = "module" } = options;
1414
+ return [{
1415
+ name: `${RULE_PREFIX}/language-options`,
1416
+ files: GLOB_SRC,
1417
+ languageOptions: { sourceType }
1418
+ }];
1819
1419
  }
1820
-
1821
- // src/index.ts
1822
- function defineConfig4(options = {}) {
1823
- const { configs: configs2 = {}, ignorePatterns = [], sourceType = "module" } = options;
1824
- return [
1825
- ...react(configs2.react),
1826
- ...vue(configs2.vue),
1827
- ...stylistic(configs2.stylistic),
1828
- ...typescript(configs2.typescript),
1829
- ...javascript(configs2.javascript),
1830
- ...node(configs2.node),
1831
- ...json(configs2.json),
1832
- ...unicorn(configs2.unicorn),
1833
- ...imports(configs2.imports),
1834
- ...format(configs2.format),
1835
- ...tailwindcss(configs2.tailwindcss),
1836
- ...unocss(configs2.unocss),
1837
- ...yml(configs2.yml),
1838
- ...toml(configs2.toml),
1839
- ...regexp(configs2.regexp),
1840
- ...ignores(ignorePatterns),
1841
- ...eslintComments(configs2.eslintComments),
1842
- ...disables(configs2.disables),
1843
- ...languageOptions({ sourceType })
1844
- ];
1420
+ //#endregion
1421
+ //#region src/index.ts
1422
+ function defineConfig(options = {}) {
1423
+ const { configs = {}, ignorePatterns = [], sourceType = "module" } = options;
1424
+ return [
1425
+ ...react(configs.react),
1426
+ ...vue(configs.vue),
1427
+ ...stylistic(configs.stylistic),
1428
+ ...typescript(configs.typescript),
1429
+ ...javascript(configs.javascript),
1430
+ ...node(configs.node),
1431
+ ...json(configs.json),
1432
+ ...unicorn(configs.unicorn),
1433
+ ...imports(configs.imports),
1434
+ ...format(configs.format),
1435
+ ...tailwindcss(configs.tailwindcss),
1436
+ ...unocss(configs.unocss),
1437
+ ...yml(configs.yml),
1438
+ ...toml(configs.toml),
1439
+ ...regexp(configs.regexp),
1440
+ ...ignores(ignorePatterns),
1441
+ ...eslintComments(configs.eslintComments),
1442
+ ...disables(configs.disables),
1443
+ ...languageOptions({ sourceType })
1444
+ ];
1845
1445
  }
1846
- // Annotate the CommonJS export names for ESM import in node:
1847
- 0 && (module.exports = {
1848
- defineConfig
1849
- });
1446
+ //#endregion
1447
+ exports.defineConfig = defineConfig;