@shun-shobon/style-guide 1.1.1 → 1.2.2
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/eslint/index.d.mts +4448 -0
- package/dist/eslint/index.mjs +519 -0
- package/dist/eslint/index.mjs.map +1 -0
- package/dist/prettier/index.d.mts +61 -0
- package/dist/prettier/index.mjs +103 -0
- package/dist/prettier/index.mjs.map +1 -0
- package/package.json +27 -25
- package/dist/eslint/index.d.ts +0 -4937
- package/dist/eslint/index.js +0 -831
- package/dist/eslint/index.js.map +0 -1
- package/dist/prettier/index.d.ts +0 -53
- package/dist/prettier/index.js +0 -123
- package/dist/prettier/index.js.map +0 -1
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import configJs from "@eslint/js";
|
|
2
|
+
import pluginImport from "eslint-plugin-import-x";
|
|
3
|
+
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
4
|
+
import pluginNode from "eslint-plugin-n";
|
|
5
|
+
import pluginRegexp from "eslint-plugin-regexp";
|
|
6
|
+
import pluginImportSort from "eslint-plugin-simple-import-sort";
|
|
7
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
8
|
+
import globals from "globals";
|
|
9
|
+
import { isPackageExists } from "local-pkg";
|
|
10
|
+
|
|
11
|
+
//#region src/eslint/globs.ts
|
|
12
|
+
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
13
|
+
const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
14
|
+
const GLOB_JS_EXT = "?([cm])js";
|
|
15
|
+
const GLOB_JS = `**/*.${GLOB_JS_EXT}`;
|
|
16
|
+
const GLOB_JSX_EXT = "?([cm])jsx";
|
|
17
|
+
const GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
|
|
18
|
+
const GLOB_TS_EXT = "?([cm])ts";
|
|
19
|
+
const GLOB_TS = `**/*.${GLOB_TS_EXT}`;
|
|
20
|
+
const GLOB_TSX_EXT = "?([cm])tsx";
|
|
21
|
+
const GLOB_TSX = `**/*.${GLOB_TSX_EXT}`;
|
|
22
|
+
const GLOB_DTS_EXT = "?([cm])d.ts";
|
|
23
|
+
const GLOB_DTS = `**/*.${GLOB_DTS_EXT}`;
|
|
24
|
+
const GLOB_STORYBOOK_EXT = `@(stories|story).${GLOB_TSX_EXT}`;
|
|
25
|
+
const GLOB_STORYBOOK = `**/*.${GLOB_STORYBOOK_EXT}`;
|
|
26
|
+
const GLOB_STORYBOOK_CONFIG = `**/.storybook/main.${GLOB_SRC_EXT}`;
|
|
27
|
+
const GLOB_ASTRO_EXT = "astro";
|
|
28
|
+
const GLOB_ASTRO = `**/*.${GLOB_ASTRO_EXT}`;
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/eslint/utils.ts
|
|
32
|
+
async function interopDefault(module) {
|
|
33
|
+
const resolved = await module;
|
|
34
|
+
return resolved.default ?? resolved;
|
|
35
|
+
}
|
|
36
|
+
function renameRules(rules, from, to) {
|
|
37
|
+
return Object.fromEntries(Object.entries(rules).map(([key, value]) => [key.startsWith(from) ? `${to}${key.slice(from.length)}` : key, value]));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/eslint/configs/astro.ts
|
|
42
|
+
async function astro(options = {}) {
|
|
43
|
+
const { typescript: typescript$1 = true } = options;
|
|
44
|
+
const [pluginAstro, parserAstro] = await Promise.all([interopDefault(import("eslint-plugin-astro")), interopDefault(import("astro-eslint-parser"))]);
|
|
45
|
+
return [{
|
|
46
|
+
name: "shun-shobon/astro/plugins",
|
|
47
|
+
plugins: { astro: pluginAstro }
|
|
48
|
+
}, {
|
|
49
|
+
name: "shun-shobon/astro/rules",
|
|
50
|
+
files: [GLOB_ASTRO],
|
|
51
|
+
languageOptions: {
|
|
52
|
+
parser: parserAstro,
|
|
53
|
+
parserOptions: {
|
|
54
|
+
parser: typescript$1 ? await interopDefault(import("@typescript-eslint/parser")) : void 0,
|
|
55
|
+
extraFileExtensions: [".astro"]
|
|
56
|
+
},
|
|
57
|
+
globals: {
|
|
58
|
+
Astro: "readonly",
|
|
59
|
+
Fragment: "readonly"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
processor: pluginAstro.processors[typescript$1 ? "client-side-ts" : "astro"],
|
|
63
|
+
rules: {
|
|
64
|
+
...pluginAstro.configs.recommended.at(-1).rules,
|
|
65
|
+
...pluginAstro.configs["jsx-a11y-strict"].at(-1).rules,
|
|
66
|
+
"astro/jsx-a11y/anchor-ambiguous-text": "error",
|
|
67
|
+
"astro/jsx-a11y/control-has-associated-label": "error",
|
|
68
|
+
"astro/jsx-a11y/lang": "error",
|
|
69
|
+
"astro/jsx-a11y/no-aria-hidden-on-focusable": "error"
|
|
70
|
+
}
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/eslint/configs/base.ts
|
|
76
|
+
function base() {
|
|
77
|
+
return [{
|
|
78
|
+
name: "shun-shobon/base/setup",
|
|
79
|
+
linterOptions: { reportUnusedDisableDirectives: true }
|
|
80
|
+
}];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/eslint/configs/disable-type-checked.ts
|
|
85
|
+
async function disableTypeChecked(options = {}) {
|
|
86
|
+
const { disableTypeCheckedFiles = [] } = options;
|
|
87
|
+
const { configs: configsTypeScript } = await interopDefault(import("typescript-eslint"));
|
|
88
|
+
return [{
|
|
89
|
+
name: "shun-shobon/disableTypeChecked/rules",
|
|
90
|
+
files: disableTypeCheckedFiles,
|
|
91
|
+
languageOptions: { parserOptions: { projectService: false } },
|
|
92
|
+
rules: { ...renameRules(configsTypeScript.disableTypeChecked.rules, "@typescript-eslint/", "typescript/") }
|
|
93
|
+
}];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/eslint/configs/import-sort.ts
|
|
98
|
+
function importSort() {
|
|
99
|
+
return [{
|
|
100
|
+
name: "shun-shobon/importSort/setup",
|
|
101
|
+
plugins: { "import-sort": pluginImportSort }
|
|
102
|
+
}, {
|
|
103
|
+
name: "shun-shobon/importSort/rules",
|
|
104
|
+
rules: {
|
|
105
|
+
"import-sort/imports": "warn",
|
|
106
|
+
"import-sort/exports": "warn"
|
|
107
|
+
}
|
|
108
|
+
}];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/eslint/configs/imports.ts
|
|
113
|
+
function imports(options) {
|
|
114
|
+
const { typescript: typescript$1 = false } = options;
|
|
115
|
+
return [{
|
|
116
|
+
name: "shun-shobon/imports/setup",
|
|
117
|
+
plugins: { import: pluginImport },
|
|
118
|
+
settings: {
|
|
119
|
+
"import-x/parsers": {
|
|
120
|
+
espree: [
|
|
121
|
+
".js",
|
|
122
|
+
".cjs",
|
|
123
|
+
".mjs",
|
|
124
|
+
".jsx"
|
|
125
|
+
],
|
|
126
|
+
...typescript$1 ? { "@typescript-eslint/parser": [
|
|
127
|
+
".ts",
|
|
128
|
+
".mts",
|
|
129
|
+
".cts",
|
|
130
|
+
".tsx"
|
|
131
|
+
] } : {}
|
|
132
|
+
},
|
|
133
|
+
"import-x/extensions": [
|
|
134
|
+
".js",
|
|
135
|
+
".jsx",
|
|
136
|
+
...typescript$1 ? [
|
|
137
|
+
".ts",
|
|
138
|
+
".tsx",
|
|
139
|
+
".d.ts"
|
|
140
|
+
] : []
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
name: "shun-shobon/imports/rules",
|
|
145
|
+
rules: {
|
|
146
|
+
...renameRules(pluginImport.configs.recommended.rules, "import-x/", "import/"),
|
|
147
|
+
"import/namespace": "off",
|
|
148
|
+
"import/no-unresolved": "off",
|
|
149
|
+
"import/named": "off",
|
|
150
|
+
"import/consistent-type-specifier-style": ["warn", "prefer-top-level"],
|
|
151
|
+
"import/first": "error",
|
|
152
|
+
"import/no-duplicates": "warn",
|
|
153
|
+
"import/no-named-default": "warn",
|
|
154
|
+
"import/no-useless-path-segments": ["warn", { noUselessIndex: true }],
|
|
155
|
+
"import/no-self-import": "error"
|
|
156
|
+
}
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/eslint/configs/javascript.ts
|
|
162
|
+
function javascript() {
|
|
163
|
+
return [{
|
|
164
|
+
name: "shun-shobon/javascript/rules",
|
|
165
|
+
languageOptions: {
|
|
166
|
+
ecmaVersion: "latest",
|
|
167
|
+
sourceType: "module",
|
|
168
|
+
globals: {
|
|
169
|
+
...globals.es2021,
|
|
170
|
+
...globals.browser,
|
|
171
|
+
...globals.node
|
|
172
|
+
},
|
|
173
|
+
parserOptions: {
|
|
174
|
+
ecmaFeatures: { jax: true },
|
|
175
|
+
ecmaVersion: "latest",
|
|
176
|
+
sourceType: "module"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
rules: {
|
|
180
|
+
...configJs.configs.recommended.rules,
|
|
181
|
+
"array-callback-return": "error",
|
|
182
|
+
"no-constant-binary-expression": "warn",
|
|
183
|
+
"no-constructor-return": "error",
|
|
184
|
+
"no-new-native-nonconstructor": "error",
|
|
185
|
+
"no-promise-executor-return": "error",
|
|
186
|
+
"no-self-compare": "error",
|
|
187
|
+
"no-unmodified-loop-condition": "warn",
|
|
188
|
+
"no-constant-condition": ["error", { checkLoops: false }],
|
|
189
|
+
"no-unreachable-loop": "warn",
|
|
190
|
+
"no-unused-private-class-members": "warn",
|
|
191
|
+
"no-unused-vars": ["warn", {
|
|
192
|
+
varsIgnorePattern: "^_",
|
|
193
|
+
argsIgnorePattern: "^_"
|
|
194
|
+
}],
|
|
195
|
+
"require-atomic-updates": "error",
|
|
196
|
+
"complexity": ["warn", 15],
|
|
197
|
+
"default-case-last": "error",
|
|
198
|
+
"default-param-last": "error",
|
|
199
|
+
"eqeqeq": [
|
|
200
|
+
"error",
|
|
201
|
+
"always",
|
|
202
|
+
{ null: "ignore" }
|
|
203
|
+
],
|
|
204
|
+
"grouped-accessor-pairs": ["error", "setBeforeGet"],
|
|
205
|
+
"no-alert": "warn",
|
|
206
|
+
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
207
|
+
"no-else-return": "warn",
|
|
208
|
+
"no-implicit-coercion": "error",
|
|
209
|
+
"no-lonely-if": "error",
|
|
210
|
+
"no-multi-assign": "error",
|
|
211
|
+
"no-multi-str": "warn",
|
|
212
|
+
"no-new-func": "error",
|
|
213
|
+
"no-new-wrappers": "error",
|
|
214
|
+
"no-param-reassign": "error",
|
|
215
|
+
"no-plusplus": "error",
|
|
216
|
+
"no-throw-literal": "error",
|
|
217
|
+
"no-unneeded-ternary": "warn",
|
|
218
|
+
"no-unused-expressions": "warn",
|
|
219
|
+
"no-useless-constructor": "warn",
|
|
220
|
+
"no-useless-return": "warn",
|
|
221
|
+
"no-var": "error",
|
|
222
|
+
"object-shorthand": "warn",
|
|
223
|
+
"operator-assignment": "warn",
|
|
224
|
+
"prefer-arrow-callback": "warn",
|
|
225
|
+
"prefer-const": "warn",
|
|
226
|
+
"prefer-named-capture-group": "warn",
|
|
227
|
+
"prefer-numeric-literals": "error",
|
|
228
|
+
"prefer-object-has-own": "error",
|
|
229
|
+
"prefer-object-spread": "warn",
|
|
230
|
+
"prefer-promise-reject-errors": "error",
|
|
231
|
+
"prefer-regex-literals": "warn",
|
|
232
|
+
"prefer-rest-params": "warn",
|
|
233
|
+
"prefer-spread": "warn",
|
|
234
|
+
"radix": "error",
|
|
235
|
+
"require-unicode-regexp": "warn",
|
|
236
|
+
"symbol-description": "warn"
|
|
237
|
+
}
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/eslint/configs/jsx-a11y.ts
|
|
243
|
+
function jsxA11y() {
|
|
244
|
+
return [{
|
|
245
|
+
name: "shun-shobon/jsxA11y/setup",
|
|
246
|
+
plugins: { "jsx-a11y": pluginJsxA11y },
|
|
247
|
+
settings: { "jsx-a11y": { polymorphicPropName: "as" } }
|
|
248
|
+
}];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/eslint/configs/next.ts
|
|
253
|
+
async function next() {
|
|
254
|
+
const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));
|
|
255
|
+
return [{
|
|
256
|
+
name: "shun-shobon/next/setup",
|
|
257
|
+
plugins: { next: pluginNext }
|
|
258
|
+
}, {
|
|
259
|
+
name: "shun-shobon/next/rules",
|
|
260
|
+
files: [GLOB_SRC],
|
|
261
|
+
rules: {
|
|
262
|
+
...renameRules(pluginNext.configs.recommended.rules, "@next/next/", "next/"),
|
|
263
|
+
...renameRules(pluginNext.configs["core-web-vitals"].rules, "@next/next/", "next/"),
|
|
264
|
+
"next/no-img-element": "off"
|
|
265
|
+
}
|
|
266
|
+
}];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/eslint/configs/node.ts
|
|
271
|
+
function node() {
|
|
272
|
+
return [{
|
|
273
|
+
name: "shun-shobon/node/setup",
|
|
274
|
+
plugins: { node: pluginNode }
|
|
275
|
+
}, {
|
|
276
|
+
name: "shun-shobon/node/rules",
|
|
277
|
+
rules: {
|
|
278
|
+
"node/no-deprecated-api": "error",
|
|
279
|
+
"node/no-exports-assign": "error",
|
|
280
|
+
"node/no-path-concat": "error",
|
|
281
|
+
"node/no-process-exit": "error",
|
|
282
|
+
"node/no-unpublished-bin": "error",
|
|
283
|
+
"node/no-sync": "error",
|
|
284
|
+
"node/process-exit-as-throw": "error",
|
|
285
|
+
"node/prefer-global/console": "error",
|
|
286
|
+
"node/prefer-global/text-decoder": "error",
|
|
287
|
+
"node/prefer-global/text-encoder": "error",
|
|
288
|
+
"node/prefer-global/url": "error",
|
|
289
|
+
"node/prefer-global/url-search-params": "error",
|
|
290
|
+
"node/prefer-promises/dns": "error",
|
|
291
|
+
"node/prefer-promises/fs": "error"
|
|
292
|
+
}
|
|
293
|
+
}];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/eslint/configs/qwik.ts
|
|
298
|
+
async function qwik() {
|
|
299
|
+
const pluginQwik = await interopDefault(import("eslint-plugin-qwik"));
|
|
300
|
+
return [{
|
|
301
|
+
name: "shun-shobon/qwik/setup",
|
|
302
|
+
plugins: { qwik: pluginQwik }
|
|
303
|
+
}, {
|
|
304
|
+
name: "shun-shobon/qwik/rules",
|
|
305
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
306
|
+
rules: {
|
|
307
|
+
...pluginQwik.configs.recommended.rules,
|
|
308
|
+
...pluginQwik.configs.strict.rules
|
|
309
|
+
}
|
|
310
|
+
}];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/eslint/configs/react.ts
|
|
315
|
+
async function react(options = {}) {
|
|
316
|
+
const { typescript: typescript$1 = false } = options;
|
|
317
|
+
const [pluginReact, pluginReactHooks] = await Promise.all([interopDefault(import("eslint-plugin-react")), interopDefault(import("eslint-plugin-react-hooks"))]);
|
|
318
|
+
return [{
|
|
319
|
+
name: "shun-shobon/react/setup",
|
|
320
|
+
plugins: {
|
|
321
|
+
"react": pluginReact,
|
|
322
|
+
"react-hooks": pluginReactHooks
|
|
323
|
+
},
|
|
324
|
+
settings: { react: { version: "detect" } }
|
|
325
|
+
}, {
|
|
326
|
+
name: "shun-shobon/react/rules",
|
|
327
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
328
|
+
rules: {
|
|
329
|
+
...pluginReact.configs.recommended.rules,
|
|
330
|
+
...pluginReact.configs["jsx-runtime"].rules,
|
|
331
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
332
|
+
...pluginJsxA11y.configs.strict.rules,
|
|
333
|
+
"react/jsx-handler-names": "warn",
|
|
334
|
+
"react/jsx-no-constructed-context-values": "warn",
|
|
335
|
+
"react/jsx-no-useless-fragment": ["warn", { allowExpressions: true }],
|
|
336
|
+
"react/no-invalid-html-attribute": "warn",
|
|
337
|
+
"react/no-object-type-as-default-prop": "warn",
|
|
338
|
+
"react/no-unstable-nested-components": "error",
|
|
339
|
+
...typescript$1 ? {
|
|
340
|
+
"react/prop-types": "off",
|
|
341
|
+
"react/no-unknown-property": "off"
|
|
342
|
+
} : {},
|
|
343
|
+
"jsx-a11y/anchor-ambiguous-text": "error",
|
|
344
|
+
"jsx-a11y/control-has-associated-label": "error",
|
|
345
|
+
"jsx-a11y/lang": "error",
|
|
346
|
+
"jsx-a11y/no-aria-hidden-on-focusable": "error"
|
|
347
|
+
}
|
|
348
|
+
}];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/eslint/configs/regexp.ts
|
|
353
|
+
function regexp() {
|
|
354
|
+
return [{
|
|
355
|
+
name: "shun-shobon/regexp/setup",
|
|
356
|
+
plugins: { regexp: pluginRegexp }
|
|
357
|
+
}, {
|
|
358
|
+
name: "shun-shobon/regexp/rules",
|
|
359
|
+
rules: { ...pluginRegexp.configs["flat/recommended"].rules }
|
|
360
|
+
}];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/eslint/configs/storybook.ts
|
|
365
|
+
async function storybook() {
|
|
366
|
+
return [
|
|
367
|
+
{
|
|
368
|
+
name: "shun-shobon/storybook/setup",
|
|
369
|
+
plugins: { storybook: await interopDefault(import("eslint-plugin-storybook")) }
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
name: "shun-shobon/storybook/rules",
|
|
373
|
+
files: [GLOB_STORYBOOK],
|
|
374
|
+
rules: {
|
|
375
|
+
"import/no-anonymous-default-export": "off",
|
|
376
|
+
"storybook/await-interactions": "error",
|
|
377
|
+
"storybook/context-in-play-function": "error",
|
|
378
|
+
"storybook/default-exports": "error",
|
|
379
|
+
"storybook/hierarchy-separator": "warn",
|
|
380
|
+
"storybook/no-redundant-story-name": "warn",
|
|
381
|
+
"storybook/prefer-pascal-case": "warn",
|
|
382
|
+
"storybook/story-exports": "error",
|
|
383
|
+
"storybook/use-storybook-expect": "error",
|
|
384
|
+
"storybook/use-storybook-testing-library": "error"
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: "shun-shobon/storybook/config-rules",
|
|
389
|
+
files: [GLOB_STORYBOOK_CONFIG],
|
|
390
|
+
rules: { "storybook/no-uninstalled-addons": "error" }
|
|
391
|
+
}
|
|
392
|
+
];
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/eslint/configs/typescript.ts
|
|
397
|
+
async function typescript(options = {}) {
|
|
398
|
+
const { componentExts = [] } = options;
|
|
399
|
+
const { plugin: pluginTypeScript, parser: parserTypeScript, configs: configsTypeScript } = await import("typescript-eslint");
|
|
400
|
+
return [
|
|
401
|
+
{
|
|
402
|
+
name: "shun-shobon/typescript/setup",
|
|
403
|
+
plugins: { typescript: pluginTypeScript }
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: "shun-shobon/typescript/rules",
|
|
407
|
+
files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
408
|
+
languageOptions: {
|
|
409
|
+
parser: parserTypeScript,
|
|
410
|
+
parserOptions: { projectService: { allowDefaultProject: ["./*.js"] } }
|
|
411
|
+
},
|
|
412
|
+
rules: {
|
|
413
|
+
...renameRules(configsTypeScript.strictTypeChecked.at(-1).rules, "@typescript-eslint/", "typescript/"),
|
|
414
|
+
...renameRules(configsTypeScript.stylisticTypeChecked.at(-1).rules, "@typescript-eslint/", "typescript/"),
|
|
415
|
+
"typescript/explicit-module-boundary-types": "warn",
|
|
416
|
+
"typescript/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
|
|
417
|
+
"typescript/consistent-type-imports": "error",
|
|
418
|
+
"typescript/no-unused-vars": ["warn", {
|
|
419
|
+
varsIgnorePattern: "^_",
|
|
420
|
+
argsIgnorePattern: "^_"
|
|
421
|
+
}],
|
|
422
|
+
"typescript/no-import-type-side-effects": "warn",
|
|
423
|
+
"typescript/prefer-readonly": "warn",
|
|
424
|
+
"typescript/promise-function-async": "error",
|
|
425
|
+
"typescript/require-array-sort-compare": "error",
|
|
426
|
+
"typescript/return-await": ["warn", "always"],
|
|
427
|
+
"typescript/no-unnecessary-condition": ["warn", { allowConstantLoopConditions: true }],
|
|
428
|
+
"typescript/no-non-null-assertion": "off",
|
|
429
|
+
"typescript/restrict-template-expressions": ["error", {
|
|
430
|
+
allowAny: true,
|
|
431
|
+
allowBoolean: false,
|
|
432
|
+
allowNullish: false,
|
|
433
|
+
allowNumber: true,
|
|
434
|
+
allowRegExp: false,
|
|
435
|
+
allowNever: false
|
|
436
|
+
}]
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "shun-shobon/typescript/disables/eslint-recommended",
|
|
441
|
+
files: [
|
|
442
|
+
GLOB_TS,
|
|
443
|
+
GLOB_TSX,
|
|
444
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
445
|
+
],
|
|
446
|
+
rules: { ...configsTypeScript.eslintRecommended.rules }
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: "shun-shobon/typescript/disables/dts",
|
|
450
|
+
files: [GLOB_DTS],
|
|
451
|
+
rules: {
|
|
452
|
+
"import/no-duplicates": "off",
|
|
453
|
+
"typescript/triple-slash-reference": "off"
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
];
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/eslint/configs/unicorn.ts
|
|
461
|
+
function unicorn() {
|
|
462
|
+
return [{
|
|
463
|
+
name: "shun-shobon/unicorn/setup",
|
|
464
|
+
plugins: { unicorn: pluginUnicorn }
|
|
465
|
+
}, {
|
|
466
|
+
name: "shun-shobon/unicorn/rules",
|
|
467
|
+
rules: {
|
|
468
|
+
...pluginUnicorn.configs.recommended.rules,
|
|
469
|
+
"unicorn/empty-brace-spaces": "off",
|
|
470
|
+
"unicorn/no-nested-ternary": "off",
|
|
471
|
+
"unicorn/number-literal-case": "off",
|
|
472
|
+
"unicorn/consistent-function-scoping": "off",
|
|
473
|
+
"unicorn/filename-case": "off",
|
|
474
|
+
"unicorn/no-array-callback-reference": "off",
|
|
475
|
+
"unicorn/no-array-for-each": "off",
|
|
476
|
+
"unicorn/no-array-reduce": "off",
|
|
477
|
+
"unicorn/no-negated-condition": "off",
|
|
478
|
+
"unicorn/no-null": "off",
|
|
479
|
+
"unicorn/no-useless-undefined": "off",
|
|
480
|
+
"unicorn/prefer-module": "off",
|
|
481
|
+
"unicorn/prefer-spread": "off",
|
|
482
|
+
"unicorn/prevent-abbreviations": "off",
|
|
483
|
+
"unicorn/switch-case-braces": ["warn", "avoid"]
|
|
484
|
+
}
|
|
485
|
+
}];
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/eslint/factory.ts
|
|
490
|
+
async function shun_shobon(options = {}, ...userConfigs) {
|
|
491
|
+
const { gitignore: enableGitignore = true, ignores: userIgnores = [], typescript: enableTypescript = isPackageExists("typescript"), react: enableReact = isPackageExists("react"), next: enableNext = isPackageExists("next"), qwik: enableQwik = isPackageExists("@builder.io/qwik"), astro: enableAstro = isPackageExists("astro"), storybook: enableStorybook = isPackageExists("storybook"), componentExts = [], disableTypeCheckedFiles = [] } = options;
|
|
492
|
+
const configQueue = [];
|
|
493
|
+
if (enableGitignore) configQueue.push(interopDefault(import("eslint-config-flat-gitignore")).then((gitignore) => [gitignore(typeof enableGitignore !== "boolean" ? {
|
|
494
|
+
name: "shun-shobon/gitignore/setup",
|
|
495
|
+
...enableGitignore
|
|
496
|
+
} : { name: "shun-shobon/gitignore/setup" })]));
|
|
497
|
+
if (enableAstro) {
|
|
498
|
+
componentExts.push(GLOB_ASTRO_EXT);
|
|
499
|
+
disableTypeCheckedFiles.push(GLOB_ASTRO);
|
|
500
|
+
}
|
|
501
|
+
configQueue.push(base(), javascript(), imports({ typescript: enableTypescript }), importSort(), unicorn(), regexp(), node(), jsxA11y());
|
|
502
|
+
if (enableTypescript) {
|
|
503
|
+
configQueue.push(typescript({ componentExts }));
|
|
504
|
+
disableTypeCheckedFiles.push(GLOB_JS, GLOB_JSX);
|
|
505
|
+
}
|
|
506
|
+
if (enableReact) configQueue.push(react({ typescript: enableTypescript }));
|
|
507
|
+
if (enableNext) configQueue.push(next());
|
|
508
|
+
if (enableQwik) configQueue.push(qwik());
|
|
509
|
+
if (enableAstro) configQueue.push(astro({ typescript: enableTypescript }));
|
|
510
|
+
if (enableStorybook) configQueue.push(storybook());
|
|
511
|
+
if (enableTypescript) configQueue.push(disableTypeChecked({ disableTypeCheckedFiles }));
|
|
512
|
+
const ignores = [...userIgnores, "**/.yarn/**"];
|
|
513
|
+
configQueue.push([{ ignores }]);
|
|
514
|
+
return [...await Promise.all(configQueue).then((configs) => configs.flat()), ...userConfigs];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
//#endregion
|
|
518
|
+
export { astro, base, disableTypeChecked, importSort, imports, javascript, jsxA11y, next, node, qwik, react, regexp, shun_shobon, storybook, typescript, unicorn };
|
|
519
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["typescript","typescript","typescript","configQueue: Awaitable<ConfigItem[]>[]"],"sources":["../../src/eslint/globs.ts","../../src/eslint/utils.ts","../../src/eslint/configs/astro.ts","../../src/eslint/configs/base.ts","../../src/eslint/configs/disable-type-checked.ts","../../src/eslint/configs/import-sort.ts","../../src/eslint/configs/imports.ts","../../src/eslint/configs/javascript.ts","../../src/eslint/configs/jsx-a11y.ts","../../src/eslint/configs/next.ts","../../src/eslint/configs/node.ts","../../src/eslint/configs/qwik.ts","../../src/eslint/configs/react.ts","../../src/eslint/configs/regexp.ts","../../src/eslint/configs/storybook.ts","../../src/eslint/configs/typescript.ts","../../src/eslint/configs/unicorn.ts","../../src/eslint/factory.ts"],"sourcesContent":["export const GLOB_SRC_EXT = \"?([cm])[jt]s?(x)\";\nexport const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;\n\nexport const GLOB_JS_EXT = \"?([cm])js\";\nexport const GLOB_JS = `**/*.${GLOB_JS_EXT}`;\n\nexport const GLOB_JSX_EXT = \"?([cm])jsx\";\nexport const GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;\n\nexport const GLOB_TS_EXT = \"?([cm])ts\";\nexport const GLOB_TS = `**/*.${GLOB_TS_EXT}`;\n\nexport const GLOB_TSX_EXT = \"?([cm])tsx\";\nexport const GLOB_TSX = `**/*.${GLOB_TSX_EXT}`;\n\nexport const GLOB_DTS_EXT = \"?([cm])d.ts\";\nexport const GLOB_DTS = `**/*.${GLOB_DTS_EXT}`;\n\nexport const GLOB_STORYBOOK_EXT = `@(stories|story).${GLOB_TSX_EXT}`;\nexport const GLOB_STORYBOOK = `**/*.${GLOB_STORYBOOK_EXT}`;\n\nexport const GLOB_STORYBOOK_CONFIG = `**/.storybook/main.${GLOB_SRC_EXT}`;\n\nexport const GLOB_ASTRO_EXT = \"astro\";\nexport const GLOB_ASTRO = `**/*.${GLOB_ASTRO_EXT}`;\n","import type { Awaitable, Rules } from \"./types\";\n\nexport async function interopDefault<T>(\n\tmodule: Awaitable<T>,\n): Promise<T extends { default: infer U } ? U : T> {\n\tconst resolved = await module;\n\n\t// eslint-disable-next-line typescript/no-unsafe-return, typescript/no-unsafe-member-access, typescript/no-explicit-any\n\treturn (resolved as any).default ?? resolved;\n}\n\nexport function renameRules(\n\t// eslint-disable-next-line typescript/no-explicit-any\n\trules: Record<string, any>,\n\tfrom: string,\n\tto: string,\n): Rules {\n\treturn Object.fromEntries(\n\t\tObject.entries(rules).map(([key, value]) => [\n\t\t\tkey.startsWith(from) ? `${to}${key.slice(from.length)}` : key,\n\t\t\tvalue,\n\t\t]),\n\t);\n}\n","import { GLOB_ASTRO } from \"../globs\";\nimport type { ConfigItem, OptionsHasTypeScript, Rules } from \"../types\";\nimport { interopDefault } from \"../utils\";\n\nexport async function astro(\n\toptions: OptionsHasTypeScript = {},\n): Promise<ConfigItem[]> {\n\tconst { typescript = true } = options;\n\n\tconst [pluginAstro, parserAstro] = await Promise.all([\n\t\tinteropDefault(import(\"eslint-plugin-astro\")),\n\t\tinteropDefault(import(\"astro-eslint-parser\")),\n\t]);\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/astro/plugins\",\n\t\t\tplugins: {\n\t\t\t\tastro: pluginAstro,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/astro/rules\",\n\t\t\tfiles: [GLOB_ASTRO],\n\t\t\tlanguageOptions: {\n\t\t\t\tparser: parserAstro,\n\t\t\t\tparserOptions: {\n\t\t\t\t\tparser: typescript\n\t\t\t\t\t\t? await interopDefault(import(\"@typescript-eslint/parser\"))\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\textraFileExtensions: [\".astro\"],\n\t\t\t\t},\n\t\t\t\tglobals: {\n\t\t\t\t\tAstro: \"readonly\",\n\t\t\t\t\tFragment: \"readonly\",\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tprocessor:\n\t\t\t\tpluginAstro.processors[typescript ? \"client-side-ts\" : \"astro\"],\n\t\t\trules: {\n\t\t\t\t// Astroの推奨ルールを有効化\n\t\t\t\t...(pluginAstro.configs.recommended.at(-1)!.rules as Rules),\n\n\t\t\t\t// Astroのjsx-a11yの拡張ルール(strict)を有効化\n\t\t\t\t...(pluginAstro.configs[\"jsx-a11y-strict\"].at(-1)!.rules as Rules),\n\n\t\t\t\t// 曖昧なリンクのテキストを許可しない\n\t\t\t\t\"astro/jsx-a11y/anchor-ambiguous-text\": \"error\",\n\n\t\t\t\t// インタラクティブな要素にラベルが付いていないことを許可しない\n\t\t\t\t\"astro/jsx-a11y/control-has-associated-label\": \"error\",\n\n\t\t\t\t// html要素にlang属性が付与されていないことを許可しない\n\t\t\t\t\"astro/jsx-a11y/lang\": \"error\",\n\n\t\t\t\t// フォーカス可能な要素に `aria-hidden` 属性を付与することを許可しない\n\t\t\t\t\"astro/jsx-a11y/no-aria-hidden-on-focusable\": \"error\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import type { ConfigItem } from \"../types\";\n\nexport function base(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/base/setup\",\n\t\t\tlinterOptions: {\n\t\t\t\treportUnusedDisableDirectives: true,\n\t\t\t},\n\t\t},\n\t];\n}\n","import type { ConfigItem, OptionsDisableTypeCheckedFiles } from \"../types\";\nimport { interopDefault, renameRules } from \"../utils\";\n\nexport async function disableTypeChecked(\n\toptions: OptionsDisableTypeCheckedFiles = {},\n): Promise<ConfigItem[]> {\n\tconst { disableTypeCheckedFiles = [] } = options;\n\n\tconst { configs: configsTypeScript } = await interopDefault(\n\t\timport(\"typescript-eslint\"),\n\t);\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/disableTypeChecked/rules\",\n\t\t\tfiles: disableTypeCheckedFiles,\n\t\t\tlanguageOptions: {\n\t\t\t\tparserOptions: {\n\t\t\t\t\tprojectService: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...renameRules(\n\t\t\t\t\tconfigsTypeScript.disableTypeChecked.rules!,\n\t\t\t\t\t\"@typescript-eslint/\",\n\t\t\t\t\t\"typescript/\",\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t];\n}\n","import { pluginImportSort } from \"../plugins\";\nimport type { ConfigItem } from \"../types\";\n\nexport function importSort(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/importSort/setup\",\n\t\t\tplugins: {\n\t\t\t\t\"import-sort\": pluginImportSort,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/importSort/rules\",\n\t\t\trules: {\n\t\t\t\t// importをソートする\n\t\t\t\t\"import-sort/imports\": \"warn\",\n\n\t\t\t\t// exportをソートする\n\t\t\t\t\"import-sort/exports\": \"warn\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { pluginImport } from \"../plugins\";\nimport type { ConfigItem, OptionsHasTypeScript } from \"../types\";\nimport { renameRules } from \"../utils\";\n\nexport function imports(options: OptionsHasTypeScript): ConfigItem[] {\n\tconst { typescript = false } = options;\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/imports/setup\",\n\t\t\tplugins: {\n\t\t\t\timport: pluginImport,\n\t\t\t},\n\t\t\tsettings: {\n\t\t\t\t\"import-x/parsers\": {\n\t\t\t\t\tespree: [\".js\", \".cjs\", \".mjs\", \".jsx\"],\n\t\t\t\t\t...(typescript\n\t\t\t\t\t\t? { \"@typescript-eslint/parser\": [\".ts\", \".mts\", \".cts\", \".tsx\"] }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t\t\"import-x/extensions\": [\n\t\t\t\t\t\".js\",\n\t\t\t\t\t\".jsx\",\n\t\t\t\t\t...(typescript ? [\".ts\", \".tsx\", \".d.ts\"] : []),\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/imports/rules\",\n\t\t\trules: {\n\t\t\t\t...renameRules(\n\t\t\t\t\tpluginImport.configs.recommended.rules,\n\t\t\t\t\t\"import-x/\",\n\t\t\t\t\t\"import/\",\n\t\t\t\t),\n\n\t\t\t\t// import先のモジュールが存在するかチェックしない\n\t\t\t\t// TSの型チェックで十分なため\n\t\t\t\t\"import/namespace\": \"off\",\n\t\t\t\t\"import/no-unresolved\": \"off\",\n\t\t\t\t\"import/named\": \"off\",\n\n\t\t\t\t// type import時に`import type { foo } from \"foo\"`を強制\n\t\t\t\t\"import/consistent-type-specifier-style\": [\"warn\", \"prefer-top-level\"],\n\n\t\t\t\t// import文を一番上に書くのを強制\n\t\t\t\t\"import/first\": \"error\",\n\n\t\t\t\t// 同じパスからのimportをまとめる\n\t\t\t\t\"import/no-duplicates\": \"warn\",\n\n\t\t\t\t// default import時に`{ default as foo } from \"foo\"`と書くのを警告\n\t\t\t\t\"import/no-named-default\": \"warn\",\n\n\t\t\t\t// import文のパスを簡略化する\n\t\t\t\t\"import/no-useless-path-segments\": [\"warn\", { noUselessIndex: true }],\n\n\t\t\t\t// 自分自身をimportするのを禁止\n\t\t\t\t\"import/no-self-import\": \"error\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import globals from \"globals\";\n\nimport { configJs } from \"../plugins\";\nimport type { ConfigItem } from \"../types\";\n\nexport function javascript(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/javascript/rules\",\n\t\t\tlanguageOptions: {\n\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\tsourceType: \"module\",\n\t\t\t\tglobals: {\n\t\t\t\t\t...globals.es2021,\n\t\t\t\t\t...globals.browser,\n\t\t\t\t\t...globals.node,\n\t\t\t\t},\n\t\t\t\tparserOptions: {\n\t\t\t\t\tecmaFeatures: {\n\t\t\t\t\t\tjax: true,\n\t\t\t\t\t},\n\t\t\t\t\tecmaVersion: \"latest\",\n\t\t\t\t\tsourceType: \"module\",\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t...configJs.configs.recommended.rules,\n\n\t\t\t\t// Arrayの関数に`return`を忘れないようにする\n\t\t\t\t\"array-callback-return\": \"error\",\n\n\t\t\t\t// 常にtrue/falseになる式や短絡評価されない式を警告\n\t\t\t\t\"no-constant-binary-expression\": \"warn\",\n\n\t\t\t\t// コンストラクタの戻り値を許可しない\n\t\t\t\t\"no-constructor-return\": \"error\",\n\n\t\t\t\t// Symbol/BigIntでnewしない\n\t\t\t\t\"no-new-native-nonconstructor\": \"error\",\n\n\t\t\t\t// `Promise`のコンストラクタの戻り値を許可しない\n\t\t\t\t\"no-promise-executor-return\": \"error\",\n\n\t\t\t\t// 自分自身を比較する式を許可しない\n\t\t\t\t// NaNチェックは`Number.isNaN()`を使う\n\t\t\t\t\"no-self-compare\": \"error\",\n\n\t\t\t\t// ループの条件式の変数をループ内で変更していない場合に警告\n\t\t\t\t\"no-unmodified-loop-condition\": \"warn\",\n\n\t\t\t\t// 条件式が常にtrue/falseになる場合を警告\n\t\t\t\t// ただし、ループ内の条件式は除外\n\t\t\t\t\"no-constant-condition\": [\"error\", { checkLoops: false }],\n\n\t\t\t\t// 1回しかループしないループを警告\n\t\t\t\t\"no-unreachable-loop\": \"warn\",\n\n\t\t\t\t// 未使用のプライベートクラスメンバーを警告\n\t\t\t\t\"no-unused-private-class-members\": \"warn\",\n\n\t\t\t\t// `_`から始まる変数名以外の未使用変数を警告\n\t\t\t\t\"no-unused-vars\": [\n\t\t\t\t\t\"warn\",\n\t\t\t\t\t{\n\t\t\t\t\t\tvarsIgnorePattern: \"^_\",\n\t\t\t\t\t\targsIgnorePattern: \"^_\",\n\t\t\t\t\t},\n\t\t\t\t],\n\n\t\t\t\t// 競合が発生する可能性のある値の代入を許可しない\n\t\t\t\t\"require-atomic-updates\": \"error\",\n\n\t\t\t\t// 循環的複雑度を15以上を警告\n\t\t\t\t\"complexity\": [\"warn\", 15],\n\n\t\t\t\t// switch文のデフォルトケースを最後にする\n\t\t\t\t\"default-case-last\": \"error\",\n\n\t\t\t\t// デフォルト引数を最後にする\n\t\t\t\t\"default-param-last\": \"error\",\n\n\t\t\t\t// nullチェックを除いて厳密でない等価演算子を許可しない\n\t\t\t\t\"eqeqeq\": [\"error\", \"always\", { null: \"ignore\" }],\n\n\t\t\t\t// getter/setterをグループ化\n\t\t\t\t\"grouped-accessor-pairs\": [\"error\", \"setBeforeGet\"],\n\n\t\t\t\t// `console.log()`/`alert`を警告\n\t\t\t\t\"no-alert\": \"warn\",\n\t\t\t\t\"no-console\": [\"warn\", { allow: [\"warn\", \"error\"] }],\n\n\t\t\t\t// `else { return }`を警告\n\t\t\t\t\"no-else-return\": \"warn\",\n\n\t\t\t\t// `!!`や`~`を使った短縮型変換を許可しない\n\t\t\t\t\"no-implicit-coercion\": \"error\",\n\n\t\t\t\t// 不要なifのネストを許可しない\n\t\t\t\t\"no-lonely-if\": \"error\",\n\n\t\t\t\t// 複数の代入を許可しない\n\t\t\t\t\"no-multi-assign\": \"error\",\n\n\t\t\t\t// 複数行文字列を警告\n\t\t\t\t\"no-multi-str\": \"warn\",\n\n\t\t\t\t// `Function`/`Object`/`String`/`Number`/`Boolean`のコンストラクタを許可しない\n\t\t\t\t\"no-new-func\": \"error\",\n\t\t\t\t\"no-new-wrappers\": \"error\",\n\n\t\t\t\t// 関数の引数を再代入することを許可しない\n\t\t\t\t\"no-param-reassign\": \"error\",\n\n\t\t\t\t// インクリメント/デクリメント演算子を許可しない\n\t\t\t\t\"no-plusplus\": \"error\",\n\n\t\t\t\t// `throw` に文字列を渡さない\n\t\t\t\t\"no-throw-literal\": \"error\",\n\n\t\t\t\t// 不要な三項演算子を警告\n\t\t\t\t\"no-unneeded-ternary\": \"warn\",\n\n\t\t\t\t// 未使用の式を警告\n\t\t\t\t\"no-unused-expressions\": \"warn\",\n\n\t\t\t\t// 意味の無いコンストラクタを警告\n\t\t\t\t\"no-useless-constructor\": \"warn\",\n\n\t\t\t\t// 意味の無い`return`を警告\n\t\t\t\t\"no-useless-return\": \"warn\",\n\n\t\t\t\t// `var`を許可しない\n\t\t\t\t\"no-var\": \"error\",\n\n\t\t\t\t// オブジェクトのショートハンド記法を使用していない場合は警告\n\t\t\t\t\"object-shorthand\": \"warn\",\n\n\t\t\t\t// 演算子のショートハンド記法を使用していない場合は警告\n\t\t\t\t\"operator-assignment\": \"warn\",\n\n\t\t\t\t// コールバック関数をアロー関数にする\n\t\t\t\t\"prefer-arrow-callback\": \"warn\",\n\n\t\t\t\t// `const`を使用する\n\t\t\t\t\"prefer-const\": \"warn\",\n\n\t\t\t\t// 名前付きキャプチャグループを使用する\n\t\t\t\t\"prefer-named-capture-group\": \"warn\",\n\n\t\t\t\t// `Number.parseInt()`を使用する\n\t\t\t\t\"prefer-numeric-literals\": \"error\",\n\n\t\t\t\t// `hasOwnProperty`の使用を許可しない\n\t\t\t\t\"prefer-object-has-own\": \"error\",\n\n\t\t\t\t// スプレッド構文を使用する\n\t\t\t\t\"prefer-object-spread\": \"warn\",\n\n\t\t\t\t// `Promise`の`reject`には`Error`オブジェクトを渡す\n\t\t\t\t\"prefer-promise-reject-errors\": \"error\",\n\n\t\t\t\t// なるべく正規表現リテラルを使用する\n\t\t\t\t\"prefer-regex-literals\": \"warn\",\n\n\t\t\t\t// `arguments`/`.apply()`の代わりに`...args`を使用する\n\t\t\t\t\"prefer-rest-params\": \"warn\",\n\t\t\t\t\"prefer-spread\": \"warn\",\n\n\t\t\t\t// `parseInt`には基数を渡す\n\t\t\t\t\"radix\": \"error\",\n\n\t\t\t\t// 正規表現のユニコードフラグを使用する\n\t\t\t\t\"require-unicode-regexp\": \"warn\",\n\n\t\t\t\t// シンボルに名前を付ける\n\t\t\t\t\"symbol-description\": \"warn\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { pluginJsxA11y } from \"../plugins\";\nimport type { ConfigItem } from \"../types\";\n\nexport function jsxA11y(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/jsxA11y/setup\",\n\t\t\tplugins: {\n\t\t\t\t// eslint-disable-next-line typescript/no-unsafe-assignment\n\t\t\t\t\"jsx-a11y\": pluginJsxA11y,\n\t\t\t},\n\t\t\tsettings: {\n\t\t\t\t\"jsx-a11y\": {\n\t\t\t\t\tpolymorphicPropName: \"as\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t];\n}\n","import { GLOB_SRC } from \"../globs\";\nimport type { ConfigItem } from \"../types\";\nimport { interopDefault, renameRules } from \"../utils\";\n\nexport async function next(): Promise<ConfigItem[]> {\n\tconst pluginNext = await interopDefault(import(\"@next/eslint-plugin-next\"));\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/next/setup\",\n\t\t\tplugins: {\n\t\t\t\tnext: pluginNext,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/next/rules\",\n\t\t\tfiles: [GLOB_SRC],\n\t\t\trules: {\n\t\t\t\t// Next.jsの推奨ルールを有効化\n\t\t\t\t...renameRules(\n\t\t\t\t\tpluginNext.configs.recommended.rules!,\n\t\t\t\t\t\"@next/next/\",\n\t\t\t\t\t\"next/\",\n\t\t\t\t),\n\n\t\t\t\t// Next.jsの更に厳格なルールを有効化\n\t\t\t\t...renameRules(\n\t\t\t\t\tpluginNext.configs[\"core-web-vitals\"].rules!,\n\t\t\t\t\t\"@next/next/\",\n\t\t\t\t\t\"next/\",\n\t\t\t\t),\n\n\t\t\t\t// `img`要素を使う場合もあるので無効化\n\t\t\t\t\"next/no-img-element\": \"off\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { pluginNode } from \"../plugins\";\nimport type { ConfigItem } from \"../types\";\n\nexport function node(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/node/setup\",\n\t\t\tplugins: {\n\t\t\t\tnode: pluginNode,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/node/rules\",\n\t\t\trules: {\n\t\t\t\t\"node/no-deprecated-api\": \"error\",\n\t\t\t\t\"node/no-exports-assign\": \"error\",\n\t\t\t\t\"node/no-path-concat\": \"error\",\n\t\t\t\t\"node/no-process-exit\": \"error\",\n\t\t\t\t\"node/no-unpublished-bin\": \"error\",\n\t\t\t\t\"node/no-sync\": \"error\",\n\t\t\t\t\"node/process-exit-as-throw\": \"error\",\n\n\t\t\t\t\"node/prefer-global/console\": \"error\",\n\t\t\t\t\"node/prefer-global/text-decoder\": \"error\",\n\t\t\t\t\"node/prefer-global/text-encoder\": \"error\",\n\t\t\t\t\"node/prefer-global/url\": \"error\",\n\t\t\t\t\"node/prefer-global/url-search-params\": \"error\",\n\n\t\t\t\t\"node/prefer-promises/dns\": \"error\",\n\t\t\t\t\"node/prefer-promises/fs\": \"error\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { GLOB_JSX, GLOB_TSX } from \"../globs\";\nimport type { ConfigItem, Rules } from \"../types\";\nimport { interopDefault } from \"../utils\";\n\nexport async function qwik(): Promise<ConfigItem[]> {\n\t// @ts-expect-error: This package doesn't have types\n\t// eslint-disable-next-line typescript/no-unsafe-assignment\n\tconst pluginQwik = await interopDefault(import(\"eslint-plugin-qwik\"));\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/qwik/setup\",\n\t\t\tplugins: {\n\t\t\t\t// eslint-disable-next-line typescript/no-unsafe-assignment\n\t\t\t\tqwik: pluginQwik,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/qwik/rules\",\n\t\t\tfiles: [GLOB_JSX, GLOB_TSX],\n\t\t\trules: {\n\t\t\t\t// qwikの推奨ルールを有効化\n\t\t\t\t// eslint-disable-next-line typescript/no-unsafe-member-access\n\t\t\t\t...(pluginQwik.configs.recommended.rules as Rules),\n\n\t\t\t\t// qwikの厳格ルールを有効化\n\t\t\t\t// eslint-disable-next-line typescript/no-unsafe-member-access\n\t\t\t\t...(pluginQwik.configs.strict.rules as Rules),\n\t\t\t},\n\t\t},\n\t];\n}\n","import { GLOB_JSX, GLOB_TSX } from \"../globs\";\nimport { pluginJsxA11y } from \"../plugins\";\nimport type { ConfigItem, OptionsHasTypeScript, Rules } from \"../types\";\nimport { interopDefault } from \"../utils\";\n\nexport async function react(\n\toptions: OptionsHasTypeScript = {},\n): Promise<ConfigItem[]> {\n\tconst { typescript = false } = options;\n\n\tconst [pluginReact, pluginReactHooks] = await Promise.all([\n\t\tinteropDefault(import(\"eslint-plugin-react\")),\n\t\tinteropDefault(import(\"eslint-plugin-react-hooks\")),\n\t]);\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/react/setup\",\n\t\t\tplugins: {\n\t\t\t\t\"react\": pluginReact,\n\n\t\t\t\t\"react-hooks\": pluginReactHooks,\n\t\t\t},\n\t\t\tsettings: {\n\t\t\t\treact: {\n\t\t\t\t\tversion: \"detect\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/react/rules\",\n\t\t\tfiles: [GLOB_JSX, GLOB_TSX],\n\t\t\trules: {\n\t\t\t\t// reactの推奨ルールを有効化\n\t\t\t\t...(pluginReact.configs.recommended.rules as Rules),\n\n\t\t\t\t// React v17以降のJSX Runtimeを使う場合の不要なルールを無効化\n\t\t\t\t...(pluginReact.configs[\"jsx-runtime\"].rules as Rules),\n\n\t\t\t\t// React Hooksの推奨ルールを有効化\n\t\t\t\t...(pluginReactHooks.configs.recommended.rules as Rules),\n\n\t\t\t\t// JSX A11yの厳格なルールを有効化\n\t\t\t\t// eslint-disable-next-line typescript/no-unsafe-member-access\n\t\t\t\t...(pluginJsxA11y.configs.strict.rules as Rules),\n\n\t\t\t\t// その他必要なものを有効化\n\n\t\t\t\t// `onClick`などのイベントハンドラーの命名規則をチェック\n\t\t\t\t\"react/jsx-handler-names\": \"warn\",\n\n\t\t\t\t// ContextのProviderに即値を渡さないようにする\n\t\t\t\t// 即値で渡すと、Providerが含まれるコンポーネントの再描画時に新しい値が渡されてしまい、再描画が発生する\n\t\t\t\t\"react/jsx-no-constructed-context-values\": \"warn\",\n\n\t\t\t\t// `React.Fragment`を省略可能な場合は省略する\n\t\t\t\t// ただし、フラグメントのみの場合は許可する\n\t\t\t\t\"react/jsx-no-useless-fragment\": [\"warn\", { allowExpressions: true }],\n\n\t\t\t\t// rel 属性の値をチェック\n\t\t\t\t\"react/no-invalid-html-attribute\": \"warn\",\n\n\t\t\t\t// propsのデフォルト値としてobjectやarrayのリテラルを使用しないようにする\n\t\t\t\t// 使用してしまうと、再描画が発生する可能性がある\n\t\t\t\t\"react/no-object-type-as-default-prop\": \"warn\",\n\n\t\t\t\t// コンポーネント内でコンポーネントを定義するのを許可しない\n\t\t\t\t\"react/no-unstable-nested-components\": \"error\",\n\n\t\t\t\t...(typescript\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t// TypeScriptの型チェックで検出できるものは無効化\n\n\t\t\t\t\t\t\t// propTypesはTSで代替できるので無効化\n\t\t\t\t\t\t\t\"react/prop-types\": \"off\",\n\n\t\t\t\t\t\t\t// HTMLの属性名として認識されていない属性名を許可\n\t\t\t\t\t\t\t// TSで型チェックしているので不要\n\t\t\t\t\t\t\t\"react/no-unknown-property\": \"off\",\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\n\t\t\t\t// 曖昧なリンクのテキストを許可しない\n\t\t\t\t\"jsx-a11y/anchor-ambiguous-text\": \"error\",\n\n\t\t\t\t// インタラクティブな要素にラベルが付いていないことを許可しない\n\t\t\t\t\"jsx-a11y/control-has-associated-label\": \"error\",\n\n\t\t\t\t// html要素にlang属性が付与されていないことを許可しない\n\t\t\t\t\"jsx-a11y/lang\": \"error\",\n\n\t\t\t\t// フォーカス可能な要素に `aria-hidden` 属性を付与することを許可しない\n\t\t\t\t\"jsx-a11y/no-aria-hidden-on-focusable\": \"error\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { pluginRegexp } from \"../plugins\";\nimport type { ConfigItem } from \"../types\";\n\nexport function regexp(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/regexp/setup\",\n\t\t\tplugins: {\n\t\t\t\tregexp: pluginRegexp,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/regexp/rules\",\n\t\t\trules: {\n\t\t\t\t// 推奨ルールを使用\n\t\t\t\t...pluginRegexp.configs[\"flat/recommended\"].rules,\n\t\t\t},\n\t\t},\n\t];\n}\n","import { GLOB_STORYBOOK, GLOB_STORYBOOK_CONFIG } from \"../globs\";\nimport type { ConfigItem } from \"../types\";\nimport { interopDefault } from \"../utils\";\n\nexport async function storybook(): Promise<ConfigItem[]> {\n\tconst pluginStorybook = await interopDefault(\n\t\timport(\"eslint-plugin-storybook\"),\n\t);\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/storybook/setup\",\n\t\t\tplugins: {\n\t\t\t\tstorybook: pluginStorybook,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/storybook/rules\",\n\t\t\tfiles: [GLOB_STORYBOOK],\n\t\t\trules: {\n\t\t\t\t// Storybookの推奨ルールから拝借\n\t\t\t\t\"import/no-anonymous-default-export\": \"off\",\n\t\t\t\t\"storybook/await-interactions\": \"error\",\n\t\t\t\t\"storybook/context-in-play-function\": \"error\",\n\t\t\t\t\"storybook/default-exports\": \"error\",\n\t\t\t\t\"storybook/hierarchy-separator\": \"warn\",\n\t\t\t\t\"storybook/no-redundant-story-name\": \"warn\",\n\t\t\t\t\"storybook/prefer-pascal-case\": \"warn\",\n\t\t\t\t\"storybook/story-exports\": \"error\",\n\t\t\t\t\"storybook/use-storybook-expect\": \"error\",\n\t\t\t\t\"storybook/use-storybook-testing-library\": \"error\",\n\t\t\t},\n\t\t},\n\t\t// Storybookの設定ファイルへのルール\n\t\t{\n\t\t\tname: \"shun-shobon/storybook/config-rules\",\n\t\t\tfiles: [GLOB_STORYBOOK_CONFIG],\n\t\t\trules: {\n\t\t\t\t\"storybook/no-uninstalled-addons\": \"error\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { GLOB_DTS, GLOB_SRC, GLOB_TS, GLOB_TSX } from \"../globs\";\nimport type { ConfigItem, OptionsComponentExts, Rules } from \"../types\";\nimport { renameRules } from \"../utils\";\n\nexport async function typescript(\n\toptions: OptionsComponentExts = {},\n): Promise<ConfigItem[]> {\n\tconst { componentExts = [] } = options;\n\n\tconst {\n\t\tplugin: pluginTypeScript,\n\t\tparser: parserTypeScript,\n\t\tconfigs: configsTypeScript,\n\t} = await import(\"typescript-eslint\");\n\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/typescript/setup\",\n\t\t\tplugins: {\n\t\t\t\ttypescript: pluginTypeScript,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/typescript/rules\",\n\t\t\tfiles: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],\n\t\t\tlanguageOptions: {\n\t\t\t\tparser: parserTypeScript,\n\t\t\t\tparserOptions: {\n\t\t\t\t\tprojectService: {\n\t\t\t\t\t\tallowDefaultProject: [\"./*.js\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\trules: {\n\t\t\t\t// 厳密なルール + 型チェックのルールを有効化\n\t\t\t\t...renameRules(\n\t\t\t\t\tconfigsTypeScript.strictTypeChecked.at(-1)!.rules!,\n\t\t\t\t\t\"@typescript-eslint/\",\n\t\t\t\t\t\"typescript/\",\n\t\t\t\t),\n\n\t\t\t\t// コーディング規約 + 型チェックのルールを有効化\n\t\t\t\t...renameRules(\n\t\t\t\t\tconfigsTypeScript.stylisticTypeChecked.at(-1)!.rules!,\n\t\t\t\t\t\"@typescript-eslint/\",\n\t\t\t\t\t\"typescript/\",\n\t\t\t\t),\n\n\t\t\t\t// exportされている関数は型の明示を必須にする\n\t\t\t\t\"typescript/explicit-module-boundary-types\": \"warn\",\n\n\t\t\t\t// 型をexportする際に`type`の付与を必須にする\n\t\t\t\t\"typescript/consistent-type-exports\": [\n\t\t\t\t\t\"error\",\n\t\t\t\t\t{\n\t\t\t\t\t\tfixMixedExportsWithInlineTypeSpecifier: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\n\t\t\t\t// 型をimportする際に`type`の付与を必須にする\n\t\t\t\t\"typescript/consistent-type-imports\": \"error\",\n\n\t\t\t\t// `_`から始まる変数名以外の未使用変数を警告\n\t\t\t\t\"typescript/no-unused-vars\": [\n\t\t\t\t\t\"warn\",\n\t\t\t\t\t{\n\t\t\t\t\t\tvarsIgnorePattern: \"^_\",\n\t\t\t\t\t\targsIgnorePattern: \"^_\",\n\t\t\t\t\t},\n\t\t\t\t],\n\n\t\t\t\t// 副作用の可能性のあるtype importを警告\n\t\t\t\t\"typescript/no-import-type-side-effects\": \"warn\",\n\n\t\t\t\t// なるべくreadonlyを付与する\n\t\t\t\t\"typescript/prefer-readonly\": \"warn\",\n\n\t\t\t\t// `Promise`を返す関数は`async`を付与する\n\t\t\t\t\"typescript/promise-function-async\": \"error\",\n\n\t\t\t\t// ソートでは必ず比較関数を渡す\n\t\t\t\t\"typescript/require-array-sort-compare\": \"error\",\n\n\t\t\t\t// `return await`を使う\n\t\t\t\t// 一貫性のためと、awaitが無くなったときにasyncを外すのは面倒なため\n\t\t\t\t// また、スタックトレースが読みやすくなる\n\t\t\t\t\"typescript/return-await\": [\"warn\", \"always\"],\n\n\t\t\t\t\"typescript/no-unnecessary-condition\": [\n\t\t\t\t\t\"warn\",\n\t\t\t\t\t{ allowConstantLoopConditions: true },\n\t\t\t\t],\n\n\t\t\t\t// null assertion `!` を許可\n\t\t\t\t\"typescript/no-non-null-assertion\": \"off\",\n\n\t\t\t\t// template stringへの変数埋め込みの制限をstrictよりも緩和\n\t\t\t\t\"typescript/restrict-template-expressions\": [\n\t\t\t\t\t\"error\",\n\t\t\t\t\t{\n\t\t\t\t\t\tallowAny: true,\n\t\t\t\t\t\tallowBoolean: false,\n\t\t\t\t\t\tallowNullish: false,\n\t\t\t\t\t\tallowNumber: true,\n\t\t\t\t\t\tallowRegExp: false,\n\t\t\t\t\t\tallowNever: false,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/typescript/disables/eslint-recommended\",\n\t\t\tfiles: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],\n\t\t\trules: {\n\t\t\t\t// ESLintの推奨ルールからTypeScriptで検証可能なものを無効化\n\t\t\t\t...(configsTypeScript.eslintRecommended.rules as Rules),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/typescript/disables/dts\",\n\t\t\tfiles: [GLOB_DTS],\n\t\t\trules: {\n\t\t\t\t// `import`の重複を許可\n\t\t\t\t\"import/no-duplicates\": \"off\",\n\n\t\t\t\t// `///`での参照を許可\n\t\t\t\t\"typescript/triple-slash-reference\": \"off\",\n\t\t\t},\n\t\t},\n\t];\n}\n","import { pluginUnicorn } from \"../plugins\";\nimport type { ConfigItem, Rules } from \"../types\";\n\nexport function unicorn(): ConfigItem[] {\n\treturn [\n\t\t{\n\t\t\tname: \"shun-shobon/unicorn/setup\",\n\t\t\tplugins: {\n\t\t\t\tunicorn: pluginUnicorn,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"shun-shobon/unicorn/rules\",\n\t\t\trules: {\n\t\t\t\t...(pluginUnicorn.configs.recommended.rules as Rules),\n\n\t\t\t\t// Prettierで整形できるルールは無効化\n\t\t\t\t\"unicorn/empty-brace-spaces\": \"off\",\n\t\t\t\t\"unicorn/no-nested-ternary\": \"off\",\n\t\t\t\t\"unicorn/number-literal-case\": \"off\",\n\n\t\t\t\t// unicornの推奨ルールから不要なものを無効化\n\n\t\t\t\t// コンポーネント内の関数など、スコープを小さくしておきたい場合があるので無効化\n\t\t\t\t\"unicorn/consistent-function-scoping\": \"off\",\n\n\t\t\t\t// ファイルの名前はコンポーネントなどで形式が変化するため無効化\n\t\t\t\t\"unicorn/filename-case\": \"off\",\n\n\t\t\t\t// 直接関数を渡したほうが簡潔に書ける場合があるので無効化\n\t\t\t\t\"unicorn/no-array-callback-reference\": \"off\",\n\n\t\t\t\t// `.forEach()`のほうが簡潔に書ける場合があるので無効化\n\t\t\t\t\"unicorn/no-array-for-each\": \"off\",\n\n\t\t\t\t// `.reduce()`/`.reduceRight()`は使ったほうが簡潔に書ける場合があるので無効化\n\t\t\t\t\"unicorn/no-array-reduce\": \"off\",\n\n\t\t\t\t// 否定形の方が簡潔に書ける場合があるので無効化\n\t\t\t\t\"unicorn/no-negated-condition\": \"off\",\n\n\t\t\t\t// nullも使う場合があるので無効化\n\t\t\t\t\"unicorn/no-null\": \"off\",\n\n\t\t\t\t// undefinedを使いたい場合があるので無効化\n\t\t\t\t\"unicorn/no-useless-undefined\": \"off\",\n\n\t\t\t\t// CommonJSを使う場合もあるため無効化\n\t\t\t\t\"unicorn/prefer-module\": \"off\",\n\n\t\t\t\t// `[...array].map()`は~~ダサい~~ので無効化\n\t\t\t\t\"unicorn/prefer-spread\": \"off\",\n\n\t\t\t\t// 略語の方が簡潔に書ける場合があるので無効化\n\t\t\t\t\"unicorn/prevent-abbreviations\": \"off\",\n\n\t\t\t\t// switch文のcase節を常にブロックにするのは冗長なので必要なときのみブロックにする\n\t\t\t\t\"unicorn/switch-case-braces\": [\"warn\", \"avoid\"],\n\t\t\t},\n\t\t},\n\t];\n}\n","import { isPackageExists } from \"local-pkg\";\n\nimport {\n\tastro,\n\tbase,\n\tdisableTypeChecked,\n\timports,\n\timportSort,\n\tjavascript,\n\tjsxA11y,\n\tnext,\n\tnode,\n\tqwik,\n\treact,\n\tregexp,\n\tstorybook,\n\ttypescript,\n\tunicorn,\n} from \"./configs\";\nimport { GLOB_ASTRO, GLOB_ASTRO_EXT, GLOB_JS, GLOB_JSX } from \"./globs\";\nimport type { Awaitable, ConfigItem, OptionsConfig } from \"./types\";\nimport { interopDefault } from \"./utils\";\n\n// eslint-disable-next-line complexity\nexport async function shun_shobon(\n\toptions: OptionsConfig = {},\n\t...userConfigs: ConfigItem[]\n): Promise<ConfigItem[]> {\n\tconst {\n\t\tgitignore: enableGitignore = true,\n\t\tignores: userIgnores = [],\n\t\ttypescript: enableTypescript = isPackageExists(\"typescript\"),\n\t\treact: enableReact = isPackageExists(\"react\"),\n\t\tnext: enableNext = isPackageExists(\"next\"),\n\t\tqwik: enableQwik = isPackageExists(\"@builder.io/qwik\"),\n\t\tastro: enableAstro = isPackageExists(\"astro\"),\n\t\tstorybook: enableStorybook = isPackageExists(\"storybook\"),\n\t\tcomponentExts = [],\n\t\tdisableTypeCheckedFiles = [],\n\t} = options;\n\n\tconst configQueue: Awaitable<ConfigItem[]>[] = [];\n\n\tif (enableGitignore) {\n\t\tconfigQueue.push(\n\t\t\tinteropDefault(import(\"eslint-config-flat-gitignore\")).then(\n\t\t\t\t(gitignore) => [\n\t\t\t\t\tgitignore(\n\t\t\t\t\t\ttypeof enableGitignore !== \"boolean\"\n\t\t\t\t\t\t\t? { name: \"shun-shobon/gitignore/setup\", ...enableGitignore }\n\t\t\t\t\t\t\t: { name: \"shun-shobon/gitignore/setup\" },\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t),\n\t\t);\n\t}\n\n\t// Preprocess\n\tif (enableAstro) {\n\t\tcomponentExts.push(GLOB_ASTRO_EXT);\n\t\tdisableTypeCheckedFiles.push(GLOB_ASTRO);\n\t}\n\n\t// Process\n\t// basic configs\n\tconfigQueue.push(\n\t\tbase(),\n\t\tjavascript(),\n\t\timports({ typescript: enableTypescript }),\n\t\timportSort(),\n\t\tunicorn(),\n\t\tregexp(),\n\t\tnode(),\n\t\tjsxA11y(),\n\t);\n\tif (enableTypescript) {\n\t\tconfigQueue.push(\n\t\t\ttypescript({\n\t\t\t\tcomponentExts,\n\t\t\t}),\n\t\t);\n\t\tdisableTypeCheckedFiles.push(GLOB_JS, GLOB_JSX);\n\t}\n\tif (enableReact) {\n\t\tconfigQueue.push(\n\t\t\treact({\n\t\t\t\ttypescript: enableTypescript,\n\t\t\t}),\n\t\t);\n\t}\n\tif (enableNext) {\n\t\tconfigQueue.push(next());\n\t}\n\tif (enableQwik) {\n\t\tconfigQueue.push(qwik());\n\t}\n\tif (enableAstro) {\n\t\tconfigQueue.push(\n\t\t\tastro({\n\t\t\t\ttypescript: enableTypescript,\n\t\t\t}),\n\t\t);\n\t}\n\tif (enableStorybook) {\n\t\tconfigQueue.push(storybook());\n\t}\n\n\t// Postprocess\n\tif (enableTypescript) {\n\t\tconfigQueue.push(disableTypeChecked({ disableTypeCheckedFiles }));\n\t}\n\n\tconst ignores = [...userIgnores, \"**/.yarn/**\"];\n\tconfigQueue.push([\n\t\t{\n\t\t\tignores,\n\t\t},\n\t]);\n\n\t// eslint-disable-next-line typescript/await-thenable\n\tconst configs = await Promise.all(configQueue).then((configs) =>\n\t\tconfigs.flat(),\n\t);\n\n\treturn [...configs, ...userConfigs];\n}\n"],"mappings":";;;;;;;;;;;AAAA,MAAa,eAAe;AAC5B,MAAa,WAAW,QAAQ;AAEhC,MAAa,cAAc;AAC3B,MAAa,UAAU,QAAQ;AAE/B,MAAa,eAAe;AAC5B,MAAa,WAAW,QAAQ;AAEhC,MAAa,cAAc;AAC3B,MAAa,UAAU,QAAQ;AAE/B,MAAa,eAAe;AAC5B,MAAa,WAAW,QAAQ;AAEhC,MAAa,eAAe;AAC5B,MAAa,WAAW,QAAQ;AAEhC,MAAa,qBAAqB,oBAAoB;AACtD,MAAa,iBAAiB,QAAQ;AAEtC,MAAa,wBAAwB,sBAAsB;AAE3D,MAAa,iBAAiB;AAC9B,MAAa,aAAa,QAAQ;;;;ACtBlC,eAAsB,eACrB,QACkD;CAClD,MAAM,WAAW,MAAM;AAGvB,QAAQ,SAAiB,WAAW;;AAGrC,SAAgB,YAEf,OACA,MACA,IACQ;AACR,QAAO,OAAO,YACb,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,KAAK,WAAW,CAC3C,IAAI,WAAW,KAAK,GAAG,GAAG,KAAK,IAAI,MAAM,KAAK,OAAO,KAAK,KAC1D,MACA,CAAC,CACF;;;;;AClBF,eAAsB,MACrB,UAAgC,EAAE,EACV;CACxB,MAAM,EAAE,2BAAa,SAAS;CAE9B,MAAM,CAAC,aAAa,eAAe,MAAM,QAAQ,IAAI,CACpD,eAAe,OAAO,uBAAuB,EAC7C,eAAe,OAAO,uBAAuB,CAC7C,CAAC;AAEF,QAAO,CACN;EACC,MAAM;EACN,SAAS,EACR,OAAO,aACP;EACD,EACD;EACC,MAAM;EACN,OAAO,CAAC,WAAW;EACnB,iBAAiB;GAChB,QAAQ;GACR,eAAe;IACd,QAAQA,eACL,MAAM,eAAe,OAAO,6BAA6B,GACzD;IACH,qBAAqB,CAAC,SAAS;IAC/B;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