@brnshkr/config 0.0.1-alpha.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/LICENSE +21 -0
- package/README.md +659 -0
- package/conf/eslint.config.mjs.example +1 -0
- package/conf/stylelint.config.mjs.example +1 -0
- package/conf/tsconfig.json +74 -0
- package/conf/tsconfig.json.example +3 -0
- package/dist/eslint/index.d.mts +15518 -0
- package/dist/eslint/index.mjs +2574 -0
- package/dist/scripts/eslint.mjs +18 -0
- package/dist/scripts/stylelint.mjs +31 -0
- package/dist/shared.mjs +394 -0
- package/dist/stylelint/index.d.mts +97 -0
- package/dist/stylelint/index.mjs +402 -0
- package/package.json +289 -0
|
@@ -0,0 +1,2574 @@
|
|
|
1
|
+
import { _ as resolvePackages, a as objectAssign, b as packageOrganizationUpper, c as objectFromEntries, g as isModuleEnabled, h as MODULES, i as isModuleEnabledByDefault, l as objectKeys, n as MAX_LEN, o as objectEntries, r as GLOB_IGNORES, s as objectFreeze, t as INDENT, v as setModuleEnabled, x as version, y as packageOrganization } from "../shared.mjs";
|
|
2
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
+
import jsEslint from "@eslint/js";
|
|
4
|
+
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
5
|
+
import globals from "globals";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
|
|
9
|
+
//#region src/js/eslint/types/scopes.ts
|
|
10
|
+
const MAIN_SCOPES = {
|
|
11
|
+
[packageOrganizationUpper]: "builtin",
|
|
12
|
+
COMMENTS: "comments",
|
|
13
|
+
CSS: "css",
|
|
14
|
+
IGNORES: "ignores",
|
|
15
|
+
IMPORT: "import",
|
|
16
|
+
JAVASCRIPT: "javascript",
|
|
17
|
+
JSDOC: "jsdoc",
|
|
18
|
+
JSON: "json",
|
|
19
|
+
MARKDOWN: "markdown",
|
|
20
|
+
NODE: "node",
|
|
21
|
+
OVERRIDES: "overrides",
|
|
22
|
+
PERFECTIONIST: "perfectionist",
|
|
23
|
+
REGEXP: "regexp",
|
|
24
|
+
STYLE: "style",
|
|
25
|
+
SVELTE: "svelte",
|
|
26
|
+
TEST: "test",
|
|
27
|
+
TOML: "toml",
|
|
28
|
+
TYPESCRIPT: "typescript",
|
|
29
|
+
UNICORN: "unicorn",
|
|
30
|
+
USERLAND: "userland",
|
|
31
|
+
YAML: "yaml"
|
|
32
|
+
};
|
|
33
|
+
const SUB_SCOPES = {
|
|
34
|
+
BASE: "base",
|
|
35
|
+
DEVELOPMENT: "development",
|
|
36
|
+
EXAMPLES: "examples",
|
|
37
|
+
GIT: "git",
|
|
38
|
+
GLOBAL: "global",
|
|
39
|
+
PARSER: "parser",
|
|
40
|
+
PROCESSOR: "processor",
|
|
41
|
+
RULES: "rules",
|
|
42
|
+
SETUP: "setup",
|
|
43
|
+
UNNAMED: "unnamed"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/js/eslint/utils/config.ts
|
|
48
|
+
const buildConfigName = (mainScope, subScope) => [
|
|
49
|
+
packageOrganization,
|
|
50
|
+
mainScope,
|
|
51
|
+
subScope
|
|
52
|
+
].filter(Boolean).join("/");
|
|
53
|
+
const renameRules = (rules, map) => Object.fromEntries(Object.entries(rules ?? {}).map(([key, value]) => {
|
|
54
|
+
for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
|
|
55
|
+
return [key, value];
|
|
56
|
+
}));
|
|
57
|
+
const isValidGlobalAdditionalConfigKey = (key) => [
|
|
58
|
+
"name",
|
|
59
|
+
"languageOptions",
|
|
60
|
+
"linterOptions",
|
|
61
|
+
"processor",
|
|
62
|
+
"plugins",
|
|
63
|
+
"rules",
|
|
64
|
+
"settings"
|
|
65
|
+
].includes(key);
|
|
66
|
+
const getGlobalAdditionalConfig = (options) => {
|
|
67
|
+
const config = {};
|
|
68
|
+
for (const [key, value] of objectEntries(options)) if (isValidGlobalAdditionalConfigKey(key)) config[key] = value;
|
|
69
|
+
if (Object.keys(config).length === 0) return;
|
|
70
|
+
config.name ??= buildConfigName(MAIN_SCOPES.USERLAND, SUB_SCOPES.GLOBAL);
|
|
71
|
+
return config;
|
|
72
|
+
};
|
|
73
|
+
const ensureNamesForSyncAdditionalConfigs = (additionalConfigs) => {
|
|
74
|
+
const validConfigs = [];
|
|
75
|
+
let currentIndex = 1;
|
|
76
|
+
for (const config of additionalConfigs) {
|
|
77
|
+
if (config instanceof Promise || typeof config.name === "string" && config.name.trim().length > 0) {
|
|
78
|
+
validConfigs.push(config);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
validConfigs.push(Object.keys(config).length > 0 ? config : void 0);
|
|
82
|
+
config.name = buildConfigName(MAIN_SCOPES.USERLAND, `${SUB_SCOPES.UNNAMED}-${String(currentIndex)}`);
|
|
83
|
+
currentIndex += 1;
|
|
84
|
+
}
|
|
85
|
+
return validConfigs;
|
|
86
|
+
};
|
|
87
|
+
const getUserConfigs = (resolvedOptions, additionalConfigs) => [getGlobalAdditionalConfig(resolvedOptions), ...ensureNamesForSyncAdditionalConfigs(additionalConfigs)];
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/js/eslint/utils/globs.ts
|
|
91
|
+
const GLOB_CJS = "**/*.cjs";
|
|
92
|
+
const GLOB_TS = "**/*.?(c|m)ts?(x)";
|
|
93
|
+
const GLOB_DTS = "**/*.d.?(c|m)ts";
|
|
94
|
+
const GLOB_SVELTE = "**/*.svelte";
|
|
95
|
+
const GLOB_SVELTE_SCRIPT = "**/*.svelte.[jt]s";
|
|
96
|
+
const GLOB_JSON = "**/*.json";
|
|
97
|
+
const GLOB_JSONC = "**/*.jsonc";
|
|
98
|
+
const GLOB_JSON5 = "**/*.json5";
|
|
99
|
+
const GLOB_YAML = "**/*.y?(a)ml";
|
|
100
|
+
const GLOB_TOML = "**/*.toml";
|
|
101
|
+
const GLOB_CSS = "**/*.css";
|
|
102
|
+
const GLOB_MD = "**/*.md";
|
|
103
|
+
const GLOB_EXAMPLES = "**/*.md/*.js";
|
|
104
|
+
const GLOB_SCRIPT_FILES = [
|
|
105
|
+
"**/*.?(c|m)[jt]s?(x)",
|
|
106
|
+
GLOB_DTS,
|
|
107
|
+
GLOB_SVELTE,
|
|
108
|
+
GLOB_SVELTE_SCRIPT
|
|
109
|
+
];
|
|
110
|
+
const GLOB_SCRIPT_FILES_WITHOUT_TS = ["**/*.?(c|m)js?(x)", GLOB_DTS];
|
|
111
|
+
const GLOB_DEVELOPMENT_FILES = [
|
|
112
|
+
"**/*.config.?(c|m)[jt]s",
|
|
113
|
+
"**/{conf,tests}/**",
|
|
114
|
+
"**/types/declarations/reset.d.ts"
|
|
115
|
+
];
|
|
116
|
+
const GLOB_TEST_FILES = [
|
|
117
|
+
"**/__tests__/**/*.?(c|m)[jt]s",
|
|
118
|
+
"**/*.spec.?(c|m)[jt]s",
|
|
119
|
+
"**/*.test.?(c|m)[jt]s",
|
|
120
|
+
"**/*.bench.?(c|m)[jt]s",
|
|
121
|
+
"**/*.benchmark.?(c|m)[jt]s"
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/js/eslint/configs/builtin.ts
|
|
126
|
+
const FILE_TYPE_MAP = {
|
|
127
|
+
".json": "json",
|
|
128
|
+
".css": "css",
|
|
129
|
+
".svg": "svg",
|
|
130
|
+
".png": "image",
|
|
131
|
+
".jpg": "image",
|
|
132
|
+
".jpeg": "image",
|
|
133
|
+
".txt": "text",
|
|
134
|
+
".oct": "bytes",
|
|
135
|
+
".wasm": "webassembly"
|
|
136
|
+
};
|
|
137
|
+
const MESSAGE_ID_MISSING_WITH_KEYWORD = "missingWithKeyword";
|
|
138
|
+
const MESSAGE_ID_MISSING_TYPE_PROPERTY = "missingTypeProperty";
|
|
139
|
+
const MESSAGE_ID_WRONG_TYPE_VALUE = "wrongTypeValue";
|
|
140
|
+
const requireImportAttributesRule = {
|
|
141
|
+
meta: {
|
|
142
|
+
type: "problem",
|
|
143
|
+
docs: { description: "Require non-JavaScript imports (e.g. .json and .css) to include import attributes." },
|
|
144
|
+
messages: {
|
|
145
|
+
[MESSAGE_ID_MISSING_WITH_KEYWORD]: "Non-JavaScript import ('{{ extension }}') requires an import attributes object with the 'type' property set to '{{ expectedValue }}'.",
|
|
146
|
+
[MESSAGE_ID_MISSING_TYPE_PROPERTY]: "Import attributes for non-JavaScript imports must include the 'type' property.",
|
|
147
|
+
[MESSAGE_ID_WRONG_TYPE_VALUE]: "Import attribute 'type' for '{{ file }}' must be '{{ expectedValue }}'."
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
create: (context) => ({ ImportDeclaration: (node$1) => {
|
|
151
|
+
const sourceValue = node$1.source.value;
|
|
152
|
+
const extensionIndex = sourceValue.lastIndexOf(".");
|
|
153
|
+
if (extensionIndex === -1) return;
|
|
154
|
+
const extension = sourceValue.slice(extensionIndex).toLowerCase();
|
|
155
|
+
const expectedValue = FILE_TYPE_MAP[extension];
|
|
156
|
+
if (expectedValue === void 0) return;
|
|
157
|
+
const { attributes } = node$1;
|
|
158
|
+
if (attributes.length === 0) {
|
|
159
|
+
context.report({
|
|
160
|
+
node: node$1,
|
|
161
|
+
messageId: MESSAGE_ID_MISSING_WITH_KEYWORD,
|
|
162
|
+
data: {
|
|
163
|
+
extension,
|
|
164
|
+
expectedValue
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const typeProperty = attributes.find((attribute) => attribute.key.type === "Identifier" && "name" in attribute.key && attribute.key.name === "type" || attribute.key.type === "Literal" && "value" in attribute.key && attribute.key.value === "type");
|
|
170
|
+
if (!typeProperty) {
|
|
171
|
+
context.report({
|
|
172
|
+
node: node$1,
|
|
173
|
+
messageId: MESSAGE_ID_MISSING_TYPE_PROPERTY
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (typeProperty.value.value !== expectedValue) context.report({
|
|
178
|
+
node: node$1,
|
|
179
|
+
messageId: MESSAGE_ID_WRONG_TYPE_VALUE,
|
|
180
|
+
data: {
|
|
181
|
+
expectedValue,
|
|
182
|
+
file: sourceValue
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
} })
|
|
186
|
+
};
|
|
187
|
+
const RULE_DEFINITIONS = { "require-import-attributes": requireImportAttributesRule };
|
|
188
|
+
const RULES = objectFreeze(objectFromEntries(objectKeys(RULE_DEFINITIONS).map((ruleName) => [`${packageOrganization}/${ruleName}`, "error"])));
|
|
189
|
+
const builtin = () => [{
|
|
190
|
+
name: buildConfigName(MAIN_SCOPES[packageOrganizationUpper], SUB_SCOPES.SETUP),
|
|
191
|
+
plugins: { [packageOrganization]: {
|
|
192
|
+
meta: {
|
|
193
|
+
name: packageOrganization,
|
|
194
|
+
version
|
|
195
|
+
},
|
|
196
|
+
rules: RULE_DEFINITIONS
|
|
197
|
+
} }
|
|
198
|
+
}, {
|
|
199
|
+
name: buildConfigName(MAIN_SCOPES[packageOrganizationUpper], SUB_SCOPES.RULES),
|
|
200
|
+
files: GLOB_SCRIPT_FILES,
|
|
201
|
+
rules: RULES
|
|
202
|
+
}];
|
|
203
|
+
const builtinConfig = { [packageOrganization]: builtin };
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/js/eslint/configs/comments.ts
|
|
207
|
+
const comments = async () => {
|
|
208
|
+
const { requiredAll: [pluginComments] } = await resolvePackages(MODULES.comments);
|
|
209
|
+
if (!pluginComments) return [];
|
|
210
|
+
const recommendedConfig = pluginComments.configs.recommended;
|
|
211
|
+
const recommendedRules = "rules" in recommendedConfig ? recommendedConfig.rules : void 0;
|
|
212
|
+
return [{
|
|
213
|
+
name: buildConfigName(MAIN_SCOPES.COMMENTS, SUB_SCOPES.SETUP),
|
|
214
|
+
plugins: { comments: pluginComments }
|
|
215
|
+
}, {
|
|
216
|
+
name: buildConfigName(MAIN_SCOPES.COMMENTS, SUB_SCOPES.RULES),
|
|
217
|
+
files: GLOB_SCRIPT_FILES,
|
|
218
|
+
rules: {
|
|
219
|
+
...renameRules(recommendedRules, { "@eslint-community/eslint-comments": "comments" }),
|
|
220
|
+
"comments/no-unused-disable": "error",
|
|
221
|
+
"comments/require-description": "error"
|
|
222
|
+
}
|
|
223
|
+
}];
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/js/eslint/configs/css.ts
|
|
228
|
+
const css = async () => {
|
|
229
|
+
const { requiredAll: [pluginCss] } = await resolvePackages(MODULES.css);
|
|
230
|
+
if (!pluginCss) return [];
|
|
231
|
+
return [{
|
|
232
|
+
name: buildConfigName(MAIN_SCOPES.CSS, SUB_SCOPES.SETUP),
|
|
233
|
+
plugins: { css: pluginCss }
|
|
234
|
+
}, {
|
|
235
|
+
name: buildConfigName(MAIN_SCOPES.CSS, SUB_SCOPES.RULES),
|
|
236
|
+
files: [GLOB_CSS],
|
|
237
|
+
language: "css/css",
|
|
238
|
+
rules: {
|
|
239
|
+
...pluginCss.configs.recommended.rules,
|
|
240
|
+
"css/prefer-logical-properties": "error",
|
|
241
|
+
"css/relative-font-units": ["error", { allowUnits: ["em", "rem"] }],
|
|
242
|
+
"css/use-baseline": "error"
|
|
243
|
+
}
|
|
244
|
+
}];
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/js/eslint/configs/gitignore.ts
|
|
249
|
+
const gitignore = async (options) => {
|
|
250
|
+
const { requiredAll: [pluginGitignore] } = await resolvePackages(MODULES.gitignore);
|
|
251
|
+
if (!pluginGitignore) return [];
|
|
252
|
+
return [pluginGitignore({
|
|
253
|
+
name: buildConfigName(MAIN_SCOPES.IGNORES, SUB_SCOPES.GIT),
|
|
254
|
+
...options
|
|
255
|
+
})];
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/js/eslint/configs/ignores.ts
|
|
260
|
+
const ignores = (customIgnores = []) => [{
|
|
261
|
+
name: buildConfigName(MAIN_SCOPES.IGNORES, SUB_SCOPES.BASE),
|
|
262
|
+
ignores: [...GLOB_IGNORES, ...customIgnores]
|
|
263
|
+
}];
|
|
264
|
+
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/js/eslint/configs/import.ts
|
|
267
|
+
const imports = async () => {
|
|
268
|
+
const { requiredAny: [pluginImport, pluginAntfu], optional: [importResovlerTypescript] } = await resolvePackages(MODULES.import);
|
|
269
|
+
const plugins = {};
|
|
270
|
+
const settings = {};
|
|
271
|
+
let pluginImportRules = {};
|
|
272
|
+
let pluginAntfuRules = {};
|
|
273
|
+
if (pluginImport) {
|
|
274
|
+
plugins["import"] = pluginImport;
|
|
275
|
+
settings["import-x/resolver-next"] = [pluginImport.createNodeResolver(), importResovlerTypescript === void 0 ? void 0 : importResovlerTypescript.createTypeScriptImportResolver({ bun: true })].filter(Boolean);
|
|
276
|
+
const pluginImportTsRules = isModuleEnabled(MODULES.typescript) ? renameRules(pluginImport.flatConfigs.typescript.rules, { "import-x": "import" }) : {};
|
|
277
|
+
pluginImportRules = {
|
|
278
|
+
...renameRules(pluginImport.flatConfigs.recommended.rules, { "import-x": "import" }),
|
|
279
|
+
...pluginImportTsRules,
|
|
280
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
281
|
+
"import/extensions": [
|
|
282
|
+
"error",
|
|
283
|
+
"ignorePackages",
|
|
284
|
+
{
|
|
285
|
+
js: "never",
|
|
286
|
+
ts: "never",
|
|
287
|
+
cts: "never",
|
|
288
|
+
mts: "never"
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
"import/first": "error",
|
|
292
|
+
"import/max-dependencies": ["error", { max: 15 }],
|
|
293
|
+
"import/newline-after-import": "error",
|
|
294
|
+
"import/no-absolute-path": "error",
|
|
295
|
+
"import/no-amd": "error",
|
|
296
|
+
"import/no-cycle": "error",
|
|
297
|
+
"import/no-default-export": "error",
|
|
298
|
+
"import/no-deprecated": "error",
|
|
299
|
+
"import/no-duplicates": "error",
|
|
300
|
+
"import/no-dynamic-require": "error",
|
|
301
|
+
"import/no-empty-named-blocks": "error",
|
|
302
|
+
"import/no-extraneous-dependencies": ["error", { devDependencies: GLOB_DEVELOPMENT_FILES }],
|
|
303
|
+
"import/no-import-module-exports": "error",
|
|
304
|
+
"import/no-mutable-exports": "error",
|
|
305
|
+
"import/no-named-as-default-member": "error",
|
|
306
|
+
"import/no-named-as-default": "error",
|
|
307
|
+
"import/no-named-default": "error",
|
|
308
|
+
"import/no-namespace": "error",
|
|
309
|
+
"import/no-relative-packages": "error",
|
|
310
|
+
"import/no-rename-default": "error",
|
|
311
|
+
"import/no-self-import": "error",
|
|
312
|
+
"import/no-unassigned-import": ["error", { allow: ["**/*.{css,scss}"] }],
|
|
313
|
+
"import/no-useless-path-segments": ["error", { noUselessIndex: true }],
|
|
314
|
+
"import/no-unresolved": ["error", {
|
|
315
|
+
commonjs: true,
|
|
316
|
+
caseSensitive: true
|
|
317
|
+
}],
|
|
318
|
+
"import/no-webpack-loader-syntax": "error",
|
|
319
|
+
"import/order": ["error", {
|
|
320
|
+
warnOnUnassignedImports: true,
|
|
321
|
+
sortTypesGroup: true,
|
|
322
|
+
consolidateIslands: "inside-groups",
|
|
323
|
+
"newlines-between": "always-and-inside-groups",
|
|
324
|
+
"newlines-between-types": "never",
|
|
325
|
+
named: {
|
|
326
|
+
enabled: true,
|
|
327
|
+
types: "types-last"
|
|
328
|
+
},
|
|
329
|
+
alphabetize: {
|
|
330
|
+
order: "asc",
|
|
331
|
+
caseInsensitive: true
|
|
332
|
+
},
|
|
333
|
+
groups: [
|
|
334
|
+
"builtin",
|
|
335
|
+
"external",
|
|
336
|
+
"unknown",
|
|
337
|
+
"internal",
|
|
338
|
+
"parent",
|
|
339
|
+
"sibling",
|
|
340
|
+
"index",
|
|
341
|
+
"object",
|
|
342
|
+
"type"
|
|
343
|
+
],
|
|
344
|
+
pathGroups: [{
|
|
345
|
+
pattern: "**/*.{css,scss}",
|
|
346
|
+
group: "object"
|
|
347
|
+
}]
|
|
348
|
+
}],
|
|
349
|
+
"import/unambiguous": "error"
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (pluginAntfu) {
|
|
353
|
+
plugins["antfu"] = pluginAntfu;
|
|
354
|
+
pluginAntfuRules = {
|
|
355
|
+
"antfu/import-dedupe": "error",
|
|
356
|
+
"antfu/no-import-dist": "error",
|
|
357
|
+
"antfu/no-import-node-modules-by-path": "error"
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
if (Object.keys(plugins).length === 0) return [];
|
|
361
|
+
const setupConfig = {
|
|
362
|
+
name: buildConfigName(MAIN_SCOPES.IMPORT, SUB_SCOPES.SETUP),
|
|
363
|
+
plugins
|
|
364
|
+
};
|
|
365
|
+
if (Object.keys(settings).length > 0) setupConfig.settings = settings;
|
|
366
|
+
return [setupConfig, {
|
|
367
|
+
name: buildConfigName(MAIN_SCOPES.IMPORT, SUB_SCOPES.RULES),
|
|
368
|
+
files: GLOB_SCRIPT_FILES,
|
|
369
|
+
rules: {
|
|
370
|
+
...pluginImportRules,
|
|
371
|
+
...pluginAntfuRules
|
|
372
|
+
}
|
|
373
|
+
}];
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/js/eslint/configs/javascript.ts
|
|
378
|
+
const javascript = async () => {
|
|
379
|
+
const { optional: [pluginAntfu, pluginUnusedImports] } = await resolvePackages(MODULES.javascript);
|
|
380
|
+
const plugins = {};
|
|
381
|
+
const pluginRules = {};
|
|
382
|
+
if (pluginAntfu) {
|
|
383
|
+
plugins["antfu"] = pluginAntfu;
|
|
384
|
+
pluginRules["antfu/consistent-chaining"] = "error";
|
|
385
|
+
pluginRules["antfu/no-ts-export-equal"] = "error";
|
|
386
|
+
}
|
|
387
|
+
if (pluginUnusedImports) {
|
|
388
|
+
plugins["unused"] = pluginUnusedImports;
|
|
389
|
+
pluginRules["unused/no-unused-imports"] = "error";
|
|
390
|
+
pluginRules["unused/no-unused-vars"] = isModuleEnabled(MODULES.typescript) ? "off" : "error";
|
|
391
|
+
}
|
|
392
|
+
return [{
|
|
393
|
+
name: buildConfigName(MAIN_SCOPES.JAVASCRIPT, SUB_SCOPES.SETUP),
|
|
394
|
+
plugins,
|
|
395
|
+
languageOptions: {
|
|
396
|
+
ecmaVersion: "latest",
|
|
397
|
+
globals: {
|
|
398
|
+
...globals.browser,
|
|
399
|
+
...globals.es2025,
|
|
400
|
+
...globals.node
|
|
401
|
+
},
|
|
402
|
+
sourceType: "module",
|
|
403
|
+
parserOptions: {
|
|
404
|
+
sourceType: "module",
|
|
405
|
+
ecmaVersion: "latest",
|
|
406
|
+
ecmaFeatures: { jsx: true }
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
linterOptions: { reportUnusedDisableDirectives: "error" }
|
|
410
|
+
}, {
|
|
411
|
+
name: buildConfigName(MAIN_SCOPES.JAVASCRIPT, SUB_SCOPES.RULES),
|
|
412
|
+
files: GLOB_SCRIPT_FILES,
|
|
413
|
+
rules: {
|
|
414
|
+
...jsEslint.configs.recommended.rules,
|
|
415
|
+
...pluginUnusedImports ? { "no-unused-vars": "off" } : void 0,
|
|
416
|
+
"accessor-pairs": "error",
|
|
417
|
+
"array-callback-return": ["error", { checkForEach: true }],
|
|
418
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
419
|
+
"block-scoped-var": "error",
|
|
420
|
+
"capitalized-comments": [
|
|
421
|
+
"error",
|
|
422
|
+
"always",
|
|
423
|
+
{
|
|
424
|
+
block: { ignoreInlineComments: true },
|
|
425
|
+
line: { ignorePattern: ".*" }
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
"class-methods-use-this": ["error", { ignoreOverrideMethods: true }],
|
|
429
|
+
complexity: ["error", {
|
|
430
|
+
max: 10,
|
|
431
|
+
variant: "modified"
|
|
432
|
+
}],
|
|
433
|
+
"consistent-return": "error",
|
|
434
|
+
"consistent-this": "error",
|
|
435
|
+
curly: "error",
|
|
436
|
+
"default-case": "error",
|
|
437
|
+
"default-case-last": "error",
|
|
438
|
+
"default-param-last": "error",
|
|
439
|
+
"dot-notation": "error",
|
|
440
|
+
eqeqeq: "error",
|
|
441
|
+
"func-name-matching": ["error", {
|
|
442
|
+
considerPropertyDescriptor: true,
|
|
443
|
+
includeCommonJSModuleExports: true
|
|
444
|
+
}],
|
|
445
|
+
"func-names": "error",
|
|
446
|
+
"func-style": ["error", "expression"],
|
|
447
|
+
"grouped-accessor-pairs": "error",
|
|
448
|
+
"guard-for-in": "error",
|
|
449
|
+
"init-declarations": "error",
|
|
450
|
+
"logical-assignment-operators": "error",
|
|
451
|
+
"max-classes-per-file": "error",
|
|
452
|
+
"max-depth": "error",
|
|
453
|
+
"max-lines": ["error", {
|
|
454
|
+
max: 300,
|
|
455
|
+
skipBlankLines: true,
|
|
456
|
+
skipComments: true
|
|
457
|
+
}],
|
|
458
|
+
"max-lines-per-function": ["error", {
|
|
459
|
+
IIFEs: true,
|
|
460
|
+
max: 50,
|
|
461
|
+
skipBlankLines: true,
|
|
462
|
+
skipComments: true
|
|
463
|
+
}],
|
|
464
|
+
"max-nested-callbacks": ["error", { max: 3 }],
|
|
465
|
+
"max-params": ["error", { max: 4 }],
|
|
466
|
+
"max-statements": ["error", { max: 30 }],
|
|
467
|
+
"new-cap": "error",
|
|
468
|
+
"no-alert": "error",
|
|
469
|
+
"no-array-constructor": "error",
|
|
470
|
+
"no-await-in-loop": "error",
|
|
471
|
+
"no-bitwise": "error",
|
|
472
|
+
"no-caller": "error",
|
|
473
|
+
"no-cond-assign": ["error", "always"],
|
|
474
|
+
"no-console": "error",
|
|
475
|
+
"no-constructor-return": "error",
|
|
476
|
+
"no-div-regex": "error",
|
|
477
|
+
"no-duplicate-imports": isModuleEnabled(MODULES.import) ? "off" : ["error", { allowSeparateTypeImports: true }],
|
|
478
|
+
"no-else-return": ["error", { allowElseIf: false }],
|
|
479
|
+
"no-empty-function": "error",
|
|
480
|
+
"no-eq-null": "error",
|
|
481
|
+
"no-eval": "error",
|
|
482
|
+
"no-extend-native": "error",
|
|
483
|
+
"no-extra-bind": "error",
|
|
484
|
+
"no-extra-label": "error",
|
|
485
|
+
"no-implicit-coercion": ["error", { boolean: false }],
|
|
486
|
+
"no-implicit-globals": "error",
|
|
487
|
+
"no-implied-eval": "error",
|
|
488
|
+
"no-inline-comments": "error",
|
|
489
|
+
"no-inner-declarations": "error",
|
|
490
|
+
"no-invalid-this": "error",
|
|
491
|
+
"no-iterator": "error",
|
|
492
|
+
"no-label-var": "error",
|
|
493
|
+
"no-labels": "error",
|
|
494
|
+
"no-lone-blocks": "error",
|
|
495
|
+
"no-lonely-if": "error",
|
|
496
|
+
"no-loop-func": "error",
|
|
497
|
+
"no-magic-numbers": ["error", { ignore: [
|
|
498
|
+
-1,
|
|
499
|
+
0,
|
|
500
|
+
1,
|
|
501
|
+
100,
|
|
502
|
+
42069
|
|
503
|
+
] }],
|
|
504
|
+
"no-multi-assign": "error",
|
|
505
|
+
"no-multi-str": "error",
|
|
506
|
+
"no-negated-condition": "error",
|
|
507
|
+
"no-nested-ternary": "error",
|
|
508
|
+
"no-new": "error",
|
|
509
|
+
"no-new-func": "error",
|
|
510
|
+
"no-new-wrappers": "error",
|
|
511
|
+
"no-object-constructor": "error",
|
|
512
|
+
"no-octal-escape": "error",
|
|
513
|
+
"no-param-reassign": ["error", { props: false }],
|
|
514
|
+
"no-plusplus": "error",
|
|
515
|
+
"no-promise-executor-return": "error",
|
|
516
|
+
"no-proto": "error",
|
|
517
|
+
"no-restricted-exports": ["error", { restrictedNamedExports: ["default"] }],
|
|
518
|
+
"no-restricted-globals": [
|
|
519
|
+
"error",
|
|
520
|
+
"global",
|
|
521
|
+
...confusingBrowserGlobals
|
|
522
|
+
],
|
|
523
|
+
"no-restricted-properties": [
|
|
524
|
+
"error",
|
|
525
|
+
{
|
|
526
|
+
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
527
|
+
property: "__proto__"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
message: "Use the `get` syntax or `Object.defineProperty` instead.",
|
|
531
|
+
property: "__defineGetter__"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
message: "Use the `set` syntax or `Object.defineProperty` instead.",
|
|
535
|
+
property: "__defineSetter__"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
539
|
+
property: "__lookupGetter__"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
543
|
+
property: "__lookupSetter__"
|
|
544
|
+
}
|
|
545
|
+
],
|
|
546
|
+
"no-restricted-syntax": [
|
|
547
|
+
"error",
|
|
548
|
+
{
|
|
549
|
+
selector: "ForInStatement",
|
|
550
|
+
message: "`for..in` loops include inherited properties, leading to unexpected behavior. Use Object.{keys, values, entries} for safe iteration or explicitly disable this rule to make the intent clear."
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
selector: "TSEnumDeclaration",
|
|
554
|
+
message: "TypeScript enums can lead to less predictable type behavior. Use a constant object literal (`const MY_ENUM = <const>{ VALUE1: 1, VALUE2: 2 };`) and add a type for it (`type MyEnum = typeof MY_ENUM[keyof typeof MY_ENUM];`) instead to ensure stricter typing control and better code clarity."
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
selector: "TSExportAssignment",
|
|
558
|
+
message: "TypeScript export assignments should be avoided for consistency and maintainability. Use a default export instead to align with modern module standards and to avoid potential import/export issues."
|
|
559
|
+
}
|
|
560
|
+
],
|
|
561
|
+
"no-return-assign": ["error", "always"],
|
|
562
|
+
"no-script-url": "error",
|
|
563
|
+
"no-self-compare": "error",
|
|
564
|
+
"no-sequences": "error",
|
|
565
|
+
"no-shadow": "error",
|
|
566
|
+
"no-template-curly-in-string": "error",
|
|
567
|
+
"no-throw-literal": "error",
|
|
568
|
+
"no-unassigned-vars": "error",
|
|
569
|
+
"no-underscore-dangle": "error",
|
|
570
|
+
"no-unmodified-loop-condition": "error",
|
|
571
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
572
|
+
"no-unreachable-loop": "error",
|
|
573
|
+
"no-unused-expressions": "error",
|
|
574
|
+
"no-use-before-define": "error",
|
|
575
|
+
"no-useless-assignment": "error",
|
|
576
|
+
"no-useless-call": "error",
|
|
577
|
+
"no-useless-computed-key": "error",
|
|
578
|
+
"no-useless-concat": "error",
|
|
579
|
+
"no-useless-constructor": "error",
|
|
580
|
+
"no-useless-rename": "error",
|
|
581
|
+
"no-useless-return": "error",
|
|
582
|
+
"no-var": "error",
|
|
583
|
+
"no-void": "error",
|
|
584
|
+
"no-warning-comments": "error",
|
|
585
|
+
"object-shorthand": [
|
|
586
|
+
"error",
|
|
587
|
+
"always",
|
|
588
|
+
{
|
|
589
|
+
avoidQuotes: true,
|
|
590
|
+
ignoreConstructors: false
|
|
591
|
+
}
|
|
592
|
+
],
|
|
593
|
+
"operator-assignment": "error",
|
|
594
|
+
"prefer-arrow-callback": "error",
|
|
595
|
+
"prefer-const": ["error", { ignoreReadBeforeAssign: true }],
|
|
596
|
+
"prefer-destructuring": "error",
|
|
597
|
+
"prefer-exponentiation-operator": "error",
|
|
598
|
+
"prefer-named-capture-group": "error",
|
|
599
|
+
"prefer-numeric-literals": "error",
|
|
600
|
+
"prefer-object-has-own": "error",
|
|
601
|
+
"prefer-object-spread": "error",
|
|
602
|
+
"prefer-promise-reject-errors": "error",
|
|
603
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
604
|
+
"prefer-rest-params": "error",
|
|
605
|
+
"prefer-spread": "error",
|
|
606
|
+
"prefer-template": "error",
|
|
607
|
+
"preserve-caught-error": "error",
|
|
608
|
+
radix: "error",
|
|
609
|
+
"require-atomic-updates": "error",
|
|
610
|
+
"require-await": "error",
|
|
611
|
+
strict: "error",
|
|
612
|
+
"symbol-description": "error",
|
|
613
|
+
"unicode-bom": "error",
|
|
614
|
+
"use-isnan": ["error", { enforceForIndexOf: true }],
|
|
615
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
616
|
+
"vars-on-top": "error",
|
|
617
|
+
yoda: "error",
|
|
618
|
+
...pluginRules
|
|
619
|
+
}
|
|
620
|
+
}];
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/js/eslint/configs/typescript.ts
|
|
625
|
+
const DEFAULT_TYPE_AWARE_IGNORES = [`${GLOB_MD}/**`];
|
|
626
|
+
const getTsEslintParserIfExists = async () => {
|
|
627
|
+
const isTypescriptModuleEnabled = isModuleEnabled(MODULES.typescript);
|
|
628
|
+
let parser = void 0;
|
|
629
|
+
if (isTypescriptModuleEnabled) {
|
|
630
|
+
const { requiredAll: [, tsEslint] } = await resolvePackages(MODULES.typescript);
|
|
631
|
+
if (tsEslint) ({parser} = tsEslint);
|
|
632
|
+
}
|
|
633
|
+
return parser;
|
|
634
|
+
};
|
|
635
|
+
const resolveTypeAwareOptions = (resolvedOptions, files, ignores$1) => {
|
|
636
|
+
const typeAwareOptions = typeof resolvedOptions.typeAware === "object" ? resolvedOptions.typeAware : {
|
|
637
|
+
ignores: DEFAULT_TYPE_AWARE_IGNORES,
|
|
638
|
+
tsconfig: typeof resolvedOptions.typeAware === "string" ? resolvedOptions.typeAware : void 0
|
|
639
|
+
};
|
|
640
|
+
typeAwareOptions.files = [...new Set([...typeAwareOptions.files ?? [], ...files])];
|
|
641
|
+
typeAwareOptions.ignores = [...new Set([...typeAwareOptions.ignores ?? [], ...ignores$1])];
|
|
642
|
+
return typeAwareOptions;
|
|
643
|
+
};
|
|
644
|
+
const extractRelevantRules = (configs$1, key) => {
|
|
645
|
+
for (const config of configs$1) if (config.name === `typescript-eslint/${key}` && config.rules) return renameRules(config.rules, { "@typescript-eslint": "ts" });
|
|
646
|
+
throw new Error(`Expected key "${key}" to be contained in given config.`);
|
|
647
|
+
};
|
|
648
|
+
const getNamingConvention = (isTypeAware) => {
|
|
649
|
+
const ruleOptions = [
|
|
650
|
+
"error",
|
|
651
|
+
{
|
|
652
|
+
selector: "default",
|
|
653
|
+
format: [
|
|
654
|
+
"strictCamelCase",
|
|
655
|
+
"StrictPascalCase",
|
|
656
|
+
"UPPER_CASE"
|
|
657
|
+
],
|
|
658
|
+
leadingUnderscore: "forbid",
|
|
659
|
+
trailingUnderscore: "forbid"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
selector: ["objectLiteralProperty", "variable"],
|
|
663
|
+
format: ["strictCamelCase", "UPPER_CASE"]
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
selector: "variable",
|
|
667
|
+
format: null,
|
|
668
|
+
modifiers: ["destructured"]
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
selector: "typeLike",
|
|
672
|
+
format: ["StrictPascalCase"]
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
selector: "parameter",
|
|
676
|
+
format: null,
|
|
677
|
+
filter: {
|
|
678
|
+
regex: "^_+$",
|
|
679
|
+
match: false
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
selector: [
|
|
684
|
+
"classProperty",
|
|
685
|
+
"objectLiteralProperty",
|
|
686
|
+
"typeProperty",
|
|
687
|
+
"classMethod",
|
|
688
|
+
"objectLiteralMethod",
|
|
689
|
+
"typeMethod",
|
|
690
|
+
"accessor",
|
|
691
|
+
"enumMember"
|
|
692
|
+
],
|
|
693
|
+
format: null,
|
|
694
|
+
modifiers: ["requiresQuotes"]
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
selector: "typeParameter",
|
|
698
|
+
format: ["StrictPascalCase"],
|
|
699
|
+
prefix: ["T"],
|
|
700
|
+
custom: {
|
|
701
|
+
regex: "^[A-Z]",
|
|
702
|
+
match: true
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
selector: "interface",
|
|
707
|
+
format: ["StrictPascalCase"],
|
|
708
|
+
custom: {
|
|
709
|
+
regex: "^I[A-Z]",
|
|
710
|
+
match: false
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
];
|
|
714
|
+
if (isTypeAware) ruleOptions.push({
|
|
715
|
+
selector: "variable",
|
|
716
|
+
types: ["boolean"],
|
|
717
|
+
format: ["StrictPascalCase"],
|
|
718
|
+
prefix: [
|
|
719
|
+
"is",
|
|
720
|
+
"do",
|
|
721
|
+
"does",
|
|
722
|
+
"did",
|
|
723
|
+
"has",
|
|
724
|
+
"was",
|
|
725
|
+
"can"
|
|
726
|
+
]
|
|
727
|
+
});
|
|
728
|
+
return ruleOptions;
|
|
729
|
+
};
|
|
730
|
+
const typescript = async (options) => {
|
|
731
|
+
const { requiredAll: [isTypescriptInstalled, tsEslint] } = await resolvePackages(MODULES.typescript);
|
|
732
|
+
if (!isTypescriptInstalled || !tsEslint) return [];
|
|
733
|
+
const cwd = process.cwd();
|
|
734
|
+
let hasTsConfig = false;
|
|
735
|
+
try {
|
|
736
|
+
await fs.access(path.resolve(cwd, "tsconfig.json"), fs.constants.R_OK);
|
|
737
|
+
hasTsConfig = true;
|
|
738
|
+
} catch {}
|
|
739
|
+
const resolvedOptions = {
|
|
740
|
+
extraFileExtensions: [],
|
|
741
|
+
parserOptions: {},
|
|
742
|
+
typeAware: hasTsConfig,
|
|
743
|
+
...options
|
|
744
|
+
};
|
|
745
|
+
const ignores$1 = resolvedOptions.ignores ?? [];
|
|
746
|
+
const files = [...new Set([...resolvedOptions.extraFileExtensions.map((extension) => `**/*.${extension}`), ...resolvedOptions.files ?? GLOB_SCRIPT_FILES])];
|
|
747
|
+
const hasEnabledTypeAwareness = resolvedOptions.typeAware !== false;
|
|
748
|
+
const typeAwareOptions = hasEnabledTypeAwareness ? resolveTypeAwareOptions(resolvedOptions, files, ignores$1) : {};
|
|
749
|
+
const createParserConfig = (isTypeAware) => ({
|
|
750
|
+
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, `${SUB_SCOPES.PARSER}${isTypeAware ? "-type-aware" : ""}`),
|
|
751
|
+
files: isTypeAware ? typeAwareOptions.files : files,
|
|
752
|
+
ignores: isTypeAware ? typeAwareOptions.ignores : ignores$1,
|
|
753
|
+
languageOptions: {
|
|
754
|
+
parser: tsEslint.parser,
|
|
755
|
+
parserOptions: {
|
|
756
|
+
extraFileExtensions: resolvedOptions.extraFileExtensions.map((extension) => `.${extension}`),
|
|
757
|
+
...isTypeAware ? {
|
|
758
|
+
tsconfigRootDir: cwd,
|
|
759
|
+
projectService: { defaultProject: typeAwareOptions.tsconfig }
|
|
760
|
+
} : {},
|
|
761
|
+
...resolvedOptions.parserOptions
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
const createRulesConfig = (isTypeAware) => ({
|
|
766
|
+
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, `${SUB_SCOPES.RULES}${isTypeAware ? "-type-aware" : ""}`),
|
|
767
|
+
files: isTypeAware ? typeAwareOptions.files : files,
|
|
768
|
+
ignores: isTypeAware ? typeAwareOptions.ignores : ignores$1,
|
|
769
|
+
rules: {
|
|
770
|
+
"ts/naming-convention": getNamingConvention(isTypeAware),
|
|
771
|
+
...isTypeAware ? {
|
|
772
|
+
...extractRelevantRules(tsEslint.configs.recommendedTypeCheckedOnly, "recommended-type-checked-only"),
|
|
773
|
+
...extractRelevantRules(tsEslint.configs.strictTypeCheckedOnly, "strict-type-checked-only"),
|
|
774
|
+
...extractRelevantRules(tsEslint.configs.stylisticTypeCheckedOnly, "stylistic-type-checked-only"),
|
|
775
|
+
"consistent-return": "off",
|
|
776
|
+
"ts/consistent-return": "error",
|
|
777
|
+
"ts/consistent-type-exports": "error",
|
|
778
|
+
"ts/no-unnecessary-qualifier": "error",
|
|
779
|
+
"prefer-destructuring": "off",
|
|
780
|
+
"ts/prefer-destructuring": "error",
|
|
781
|
+
"ts/no-unnecessary-type-conversion": "error",
|
|
782
|
+
"ts/promise-function-async": "error",
|
|
783
|
+
"ts/prefer-readonly": "error",
|
|
784
|
+
"ts/require-array-sort-compare": "error",
|
|
785
|
+
"ts/strict-boolean-expressions": "error",
|
|
786
|
+
"ts/strict-void-return": "error",
|
|
787
|
+
"ts/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }]
|
|
788
|
+
} : {
|
|
789
|
+
...extractRelevantRules(tsEslint.configs.recommended, "recommended"),
|
|
790
|
+
...extractRelevantRules(tsEslint.configs.strict, "strict"),
|
|
791
|
+
...extractRelevantRules(tsEslint.configs.stylistic, "stylistic"),
|
|
792
|
+
"ts/consistent-type-assertions": ["error", { assertionStyle: "angle-bracket" }],
|
|
793
|
+
"ts/consistent-type-imports": "error",
|
|
794
|
+
"ts/member-ordering": "error",
|
|
795
|
+
"ts/method-signature-style": "error",
|
|
796
|
+
"ts/no-import-type-side-effects": "error",
|
|
797
|
+
"no-redeclare": "off",
|
|
798
|
+
"ts/no-redeclare": "error",
|
|
799
|
+
"ts/no-unnecessary-parameter-property-assignment": "error",
|
|
800
|
+
"no-unused-private-class-members": "off",
|
|
801
|
+
"ts/no-unused-private-class-members": "error",
|
|
802
|
+
"ts/no-useless-empty-export": "error",
|
|
803
|
+
"ts/prefer-enum-initializers": "error"
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
return [
|
|
808
|
+
{
|
|
809
|
+
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, SUB_SCOPES.SETUP),
|
|
810
|
+
plugins: { ts: tsEslint.plugin }
|
|
811
|
+
},
|
|
812
|
+
createParserConfig(false),
|
|
813
|
+
hasEnabledTypeAwareness ? createParserConfig(true) : void 0,
|
|
814
|
+
createRulesConfig(false),
|
|
815
|
+
hasEnabledTypeAwareness ? createRulesConfig(true) : void 0,
|
|
816
|
+
{
|
|
817
|
+
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, `${SUB_SCOPES.RULES}-typescript`),
|
|
818
|
+
files: [GLOB_TS],
|
|
819
|
+
ignores: typeAwareOptions.ignores ?? ignores$1,
|
|
820
|
+
rules: {
|
|
821
|
+
"ts/explicit-function-return-type": "error",
|
|
822
|
+
"ts/explicit-member-accessibility": "error"
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
].filter(Boolean);
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region src/js/eslint/configs/jsdoc.ts
|
|
830
|
+
const jsdoc = async () => {
|
|
831
|
+
const { requiredAll: [pluginJsdoc], optional: [getJsdocProcessorPlugin] } = await resolvePackages(MODULES.jsdoc);
|
|
832
|
+
if (!pluginJsdoc) return [];
|
|
833
|
+
const createSetupConfig = (isForTypescript) => ({
|
|
834
|
+
name: buildConfigName(MAIN_SCOPES.JSDOC, `${SUB_SCOPES.SETUP}${isForTypescript ? "-typescript" : ""}`),
|
|
835
|
+
...isForTypescript ? void 0 : { plugins: { jsdoc: pluginJsdoc } },
|
|
836
|
+
settings: { jsdoc: { mode: isForTypescript ? "typescript" : "jsdoc" } }
|
|
837
|
+
});
|
|
838
|
+
const createRulesConfig = (isForTypescript) => ({
|
|
839
|
+
name: buildConfigName(MAIN_SCOPES.JSDOC, `${SUB_SCOPES.RULES}${isForTypescript ? "-typescript" : ""}`),
|
|
840
|
+
files: isForTypescript ? [GLOB_TS, GLOB_SCRIPT_FILES_WITHOUT_TS] : GLOB_SCRIPT_FILES_WITHOUT_TS,
|
|
841
|
+
rules: { ...isForTypescript ? {
|
|
842
|
+
...Object.fromEntries(objectEntries(pluginJsdoc.configs["flat/recommended-typescript-error"].rules ?? {}).map(([key, value]) => Object.is(pluginJsdoc.configs["flat/recommended-error"].rules?.[key], value) ? void 0 : [key, value]).filter(Boolean)),
|
|
843
|
+
"jsdoc/require-param": "off",
|
|
844
|
+
"jsdoc/require-returns": "off"
|
|
845
|
+
} : {
|
|
846
|
+
...pluginJsdoc.configs["flat/recommended-error"].rules,
|
|
847
|
+
"jsdoc/check-indentation": "error",
|
|
848
|
+
"jsdoc/check-line-alignment": "error",
|
|
849
|
+
"jsdoc/check-syntax": "error",
|
|
850
|
+
"jsdoc/check-template-names": "error",
|
|
851
|
+
"jsdoc/convert-to-jsdoc-comments": ["error", { lineOrBlockStyle: "block" }],
|
|
852
|
+
"jsdoc/imports-as-dependencies": "error",
|
|
853
|
+
"jsdoc/informative-docs": "error",
|
|
854
|
+
"jsdoc/match-description": "error",
|
|
855
|
+
"jsdoc/multiline-blocks": ["error", {
|
|
856
|
+
noSingleLineBlocks: true,
|
|
857
|
+
singleLineTags: []
|
|
858
|
+
}],
|
|
859
|
+
"jsdoc/no-bad-blocks": "error",
|
|
860
|
+
"jsdoc/no-blank-block-descriptions": "error",
|
|
861
|
+
"jsdoc/no-blank-blocks": "error",
|
|
862
|
+
"jsdoc/prefer-import-tag": "error",
|
|
863
|
+
"jsdoc/require-description-complete-sentence": "error",
|
|
864
|
+
"jsdoc/require-asterisk-prefix": "error",
|
|
865
|
+
"jsdoc/require-hyphen-before-param-description": "error",
|
|
866
|
+
"jsdoc/require-param-description": "off",
|
|
867
|
+
"jsdoc/require-property-description": "off",
|
|
868
|
+
"jsdoc/require-returns-description": "off",
|
|
869
|
+
"jsdoc/require-jsdoc": "off",
|
|
870
|
+
"jsdoc/require-template": "error",
|
|
871
|
+
"jsdoc/require-throws": "error",
|
|
872
|
+
"jsdoc/sort-tags": ["error", { tagSequence: [
|
|
873
|
+
{ tags: ["import"] },
|
|
874
|
+
{ tags: [
|
|
875
|
+
"deprecated",
|
|
876
|
+
"ignore",
|
|
877
|
+
"since",
|
|
878
|
+
"version",
|
|
879
|
+
["to", "do"].join("")
|
|
880
|
+
] },
|
|
881
|
+
{ tags: [
|
|
882
|
+
"author",
|
|
883
|
+
"copyright",
|
|
884
|
+
"license"
|
|
885
|
+
] },
|
|
886
|
+
{ tags: ["summary", "typeSummary"] },
|
|
887
|
+
{ tags: [
|
|
888
|
+
"desc",
|
|
889
|
+
"description",
|
|
890
|
+
"classdesc"
|
|
891
|
+
] },
|
|
892
|
+
{ tags: [
|
|
893
|
+
"internal",
|
|
894
|
+
"namespace",
|
|
895
|
+
"category",
|
|
896
|
+
"package",
|
|
897
|
+
"file",
|
|
898
|
+
"fileoverview",
|
|
899
|
+
"overview",
|
|
900
|
+
"module",
|
|
901
|
+
"override",
|
|
902
|
+
"requires",
|
|
903
|
+
"implements",
|
|
904
|
+
"mixes",
|
|
905
|
+
"mixin",
|
|
906
|
+
"mixinClass",
|
|
907
|
+
"mixinFunction",
|
|
908
|
+
"borrows",
|
|
909
|
+
"constructs",
|
|
910
|
+
"lends",
|
|
911
|
+
"final",
|
|
912
|
+
"global",
|
|
913
|
+
"readonly",
|
|
914
|
+
"abstract",
|
|
915
|
+
"virtual",
|
|
916
|
+
"static",
|
|
917
|
+
"private",
|
|
918
|
+
"protected",
|
|
919
|
+
"public",
|
|
920
|
+
"access",
|
|
921
|
+
"const",
|
|
922
|
+
"constant",
|
|
923
|
+
"variation",
|
|
924
|
+
"var",
|
|
925
|
+
"member",
|
|
926
|
+
"memberof",
|
|
927
|
+
"inner",
|
|
928
|
+
"instance",
|
|
929
|
+
"inheritdoc",
|
|
930
|
+
"inheritDoc",
|
|
931
|
+
"hideconstructor"
|
|
932
|
+
] },
|
|
933
|
+
{ tags: [
|
|
934
|
+
"this",
|
|
935
|
+
"interface",
|
|
936
|
+
"enum",
|
|
937
|
+
"event",
|
|
938
|
+
"augments",
|
|
939
|
+
"extends",
|
|
940
|
+
"name",
|
|
941
|
+
"kind",
|
|
942
|
+
"type",
|
|
943
|
+
"alias",
|
|
944
|
+
"external",
|
|
945
|
+
"host",
|
|
946
|
+
"async",
|
|
947
|
+
"callback",
|
|
948
|
+
"func",
|
|
949
|
+
"function",
|
|
950
|
+
"method",
|
|
951
|
+
"class",
|
|
952
|
+
"constructor",
|
|
953
|
+
"generator",
|
|
954
|
+
"fires",
|
|
955
|
+
"emits",
|
|
956
|
+
"listens"
|
|
957
|
+
] },
|
|
958
|
+
{ tags: ["template"] },
|
|
959
|
+
{ tags: ["typedef"] },
|
|
960
|
+
{ tags: [
|
|
961
|
+
"param",
|
|
962
|
+
"arg",
|
|
963
|
+
"argument",
|
|
964
|
+
"prop",
|
|
965
|
+
"property"
|
|
966
|
+
] },
|
|
967
|
+
{ tags: ["return", "returns"] },
|
|
968
|
+
{ tags: ["yield", "yields"] },
|
|
969
|
+
{ tags: ["throws", "exception"] },
|
|
970
|
+
{ tags: ["satisfies"] },
|
|
971
|
+
{ tags: ["default", "defaultvalue"] },
|
|
972
|
+
{ tags: ["exports"] },
|
|
973
|
+
{ tags: ["see", "tutorial"] },
|
|
974
|
+
{ tags: ["example"] }
|
|
975
|
+
] }],
|
|
976
|
+
"jsdoc/tag-lines": [
|
|
977
|
+
"error",
|
|
978
|
+
"any",
|
|
979
|
+
{
|
|
980
|
+
maxBlockLines: 1,
|
|
981
|
+
startLines: 1
|
|
982
|
+
}
|
|
983
|
+
],
|
|
984
|
+
"jsdoc/text-escaping": ["error", { escapeHTML: true }],
|
|
985
|
+
"jsdoc/ts-method-signature-style": "error",
|
|
986
|
+
"jsdoc/ts-no-unnecessary-template-expression": "error",
|
|
987
|
+
"jsdoc/ts-prefer-function-type": "error",
|
|
988
|
+
"jsdoc/type-formatting": ["error", {
|
|
989
|
+
objectFieldSeparatorOptionalLinebreak: false,
|
|
990
|
+
objectTypeBracketSpacing: " ",
|
|
991
|
+
separatorForSingleObjectField: true,
|
|
992
|
+
stringQuotes: "single",
|
|
993
|
+
trailingPunctuationMultilineOnly: true
|
|
994
|
+
}]
|
|
995
|
+
} }
|
|
996
|
+
});
|
|
997
|
+
const parser = await getTsEslintParserIfExists();
|
|
998
|
+
const examplePlugin = getJsdocProcessorPlugin ? getJsdocProcessorPlugin.getJsdocProcessorPlugin({
|
|
999
|
+
checkDefaults: true,
|
|
1000
|
+
checkExamples: true,
|
|
1001
|
+
checkParams: true,
|
|
1002
|
+
checkProperties: true,
|
|
1003
|
+
parser
|
|
1004
|
+
}) : void 0;
|
|
1005
|
+
return [
|
|
1006
|
+
createSetupConfig(false),
|
|
1007
|
+
parser ? createSetupConfig(true) : void 0,
|
|
1008
|
+
createRulesConfig(false),
|
|
1009
|
+
parser ? createRulesConfig(true) : void 0,
|
|
1010
|
+
...examplePlugin ? [{
|
|
1011
|
+
name: buildConfigName(MAIN_SCOPES.JSDOC, `${SUB_SCOPES.EXAMPLES}/${SUB_SCOPES.SETUP}`),
|
|
1012
|
+
plugins: { examples: examplePlugin }
|
|
1013
|
+
}, {
|
|
1014
|
+
name: buildConfigName(MAIN_SCOPES.JSDOC, `${SUB_SCOPES.EXAMPLES}/${SUB_SCOPES.PROCESSOR}`),
|
|
1015
|
+
files: GLOB_SCRIPT_FILES,
|
|
1016
|
+
processor: examplePlugin.processors?.["examples"]
|
|
1017
|
+
}] : []
|
|
1018
|
+
].filter(Boolean);
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/js/eslint/configs/json.ts
|
|
1023
|
+
const TSCONFIG_FILES = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
1024
|
+
const JSON_FILES_TO_TREAT_AS_JSONC = [...TSCONFIG_FILES, ".vscode/**/*.json"];
|
|
1025
|
+
const LANGUAGE_TO_GLOB_MAP = {
|
|
1026
|
+
json: [GLOB_JSON],
|
|
1027
|
+
jsonc: [GLOB_JSONC, ...JSON_FILES_TO_TREAT_AS_JSONC],
|
|
1028
|
+
json5: [GLOB_JSON5]
|
|
1029
|
+
};
|
|
1030
|
+
const extractAllRules = (configs$1) => {
|
|
1031
|
+
const rules = {};
|
|
1032
|
+
for (const config of configs$1) if (config.rules) objectAssign(rules, config.rules);
|
|
1033
|
+
return rules;
|
|
1034
|
+
};
|
|
1035
|
+
const getJsoncSortConfigs = () => [
|
|
1036
|
+
{
|
|
1037
|
+
name: buildConfigName(MAIN_SCOPES.JSON, `${SUB_SCOPES.RULES}-sort-package-json`),
|
|
1038
|
+
files: ["**/package.json"],
|
|
1039
|
+
rules: {
|
|
1040
|
+
"jsonc/sort-array-values": ["error", {
|
|
1041
|
+
pathPattern: "^files$",
|
|
1042
|
+
order: { type: "asc" }
|
|
1043
|
+
}],
|
|
1044
|
+
"jsonc/sort-keys": [
|
|
1045
|
+
"error",
|
|
1046
|
+
{
|
|
1047
|
+
pathPattern: "^$",
|
|
1048
|
+
order: [
|
|
1049
|
+
"$schema",
|
|
1050
|
+
"jscpd",
|
|
1051
|
+
"jspm",
|
|
1052
|
+
"name",
|
|
1053
|
+
"version",
|
|
1054
|
+
"description",
|
|
1055
|
+
"license",
|
|
1056
|
+
"private",
|
|
1057
|
+
"author",
|
|
1058
|
+
"homepage",
|
|
1059
|
+
"man",
|
|
1060
|
+
"readme",
|
|
1061
|
+
"repository",
|
|
1062
|
+
"bugs",
|
|
1063
|
+
"funding",
|
|
1064
|
+
"type",
|
|
1065
|
+
"packageManager",
|
|
1066
|
+
"bundleDependencies",
|
|
1067
|
+
"os",
|
|
1068
|
+
"cpu",
|
|
1069
|
+
"libc",
|
|
1070
|
+
"engines",
|
|
1071
|
+
"devEngines",
|
|
1072
|
+
"scripts",
|
|
1073
|
+
"esnext",
|
|
1074
|
+
"module",
|
|
1075
|
+
"pnpm",
|
|
1076
|
+
"main",
|
|
1077
|
+
"browser",
|
|
1078
|
+
"dist",
|
|
1079
|
+
"bin",
|
|
1080
|
+
"types",
|
|
1081
|
+
"typings",
|
|
1082
|
+
"typesVersions",
|
|
1083
|
+
"imports",
|
|
1084
|
+
"exports",
|
|
1085
|
+
"files",
|
|
1086
|
+
"directories",
|
|
1087
|
+
"dependencies",
|
|
1088
|
+
"peerDependencies",
|
|
1089
|
+
"peerDependenciesMeta",
|
|
1090
|
+
"optionalDependencies",
|
|
1091
|
+
"devDependencies",
|
|
1092
|
+
"overrides",
|
|
1093
|
+
"resolutions",
|
|
1094
|
+
"workspaces",
|
|
1095
|
+
"maintainers",
|
|
1096
|
+
"contributors",
|
|
1097
|
+
"keywords",
|
|
1098
|
+
"config",
|
|
1099
|
+
"publishConfig",
|
|
1100
|
+
"release",
|
|
1101
|
+
"husky",
|
|
1102
|
+
"simple-git-hooks",
|
|
1103
|
+
"lint-staged",
|
|
1104
|
+
"eslintConfig",
|
|
1105
|
+
"stylelint",
|
|
1106
|
+
"prettier",
|
|
1107
|
+
"ava",
|
|
1108
|
+
"stackblitz",
|
|
1109
|
+
"volta"
|
|
1110
|
+
]
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
pathPattern: "^exports.*$",
|
|
1114
|
+
order: [
|
|
1115
|
+
"default",
|
|
1116
|
+
"import",
|
|
1117
|
+
"require",
|
|
1118
|
+
"types"
|
|
1119
|
+
]
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
|
|
1123
|
+
order: { type: "asc" }
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$",
|
|
1127
|
+
order: { type: "asc" }
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
pathPattern: "^contributors.*$",
|
|
1131
|
+
order: [
|
|
1132
|
+
"name",
|
|
1133
|
+
"email",
|
|
1134
|
+
"url"
|
|
1135
|
+
]
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
pathPattern: "^(?:husky|simple-git-hooks)$",
|
|
1139
|
+
order: [
|
|
1140
|
+
"pre-commit",
|
|
1141
|
+
"prepare-commit-msg",
|
|
1142
|
+
"commit-msg",
|
|
1143
|
+
"post-commit",
|
|
1144
|
+
"pre-rebase",
|
|
1145
|
+
"post-rewrite",
|
|
1146
|
+
"post-checkout",
|
|
1147
|
+
"post-merge",
|
|
1148
|
+
"pre-push",
|
|
1149
|
+
"pre-auto-gc"
|
|
1150
|
+
]
|
|
1151
|
+
}
|
|
1152
|
+
]
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
name: buildConfigName(MAIN_SCOPES.JSON, `${SUB_SCOPES.RULES}-sort-composer-json`),
|
|
1157
|
+
files: ["**/composer.json"],
|
|
1158
|
+
rules: { "jsonc/sort-keys": [
|
|
1159
|
+
"error",
|
|
1160
|
+
{
|
|
1161
|
+
pathPattern: "^$",
|
|
1162
|
+
order: [
|
|
1163
|
+
"$schema",
|
|
1164
|
+
"name",
|
|
1165
|
+
"version",
|
|
1166
|
+
"time",
|
|
1167
|
+
"description",
|
|
1168
|
+
"_comment",
|
|
1169
|
+
"license",
|
|
1170
|
+
"authors",
|
|
1171
|
+
"abandoned",
|
|
1172
|
+
"homepage",
|
|
1173
|
+
"readme",
|
|
1174
|
+
"support",
|
|
1175
|
+
"funding",
|
|
1176
|
+
"type",
|
|
1177
|
+
"scripts",
|
|
1178
|
+
"bin",
|
|
1179
|
+
"require",
|
|
1180
|
+
"require-dev",
|
|
1181
|
+
"replace",
|
|
1182
|
+
"provide",
|
|
1183
|
+
"conflict",
|
|
1184
|
+
"suggest",
|
|
1185
|
+
"autoload",
|
|
1186
|
+
"autoload-dev",
|
|
1187
|
+
"include-path",
|
|
1188
|
+
"target-dir",
|
|
1189
|
+
"extra",
|
|
1190
|
+
"minimum-stability",
|
|
1191
|
+
"prefer-stable",
|
|
1192
|
+
"config",
|
|
1193
|
+
"repositories",
|
|
1194
|
+
"archive",
|
|
1195
|
+
"keywords"
|
|
1196
|
+
]
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
pathPattern: "^authors.*$",
|
|
1200
|
+
order: [
|
|
1201
|
+
"name",
|
|
1202
|
+
"role",
|
|
1203
|
+
"email",
|
|
1204
|
+
"homepage"
|
|
1205
|
+
]
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
pathPattern: "^require|require-dev|replace|provide|conflict|suggest$",
|
|
1209
|
+
order: [
|
|
1210
|
+
{ keyPattern: "^php$" },
|
|
1211
|
+
{ keyPattern: "^ext-(.+)$" },
|
|
1212
|
+
{ order: { type: "asc" } }
|
|
1213
|
+
]
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
pathPattern: "autoload(-dev)?",
|
|
1217
|
+
order: [
|
|
1218
|
+
"psr-0",
|
|
1219
|
+
"psr-4",
|
|
1220
|
+
"classmap",
|
|
1221
|
+
"files",
|
|
1222
|
+
"exclude-from-classmap"
|
|
1223
|
+
]
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
pathPattern: "^extra$",
|
|
1227
|
+
order: { type: "asc" }
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
pathPattern: "^config$",
|
|
1231
|
+
order: [
|
|
1232
|
+
"platform",
|
|
1233
|
+
"platform-check",
|
|
1234
|
+
"allow-missing-requirements",
|
|
1235
|
+
"bin-compat",
|
|
1236
|
+
"bump-after-update",
|
|
1237
|
+
"classmap-authoritative",
|
|
1238
|
+
"discard-changes",
|
|
1239
|
+
"lock",
|
|
1240
|
+
"notify-on-install",
|
|
1241
|
+
"preferred-install",
|
|
1242
|
+
"sort-packages",
|
|
1243
|
+
"apcu-autoloader",
|
|
1244
|
+
"autoloader-suffix",
|
|
1245
|
+
"prepend-autoloader",
|
|
1246
|
+
"optimize-autoloader",
|
|
1247
|
+
"process-timeout",
|
|
1248
|
+
"store-auths",
|
|
1249
|
+
"allow-plugins",
|
|
1250
|
+
"use-include-path",
|
|
1251
|
+
"use-parent-dir",
|
|
1252
|
+
"archive-format",
|
|
1253
|
+
"archive-dir",
|
|
1254
|
+
"vendor-dir",
|
|
1255
|
+
"bin-dir",
|
|
1256
|
+
"data-dir",
|
|
1257
|
+
"cache-dir",
|
|
1258
|
+
"cache-files-dir",
|
|
1259
|
+
"cache-repo-dir",
|
|
1260
|
+
"cache-vcs-dir",
|
|
1261
|
+
"cache-files-ttl",
|
|
1262
|
+
"cache-files-maxsize",
|
|
1263
|
+
"cache-read-only",
|
|
1264
|
+
"audit",
|
|
1265
|
+
"htaccess-protect",
|
|
1266
|
+
"disable-tls",
|
|
1267
|
+
"secure-http",
|
|
1268
|
+
"cafile",
|
|
1269
|
+
"capath",
|
|
1270
|
+
"http-basic",
|
|
1271
|
+
"bearer",
|
|
1272
|
+
"use-github-api",
|
|
1273
|
+
"github-expose-hostname",
|
|
1274
|
+
"github-protocols",
|
|
1275
|
+
"bitbucket-oauth",
|
|
1276
|
+
"secure-svn-domains",
|
|
1277
|
+
"github-oauth",
|
|
1278
|
+
"github-domains",
|
|
1279
|
+
"gitlab-token",
|
|
1280
|
+
"gitlab-protocol",
|
|
1281
|
+
"gitlab-oauth",
|
|
1282
|
+
"gitlab-domains"
|
|
1283
|
+
]
|
|
1284
|
+
}
|
|
1285
|
+
] }
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
name: buildConfigName(MAIN_SCOPES.JSON, `${SUB_SCOPES.RULES}-sort-tsconfig-json`),
|
|
1289
|
+
files: TSCONFIG_FILES,
|
|
1290
|
+
rules: {
|
|
1291
|
+
"jsonc/sort-array-values": ["error", {
|
|
1292
|
+
pathPattern: "^(?:files|include|exclude)$",
|
|
1293
|
+
order: { type: "asc" }
|
|
1294
|
+
}],
|
|
1295
|
+
"jsonc/sort-keys": [
|
|
1296
|
+
"error",
|
|
1297
|
+
{
|
|
1298
|
+
pathPattern: "^$",
|
|
1299
|
+
order: [
|
|
1300
|
+
"$schema",
|
|
1301
|
+
"extends",
|
|
1302
|
+
"references",
|
|
1303
|
+
"files",
|
|
1304
|
+
"include",
|
|
1305
|
+
"exclude",
|
|
1306
|
+
"compilerOptions",
|
|
1307
|
+
"watchOptions",
|
|
1308
|
+
"typeAcquisition"
|
|
1309
|
+
]
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
pathPattern: "^compilerOptions$",
|
|
1313
|
+
order: [
|
|
1314
|
+
"emitDecoratorMetadata",
|
|
1315
|
+
"experimentalDecorators",
|
|
1316
|
+
"jsx",
|
|
1317
|
+
"jsxFactory",
|
|
1318
|
+
"jsxFragmentFactory",
|
|
1319
|
+
"jsxImportSource",
|
|
1320
|
+
"lib",
|
|
1321
|
+
"libReplacement",
|
|
1322
|
+
"moduleDetection",
|
|
1323
|
+
"noLib",
|
|
1324
|
+
"reactNamespace",
|
|
1325
|
+
"target",
|
|
1326
|
+
"useDefineForClassFields",
|
|
1327
|
+
"incremental",
|
|
1328
|
+
"composite",
|
|
1329
|
+
"tsBuildInfoFile",
|
|
1330
|
+
"disableReferencedProjectLoad",
|
|
1331
|
+
"disableSolutionSearching",
|
|
1332
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
1333
|
+
"allowArbitraryExtensions",
|
|
1334
|
+
"allowImportingTsExtensions",
|
|
1335
|
+
"allowUmdGlobalAccess",
|
|
1336
|
+
"baseUrl",
|
|
1337
|
+
"customConditions",
|
|
1338
|
+
"module",
|
|
1339
|
+
"moduleResolution",
|
|
1340
|
+
"moduleSuffixes",
|
|
1341
|
+
"noResolve",
|
|
1342
|
+
"noUncheckedSideEffectImports",
|
|
1343
|
+
"paths",
|
|
1344
|
+
"resolveJsonModule",
|
|
1345
|
+
"resolvePackageJsonExports",
|
|
1346
|
+
"resolvePackageJsonImports",
|
|
1347
|
+
"rewriteRelativeImportExtensions",
|
|
1348
|
+
"rootDir",
|
|
1349
|
+
"rootDirs",
|
|
1350
|
+
"typeRoots",
|
|
1351
|
+
"types",
|
|
1352
|
+
"declaration",
|
|
1353
|
+
"declarationDir",
|
|
1354
|
+
"declarationMap",
|
|
1355
|
+
"downlevelIteration",
|
|
1356
|
+
"emitBOM",
|
|
1357
|
+
"emitDeclarationOnly",
|
|
1358
|
+
"importHelpers",
|
|
1359
|
+
"inlineSourceMap",
|
|
1360
|
+
"inlineSources",
|
|
1361
|
+
"mapRoot",
|
|
1362
|
+
"newLine",
|
|
1363
|
+
"noEmit",
|
|
1364
|
+
"noEmitHelpers",
|
|
1365
|
+
"noEmitOnError",
|
|
1366
|
+
"outDir",
|
|
1367
|
+
"outFile",
|
|
1368
|
+
"preserveConstEnums",
|
|
1369
|
+
"removeComments",
|
|
1370
|
+
"sourceMap",
|
|
1371
|
+
"sourceRoot",
|
|
1372
|
+
"stripInternal",
|
|
1373
|
+
"skipDefaultLibCheck",
|
|
1374
|
+
"skipLibCheck",
|
|
1375
|
+
"noErrorTruncation",
|
|
1376
|
+
"preserveWatchOutput",
|
|
1377
|
+
"pretty",
|
|
1378
|
+
"assumeChangesOnlyAffectDirectDependencies",
|
|
1379
|
+
"allowJs",
|
|
1380
|
+
"checkJs",
|
|
1381
|
+
"maxNodeModuleJsDepth",
|
|
1382
|
+
"allowSyntheticDefaultImports",
|
|
1383
|
+
"erasableSyntaxOnly",
|
|
1384
|
+
"esModuleInterop",
|
|
1385
|
+
"forceConsistentCasingInFileNames",
|
|
1386
|
+
"isolatedDeclarations",
|
|
1387
|
+
"isolatedModules",
|
|
1388
|
+
"preserveSymlinks",
|
|
1389
|
+
"verbatimModuleSyntax",
|
|
1390
|
+
"allowUnreachableCode",
|
|
1391
|
+
"allowUnusedLabels",
|
|
1392
|
+
"alwaysStrict",
|
|
1393
|
+
"exactOptionalPropertyTypes",
|
|
1394
|
+
"noFallthroughCasesInSwitch",
|
|
1395
|
+
"noImplicitAny",
|
|
1396
|
+
"noImplicitOverride",
|
|
1397
|
+
"noImplicitReturns",
|
|
1398
|
+
"noImplicitThis",
|
|
1399
|
+
"noPropertyAccessFromIndexSignature",
|
|
1400
|
+
"noUncheckedIndexedAccess",
|
|
1401
|
+
"noUnusedLocals",
|
|
1402
|
+
"noUnusedParameters",
|
|
1403
|
+
"strict",
|
|
1404
|
+
"strictBindCallApply",
|
|
1405
|
+
"strictBuiltinIteratorReturn",
|
|
1406
|
+
"strictFunctionTypes",
|
|
1407
|
+
"strictNullChecks",
|
|
1408
|
+
"strictPropertyInitialization",
|
|
1409
|
+
"useUnknownInCatchVariables",
|
|
1410
|
+
"diagnostics",
|
|
1411
|
+
"explainFiles",
|
|
1412
|
+
"extendedDiagnostics",
|
|
1413
|
+
"generateCpuProfile",
|
|
1414
|
+
"generateTrace",
|
|
1415
|
+
"listEmittedFiles",
|
|
1416
|
+
"listFiles",
|
|
1417
|
+
"noCheck",
|
|
1418
|
+
"traceResolution",
|
|
1419
|
+
"charset",
|
|
1420
|
+
"importsNotUsedAsValues",
|
|
1421
|
+
"keyofStringsOnly",
|
|
1422
|
+
"noImplicitUseStrict",
|
|
1423
|
+
"noStrictGenericChecks",
|
|
1424
|
+
"out",
|
|
1425
|
+
"preserveValueImports",
|
|
1426
|
+
"suppressExcessPropertyErrors",
|
|
1427
|
+
"suppressImplicitAnyIndexErrors",
|
|
1428
|
+
"disableSizeLimit",
|
|
1429
|
+
"plugins"
|
|
1430
|
+
]
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
pathPattern: "^watchOptions$",
|
|
1434
|
+
order: [
|
|
1435
|
+
"watchFile",
|
|
1436
|
+
"watchDirectory",
|
|
1437
|
+
"fallbackPolling",
|
|
1438
|
+
"synchronousWatchDirectory",
|
|
1439
|
+
"excludeDirectories ",
|
|
1440
|
+
"excludeFiles"
|
|
1441
|
+
]
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
pathPattern: "^typeAcquisition$",
|
|
1445
|
+
order: [
|
|
1446
|
+
"enable",
|
|
1447
|
+
"include",
|
|
1448
|
+
"exclude",
|
|
1449
|
+
"disableFilenameBasedTypeAcquisition"
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
]
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
];
|
|
1456
|
+
const json = async () => {
|
|
1457
|
+
const { requiredAll: [pluginJson], optional: [pluginJsonc, parserJsonc] } = await resolvePackages(MODULES.json);
|
|
1458
|
+
if (!pluginJson) return [];
|
|
1459
|
+
const createRulesConfig = (language) => ({
|
|
1460
|
+
name: buildConfigName(MAIN_SCOPES.JSON, `${SUB_SCOPES.RULES}-${language}`),
|
|
1461
|
+
language: `json/${language}`,
|
|
1462
|
+
files: LANGUAGE_TO_GLOB_MAP[language],
|
|
1463
|
+
...language === "json" ? { ignores: JSON_FILES_TO_TREAT_AS_JSONC } : void 0,
|
|
1464
|
+
rules: {
|
|
1465
|
+
...pluginJson.configs.recommended.rules,
|
|
1466
|
+
...pluginJsonc ? extractAllRules(pluginJsonc.configs[`flat/recommended-with-${language}`]) : void 0,
|
|
1467
|
+
...pluginJsonc ? {
|
|
1468
|
+
"jsonc/array-bracket-newline": ["error", "consistent"],
|
|
1469
|
+
"jsonc/array-bracket-spacing": "error",
|
|
1470
|
+
"jsonc/comma-style": "error",
|
|
1471
|
+
"jsonc/indent": ["error", INDENT],
|
|
1472
|
+
"jsonc/key-spacing": "error",
|
|
1473
|
+
"jsonc/no-irregular-whitespace": "error",
|
|
1474
|
+
"jsonc/no-octal-escape": "error",
|
|
1475
|
+
"jsonc/object-curly-newline": "error",
|
|
1476
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1477
|
+
"jsonc/object-property-newline": "error",
|
|
1478
|
+
"jsonc/quotes": ["error", "double"]
|
|
1479
|
+
} : void 0
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
const plugins = { json: pluginJson };
|
|
1483
|
+
let jsoncSortConfigs = [];
|
|
1484
|
+
if (pluginJsonc) {
|
|
1485
|
+
plugins["jsonc"] = pluginJsonc;
|
|
1486
|
+
jsoncSortConfigs = getJsoncSortConfigs();
|
|
1487
|
+
}
|
|
1488
|
+
return [
|
|
1489
|
+
{
|
|
1490
|
+
name: buildConfigName(MAIN_SCOPES.JSON, SUB_SCOPES.SETUP),
|
|
1491
|
+
plugins
|
|
1492
|
+
},
|
|
1493
|
+
parserJsonc ? {
|
|
1494
|
+
name: buildConfigName(MAIN_SCOPES.JSON, SUB_SCOPES.PARSER),
|
|
1495
|
+
files: [
|
|
1496
|
+
GLOB_JSON,
|
|
1497
|
+
GLOB_JSONC,
|
|
1498
|
+
GLOB_JSON5
|
|
1499
|
+
],
|
|
1500
|
+
languageOptions: { parser: parserJsonc }
|
|
1501
|
+
} : void 0,
|
|
1502
|
+
createRulesConfig("json"),
|
|
1503
|
+
createRulesConfig("jsonc"),
|
|
1504
|
+
...jsoncSortConfigs,
|
|
1505
|
+
createRulesConfig("json5")
|
|
1506
|
+
].filter(Boolean);
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
//#endregion
|
|
1510
|
+
//#region src/js/eslint/configs/markdown.ts
|
|
1511
|
+
const extractRelevantValues = (identifier, configs$1, key) => {
|
|
1512
|
+
for (const config of configs$1) if (config.name === `markdown/${key}` && config[identifier] !== void 0 && config[identifier] !== null) return config[identifier];
|
|
1513
|
+
throw new Error(`Expected key "${key}" to be contained in given config.`);
|
|
1514
|
+
};
|
|
1515
|
+
const markdown = async (options) => {
|
|
1516
|
+
const { requiredAll: [pluginMarkdown, eslintMergeProcessors] } = await resolvePackages(MODULES.markdown);
|
|
1517
|
+
if (!pluginMarkdown || !eslintMergeProcessors) return [];
|
|
1518
|
+
const language = options?.language ?? "markdown/commonmark";
|
|
1519
|
+
const frontmatter = options?.frontmatter ?? false;
|
|
1520
|
+
const { mergeProcessors, processorPassThrough } = eslintMergeProcessors;
|
|
1521
|
+
return [
|
|
1522
|
+
{
|
|
1523
|
+
name: buildConfigName(MAIN_SCOPES.MARKDOWN, SUB_SCOPES.SETUP),
|
|
1524
|
+
plugins: { markdown: pluginMarkdown }
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
name: buildConfigName(MAIN_SCOPES.MARKDOWN, SUB_SCOPES.PROCESSOR),
|
|
1528
|
+
files: [GLOB_MD],
|
|
1529
|
+
processor: mergeProcessors([pluginMarkdown.processors.markdown, processorPassThrough])
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
name: buildConfigName(MAIN_SCOPES.MARKDOWN, SUB_SCOPES.RULES),
|
|
1533
|
+
files: [GLOB_MD],
|
|
1534
|
+
language,
|
|
1535
|
+
languageOptions: { frontmatter },
|
|
1536
|
+
rules: {
|
|
1537
|
+
...extractRelevantValues("rules", pluginMarkdown.configs.recommended, "recommended"),
|
|
1538
|
+
"markdown/no-bare-urls": "error",
|
|
1539
|
+
"markdown/no-duplicate-headings": ["error", { checkSiblingsOnly: true }],
|
|
1540
|
+
"markdown/no-html": ["error", { allowed: [
|
|
1541
|
+
"a",
|
|
1542
|
+
"br",
|
|
1543
|
+
"dd",
|
|
1544
|
+
"del",
|
|
1545
|
+
"details",
|
|
1546
|
+
"div",
|
|
1547
|
+
"dl",
|
|
1548
|
+
"dt",
|
|
1549
|
+
"h1",
|
|
1550
|
+
"img",
|
|
1551
|
+
"ins",
|
|
1552
|
+
"kbd",
|
|
1553
|
+
"p",
|
|
1554
|
+
"q",
|
|
1555
|
+
"rp",
|
|
1556
|
+
"rt",
|
|
1557
|
+
"ruby",
|
|
1558
|
+
"samp",
|
|
1559
|
+
"sub",
|
|
1560
|
+
"summary",
|
|
1561
|
+
"sup",
|
|
1562
|
+
"var"
|
|
1563
|
+
] }]
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
{
|
|
1567
|
+
name: buildConfigName(MAIN_SCOPES.MARKDOWN, `${SUB_SCOPES.RULES}-code-blocks`),
|
|
1568
|
+
files: extractRelevantValues("files", pluginMarkdown.configs.processor, "recommended/code-blocks"),
|
|
1569
|
+
languageOptions: extractRelevantValues("languageOptions", pluginMarkdown.configs.processor, "recommended/code-blocks"),
|
|
1570
|
+
rules: {
|
|
1571
|
+
...extractRelevantValues("rules", pluginMarkdown.configs.processor, "recommended/code-blocks"),
|
|
1572
|
+
"no-alert": "off",
|
|
1573
|
+
"no-console": "off",
|
|
1574
|
+
"no-inline-comments": "off",
|
|
1575
|
+
"import/no-default-export": "off",
|
|
1576
|
+
"import/unambiguous": "off",
|
|
1577
|
+
"node/no-missing-import": "off",
|
|
1578
|
+
"ts/no-redeclare": "off",
|
|
1579
|
+
"ts/no-unused-vars": "off",
|
|
1580
|
+
"unused/no-unused-imports": "off",
|
|
1581
|
+
"unused/no-unused-vars": "off"
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
];
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
//#endregion
|
|
1588
|
+
//#region src/js/eslint/configs/node.ts
|
|
1589
|
+
const node = async (options) => {
|
|
1590
|
+
const { requiredAll: [pluginNode] } = await resolvePackages(MODULES.node);
|
|
1591
|
+
if (!pluginNode) return [];
|
|
1592
|
+
return [{
|
|
1593
|
+
name: buildConfigName(MAIN_SCOPES.NODE, SUB_SCOPES.SETUP),
|
|
1594
|
+
plugins: { node: pluginNode },
|
|
1595
|
+
settings: { n: { version: options?.version ?? process.versions.node } }
|
|
1596
|
+
}, {
|
|
1597
|
+
name: buildConfigName(MAIN_SCOPES.NODE, SUB_SCOPES.RULES),
|
|
1598
|
+
files: GLOB_SCRIPT_FILES,
|
|
1599
|
+
rules: {
|
|
1600
|
+
...renameRules(pluginNode.configs["flat/recommended"].rules, { n: "node" }),
|
|
1601
|
+
"node/exports-style": "error",
|
|
1602
|
+
"node/global-require": "error",
|
|
1603
|
+
"node/handle-callback-err": "error",
|
|
1604
|
+
"node/no-missing-import": "error",
|
|
1605
|
+
"node/no-mixed-requires": "error",
|
|
1606
|
+
"node/no-new-require": "error",
|
|
1607
|
+
"node/no-path-concat": "error",
|
|
1608
|
+
"node/no-process-env": "error",
|
|
1609
|
+
"node/no-sync": "error",
|
|
1610
|
+
"node/prefer-global/buffer": "error",
|
|
1611
|
+
"node/prefer-global/console": "error",
|
|
1612
|
+
"node/prefer-global/process": "error",
|
|
1613
|
+
"node/prefer-global/text-decoder": "error",
|
|
1614
|
+
"node/prefer-global/text-encoder": "error",
|
|
1615
|
+
"node/prefer-global/url-search-params": "error",
|
|
1616
|
+
"node/prefer-global/url": "error",
|
|
1617
|
+
"node/prefer-node-protocol": "error",
|
|
1618
|
+
"node/prefer-promises/dns": "error",
|
|
1619
|
+
"node/prefer-promises/fs": "error"
|
|
1620
|
+
}
|
|
1621
|
+
}];
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
//#endregion
|
|
1625
|
+
//#region src/js/eslint/configs/unicorn.ts
|
|
1626
|
+
const FILE_NAMES_TO_IGNORE = [
|
|
1627
|
+
"ACKNOWLEDGMENTS.md",
|
|
1628
|
+
"ADOPTERS.md",
|
|
1629
|
+
"AGENTS.md",
|
|
1630
|
+
"API_REFERENCE.md",
|
|
1631
|
+
"ARCHITECTURE.md",
|
|
1632
|
+
"AUTHORS.md",
|
|
1633
|
+
"BUILD.md",
|
|
1634
|
+
"CHANGELOG.md",
|
|
1635
|
+
"CODE_OF_CONDUCT.md",
|
|
1636
|
+
"CODEOWNERS.md",
|
|
1637
|
+
"CODING_STANDARDS.md",
|
|
1638
|
+
"COMMUNITY_GUIDELINES.md",
|
|
1639
|
+
"CONFIGURATION.md",
|
|
1640
|
+
"CONTRIBUTING.md",
|
|
1641
|
+
"CONTRIBUTORS.md",
|
|
1642
|
+
"DATA_CARD.md",
|
|
1643
|
+
"DATA_MODEL.md",
|
|
1644
|
+
"DATA_PRIVACY.md",
|
|
1645
|
+
"DEPENDENCIES.md",
|
|
1646
|
+
"DESIGN.md",
|
|
1647
|
+
"DEVELOPMENT.md",
|
|
1648
|
+
"ETHICS.md",
|
|
1649
|
+
"EVALUATION.md",
|
|
1650
|
+
"FAQ.md",
|
|
1651
|
+
"GOVERNANCE.md",
|
|
1652
|
+
"INSTALL.md",
|
|
1653
|
+
"ISSUE_TEMPLATE.md",
|
|
1654
|
+
"LICENSE.md",
|
|
1655
|
+
"LLMS.md",
|
|
1656
|
+
"LOCALIZATION.md",
|
|
1657
|
+
"MAINTAINERS.md",
|
|
1658
|
+
"MEETING_NOTES.md",
|
|
1659
|
+
"MIGRATIONS.md",
|
|
1660
|
+
"ML_LIFECYCLE.md",
|
|
1661
|
+
"ML_PIPELINE.md",
|
|
1662
|
+
"MLOPS.md",
|
|
1663
|
+
"MODEL_CARD.md",
|
|
1664
|
+
"MODEL_MONITORING.md",
|
|
1665
|
+
"NFR.md",
|
|
1666
|
+
"OVERVIEW.md",
|
|
1667
|
+
"PERFORMANCE.md",
|
|
1668
|
+
"PROJECT_METADATA.md",
|
|
1669
|
+
"PULL_REQUEST_TEMPLATE.md",
|
|
1670
|
+
"README.md",
|
|
1671
|
+
"REFERENCES.md",
|
|
1672
|
+
"RELEASE_PROCESS.md",
|
|
1673
|
+
"RELEASING.md",
|
|
1674
|
+
"RESEARCH.md",
|
|
1675
|
+
"ROADMAP.md",
|
|
1676
|
+
"SPEC.md",
|
|
1677
|
+
"SECURITY_POLICY.md",
|
|
1678
|
+
"SECURITY.md",
|
|
1679
|
+
"STYLE_GUIDE.md",
|
|
1680
|
+
"SUPPORT.md",
|
|
1681
|
+
"TESTING.md",
|
|
1682
|
+
"THIRD_PARTY.md",
|
|
1683
|
+
"THREAT_MODEL.md",
|
|
1684
|
+
"TROUBLESHOOTING.md",
|
|
1685
|
+
"UPGRADE_NOTES.md",
|
|
1686
|
+
"VERSIONING.md"
|
|
1687
|
+
];
|
|
1688
|
+
const unicorn = async () => {
|
|
1689
|
+
const { requiredAll: [pluginUnicorn] } = await resolvePackages(MODULES.unicorn);
|
|
1690
|
+
if (!pluginUnicorn) return [];
|
|
1691
|
+
return [{
|
|
1692
|
+
name: buildConfigName(MAIN_SCOPES.UNICORN, SUB_SCOPES.SETUP),
|
|
1693
|
+
plugins: { unicorn: pluginUnicorn }
|
|
1694
|
+
}, {
|
|
1695
|
+
name: buildConfigName(MAIN_SCOPES.UNICORN, SUB_SCOPES.RULES),
|
|
1696
|
+
files: GLOB_SCRIPT_FILES,
|
|
1697
|
+
rules: {
|
|
1698
|
+
...pluginUnicorn.configs.recommended.rules,
|
|
1699
|
+
"unicorn/better-regex": "error",
|
|
1700
|
+
"unicorn/consistent-destructuring": "error",
|
|
1701
|
+
"unicorn/custom-error-definition": "error",
|
|
1702
|
+
"unicorn/filename-case": ["error", {
|
|
1703
|
+
case: "kebabCase",
|
|
1704
|
+
ignore: FILE_NAMES_TO_IGNORE
|
|
1705
|
+
}],
|
|
1706
|
+
"unicorn/require-post-message-target-origin": "error",
|
|
1707
|
+
"unicorn/no-keyword-prefix": "error",
|
|
1708
|
+
"unicorn/no-nested-ternay": "off",
|
|
1709
|
+
"no-nested-ternary": "error",
|
|
1710
|
+
"unicorn/no-unused-properties": "error",
|
|
1711
|
+
"unicorn/prefer-json-parse-buffer": "error",
|
|
1712
|
+
"unicorn/prefer-switch": "off",
|
|
1713
|
+
"unicorn/string-content": ["error", { patterns: {
|
|
1714
|
+
"\\.\\.\\.": "…",
|
|
1715
|
+
"^http:\\/\\/": String.raw`^https:\/\/`
|
|
1716
|
+
} }]
|
|
1717
|
+
}
|
|
1718
|
+
}];
|
|
1719
|
+
};
|
|
1720
|
+
|
|
1721
|
+
//#endregion
|
|
1722
|
+
//#region src/js/eslint/configs/overrides.ts
|
|
1723
|
+
const jsOverrides = [{
|
|
1724
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.JAVASCRIPT}/scripts`),
|
|
1725
|
+
files: GLOB_SCRIPT_FILES.map((glob) => `scripts/${glob}`),
|
|
1726
|
+
languageOptions: {
|
|
1727
|
+
sourceType: "script",
|
|
1728
|
+
parserOptions: { sourceType: "script" }
|
|
1729
|
+
},
|
|
1730
|
+
rules: {
|
|
1731
|
+
"no-console": "off",
|
|
1732
|
+
strict: ["error", "global"]
|
|
1733
|
+
}
|
|
1734
|
+
}, {
|
|
1735
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.JAVASCRIPT}/cjs`),
|
|
1736
|
+
files: [GLOB_CJS],
|
|
1737
|
+
languageOptions: {
|
|
1738
|
+
sourceType: "commonjs",
|
|
1739
|
+
parserOptions: { sourceType: "commonjs" }
|
|
1740
|
+
},
|
|
1741
|
+
rules: {
|
|
1742
|
+
strict: ["error", "global"],
|
|
1743
|
+
"unicorn/prefer-module": "off",
|
|
1744
|
+
"ts/no-require-imports": "off"
|
|
1745
|
+
}
|
|
1746
|
+
}];
|
|
1747
|
+
const tsOverrides = isModuleEnabled(MODULES.typescript) ? [{
|
|
1748
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.TYPESCRIPT}/ts`),
|
|
1749
|
+
files: [GLOB_TS],
|
|
1750
|
+
rules: {
|
|
1751
|
+
strict: "off",
|
|
1752
|
+
"node/no-missing-import": "off"
|
|
1753
|
+
}
|
|
1754
|
+
}, {
|
|
1755
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.TYPESCRIPT}/dts`),
|
|
1756
|
+
files: [GLOB_DTS],
|
|
1757
|
+
rules: {
|
|
1758
|
+
"max-lines": "off",
|
|
1759
|
+
"no-restricted-syntax": "off",
|
|
1760
|
+
"no-var": "off",
|
|
1761
|
+
"vars-on-top": "off",
|
|
1762
|
+
"comments/no-unlimited-disable": "off",
|
|
1763
|
+
"import/no-extraneous-dependencies": "off",
|
|
1764
|
+
"import/unambiguous": "off"
|
|
1765
|
+
}
|
|
1766
|
+
}] : [];
|
|
1767
|
+
const testOverrides = isModuleEnabled(MODULES.test) ? [{
|
|
1768
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.TEST}/general`),
|
|
1769
|
+
files: GLOB_TEST_FILES,
|
|
1770
|
+
rules: { "node/no-sync": "off" }
|
|
1771
|
+
}] : [];
|
|
1772
|
+
const unicornOverrides = isModuleEnabled(MODULES.unicorn) ? [{
|
|
1773
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.UNICORN}/general`),
|
|
1774
|
+
files: [...GLOB_SCRIPT_FILES.map((glob) => `**/classes/${glob}`), ...GLOB_SCRIPT_FILES.map((glob) => `**/errors/${glob}`)],
|
|
1775
|
+
rules: { "unicorn/filename-case": ["error", {
|
|
1776
|
+
case: "pascalCase",
|
|
1777
|
+
ignore: FILE_NAMES_TO_IGNORE
|
|
1778
|
+
}] }
|
|
1779
|
+
}] : [];
|
|
1780
|
+
const jsdocOverrides = isModuleEnabled(MODULES.jsdoc) ? [{
|
|
1781
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.JSDOC}/${SUB_SCOPES.EXAMPLES}`),
|
|
1782
|
+
files: [GLOB_EXAMPLES],
|
|
1783
|
+
rules: {
|
|
1784
|
+
"no-console": "off",
|
|
1785
|
+
"no-undef": "off",
|
|
1786
|
+
"no-unused-expressions": "off",
|
|
1787
|
+
"no-unused-vars": "off",
|
|
1788
|
+
"node/no-missing-import": "off",
|
|
1789
|
+
"node/no-missing-require": "off",
|
|
1790
|
+
strict: "off",
|
|
1791
|
+
"import/no-unresolved": "off",
|
|
1792
|
+
"import/unambiguous": "off",
|
|
1793
|
+
"style/eol-last": "off",
|
|
1794
|
+
"style/no-multiple-empty-lines": "off",
|
|
1795
|
+
"ts/no-unused-expressions": "off",
|
|
1796
|
+
"ts/no-unused-vars": "off"
|
|
1797
|
+
}
|
|
1798
|
+
}, {
|
|
1799
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.JSDOC}/default-expressions`),
|
|
1800
|
+
files: [
|
|
1801
|
+
"**/*.jsdoc-defaults",
|
|
1802
|
+
"**/*.jsdoc-params",
|
|
1803
|
+
"**/*.jsdoc-properties"
|
|
1804
|
+
],
|
|
1805
|
+
rules: {
|
|
1806
|
+
"no-empty-function": "off",
|
|
1807
|
+
"no-new": "off",
|
|
1808
|
+
strict: "off",
|
|
1809
|
+
"import/unambiguous": "off",
|
|
1810
|
+
"style/eol-last": "off",
|
|
1811
|
+
"style/no-extra-parens": "off",
|
|
1812
|
+
"style/semi": "off"
|
|
1813
|
+
}
|
|
1814
|
+
}] : [];
|
|
1815
|
+
const svelteOverrides = isModuleEnabled(MODULES.svelte) ? [{
|
|
1816
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.SVELTE}/general`),
|
|
1817
|
+
files: [GLOB_SVELTE],
|
|
1818
|
+
rules: {
|
|
1819
|
+
"no-inner-declarations": "off",
|
|
1820
|
+
"no-self-assign": "off",
|
|
1821
|
+
"import/no-rename-default": "off",
|
|
1822
|
+
"import/unambiguous": "off",
|
|
1823
|
+
"svelte/comment-directive": ["error", { reportUnusedDisableDirectives: true }],
|
|
1824
|
+
"svelte/system": "error"
|
|
1825
|
+
}
|
|
1826
|
+
}, {
|
|
1827
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.SVELTE}/components`),
|
|
1828
|
+
files: [`**/components/${GLOB_SVELTE}`],
|
|
1829
|
+
rules: { "unicorn/filename-case": ["error", { case: "pascalCase" }] }
|
|
1830
|
+
}] : [];
|
|
1831
|
+
const tomlOverrides = isModuleEnabled(MODULES.toml) ? [{
|
|
1832
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.TOML}/general`),
|
|
1833
|
+
files: [GLOB_TOML],
|
|
1834
|
+
rules: { "no-irregular-whitespace": "off" }
|
|
1835
|
+
}] : [];
|
|
1836
|
+
const yamlOverrides = isModuleEnabled(MODULES.yaml) ? [{
|
|
1837
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.YAML}/general`),
|
|
1838
|
+
files: [GLOB_YAML],
|
|
1839
|
+
rules: {
|
|
1840
|
+
"no-irregular-whitespace": "off",
|
|
1841
|
+
"no-unused-vars": "off"
|
|
1842
|
+
}
|
|
1843
|
+
}] : [];
|
|
1844
|
+
const overrides = () => [
|
|
1845
|
+
...jsOverrides,
|
|
1846
|
+
...tsOverrides,
|
|
1847
|
+
...testOverrides,
|
|
1848
|
+
...unicornOverrides,
|
|
1849
|
+
...jsdocOverrides,
|
|
1850
|
+
...svelteOverrides,
|
|
1851
|
+
...tomlOverrides,
|
|
1852
|
+
...yamlOverrides,
|
|
1853
|
+
{
|
|
1854
|
+
name: buildConfigName(MAIN_SCOPES.OVERRIDES, SUB_SCOPES.DEVELOPMENT),
|
|
1855
|
+
files: GLOB_DEVELOPMENT_FILES,
|
|
1856
|
+
rules: {
|
|
1857
|
+
"max-lines": "off",
|
|
1858
|
+
"max-lines-per-function": "off",
|
|
1859
|
+
"no-irregular-whitespace": "off",
|
|
1860
|
+
"no-restricted-exports": "off",
|
|
1861
|
+
"import/max-dependencies": "off",
|
|
1862
|
+
"import/no-default-export": "off",
|
|
1863
|
+
"import/no-rename-default": "off",
|
|
1864
|
+
"import/no-named-as-default-member": "off",
|
|
1865
|
+
"node/no-sync": "off"
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
];
|
|
1869
|
+
|
|
1870
|
+
//#endregion
|
|
1871
|
+
//#region src/js/eslint/configs/perfectionist.ts
|
|
1872
|
+
const perfectionist = async () => {
|
|
1873
|
+
const { requiredAll: [pluginPerfectionist] } = await resolvePackages(MODULES.perfectionist);
|
|
1874
|
+
if (!pluginPerfectionist) return [];
|
|
1875
|
+
return [{
|
|
1876
|
+
name: buildConfigName(MAIN_SCOPES.PERFECTIONIST, SUB_SCOPES.SETUP),
|
|
1877
|
+
plugins: { perfectionist: pluginPerfectionist }
|
|
1878
|
+
}, {
|
|
1879
|
+
name: buildConfigName(MAIN_SCOPES.PERFECTIONIST, SUB_SCOPES.RULES),
|
|
1880
|
+
files: GLOB_SCRIPT_FILES,
|
|
1881
|
+
rules: {
|
|
1882
|
+
"perfectionist/sort-array-includes": "error",
|
|
1883
|
+
"perfectionist/sort-heritage-clauses": "error",
|
|
1884
|
+
"perfectionist/sort-maps": "error",
|
|
1885
|
+
"perfectionist/sort-named-exports": "error",
|
|
1886
|
+
"perfectionist/sort-sets": "error",
|
|
1887
|
+
"perfectionist/sort-switch-case": "error"
|
|
1888
|
+
}
|
|
1889
|
+
}];
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
//#endregion
|
|
1893
|
+
//#region src/js/eslint/configs/regexp.ts
|
|
1894
|
+
const regexp = async () => {
|
|
1895
|
+
const { requiredAll: [pluginRegExp] } = await resolvePackages(MODULES.regexp);
|
|
1896
|
+
if (!pluginRegExp) return [];
|
|
1897
|
+
return [{
|
|
1898
|
+
name: buildConfigName(MAIN_SCOPES.REGEXP, SUB_SCOPES.SETUP),
|
|
1899
|
+
plugins: { regexp: pluginRegExp }
|
|
1900
|
+
}, {
|
|
1901
|
+
name: buildConfigName(MAIN_SCOPES.REGEXP, SUB_SCOPES.RULES),
|
|
1902
|
+
files: GLOB_SCRIPT_FILES,
|
|
1903
|
+
rules: {
|
|
1904
|
+
...pluginRegExp.configs.recommended.rules,
|
|
1905
|
+
"regexp/confusing-quantifier": "error",
|
|
1906
|
+
"regexp/grapheme-string-literal": "error",
|
|
1907
|
+
"regexp/letter-case": ["error", {
|
|
1908
|
+
caseInsensitive: "lowercase",
|
|
1909
|
+
unicodeEscape: "lowercase",
|
|
1910
|
+
hexadecimalEscape: "lowercase",
|
|
1911
|
+
controlEscape: "uppercase"
|
|
1912
|
+
}],
|
|
1913
|
+
"regexp/no-control-character": "error",
|
|
1914
|
+
"regexp/no-empty-alternative": "error",
|
|
1915
|
+
"regexp/no-lazy-ends": "error",
|
|
1916
|
+
"regexp/no-octal": "error",
|
|
1917
|
+
"regexp/no-potentially-useless-backreference": "error",
|
|
1918
|
+
"regexp/no-standalone-backslash": "error",
|
|
1919
|
+
"regexp/no-super-linear-move": "error",
|
|
1920
|
+
"regexp/no-useless-flag": "error",
|
|
1921
|
+
"regexp/optimal-lookaround-quantifier": "error",
|
|
1922
|
+
"regexp/prefer-escape-replacement-dollar-char": "error",
|
|
1923
|
+
"regexp/prefer-lookaround": "error",
|
|
1924
|
+
"regexp/prefer-named-backreference": "error",
|
|
1925
|
+
"regexp/prefer-named-capture-group": "error",
|
|
1926
|
+
"regexp/prefer-named-replacement": "error",
|
|
1927
|
+
"regexp/prefer-quantifier": "error",
|
|
1928
|
+
"regexp/prefer-regexp-exec": "error",
|
|
1929
|
+
"regexp/prefer-regexp-test": "error",
|
|
1930
|
+
"regexp/prefer-result-array-groups": "error",
|
|
1931
|
+
"regexp/require-unicode-sets-regexp": "error",
|
|
1932
|
+
"regexp/sort-alternatives": "error",
|
|
1933
|
+
"regexp/sort-character-class-elements": "error",
|
|
1934
|
+
"regexp/unicode-escape": "error",
|
|
1935
|
+
"regexp/unicode-property": ["error", {
|
|
1936
|
+
generalCategory: "never",
|
|
1937
|
+
key: "short",
|
|
1938
|
+
property: "long"
|
|
1939
|
+
}]
|
|
1940
|
+
}
|
|
1941
|
+
}];
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
//#endregion
|
|
1945
|
+
//#region src/js/eslint/configs/style.ts
|
|
1946
|
+
const style = async () => {
|
|
1947
|
+
const { requiredAll: [pluginStyle] } = await resolvePackages(MODULES.style);
|
|
1948
|
+
if (!pluginStyle) return [];
|
|
1949
|
+
const styleConfig = pluginStyle.configs.customize({
|
|
1950
|
+
jsx: true,
|
|
1951
|
+
semi: true,
|
|
1952
|
+
indent: INDENT,
|
|
1953
|
+
quotes: "single",
|
|
1954
|
+
quoteProps: "as-needed",
|
|
1955
|
+
arrowParens: true,
|
|
1956
|
+
blockSpacing: true,
|
|
1957
|
+
braceStyle: "1tbs",
|
|
1958
|
+
commaDangle: "always-multiline"
|
|
1959
|
+
});
|
|
1960
|
+
const indentRuleConfig = Array.isArray(styleConfig.rules?.["@stylistic/indent"]) && typeof styleConfig.rules["@stylistic/indent"][2] === "object" && styleConfig.rules["@stylistic/indent"][2] !== null ? styleConfig.rules["@stylistic/indent"][2] : void 0;
|
|
1961
|
+
return [{
|
|
1962
|
+
name: buildConfigName(MAIN_SCOPES.STYLE, SUB_SCOPES.SETUP),
|
|
1963
|
+
plugins: { style: pluginStyle }
|
|
1964
|
+
}, {
|
|
1965
|
+
name: buildConfigName(MAIN_SCOPES.STYLE, SUB_SCOPES.RULES),
|
|
1966
|
+
files: GLOB_SCRIPT_FILES,
|
|
1967
|
+
rules: {
|
|
1968
|
+
...renameRules(styleConfig.rules, { "@stylistic": "style" }),
|
|
1969
|
+
"style/array-bracket-newline": ["error", "consistent"],
|
|
1970
|
+
"style/array-element-newline": ["error", "consistent"],
|
|
1971
|
+
"style/function-call-argument-newline": ["error", "consistent"],
|
|
1972
|
+
"style/function-call-spacing": "error",
|
|
1973
|
+
"style/function-paren-newline": ["error", "multiline-arguments"],
|
|
1974
|
+
"style/generator-star-spacing": ["error", {
|
|
1975
|
+
before: false,
|
|
1976
|
+
after: true,
|
|
1977
|
+
method: "before",
|
|
1978
|
+
shorthand: "neither"
|
|
1979
|
+
}],
|
|
1980
|
+
"style/implicit-arrow-linebreak": "error",
|
|
1981
|
+
"style/indent": [
|
|
1982
|
+
"error",
|
|
1983
|
+
INDENT,
|
|
1984
|
+
{
|
|
1985
|
+
...indentRuleConfig,
|
|
1986
|
+
offsetTernaryExpressions: false
|
|
1987
|
+
}
|
|
1988
|
+
],
|
|
1989
|
+
"style/jsx-child-element-spacing": "error",
|
|
1990
|
+
"style/jsx-pascal-case": "error",
|
|
1991
|
+
"style/jsx-self-closing-comp": "error",
|
|
1992
|
+
"style/line-comment-position": "error",
|
|
1993
|
+
"style/linebreak-style": "error",
|
|
1994
|
+
"style/lines-around-comment": ["error", {
|
|
1995
|
+
beforeBlockComment: true,
|
|
1996
|
+
afterHashbangComment: true,
|
|
1997
|
+
allowBlockStart: true,
|
|
1998
|
+
allowObjectStart: true,
|
|
1999
|
+
allowArrayStart: true,
|
|
2000
|
+
allowClassStart: true,
|
|
2001
|
+
allowEnumStart: true,
|
|
2002
|
+
allowInterfaceStart: true,
|
|
2003
|
+
allowModuleStart: true,
|
|
2004
|
+
allowTypeStart: true
|
|
2005
|
+
}],
|
|
2006
|
+
"style/max-len": ["error", {
|
|
2007
|
+
code: MAX_LEN,
|
|
2008
|
+
tabWidth: INDENT,
|
|
2009
|
+
ignoreUrls: true,
|
|
2010
|
+
ignoreStrings: true,
|
|
2011
|
+
ignoreComments: true
|
|
2012
|
+
}],
|
|
2013
|
+
"style/newline-per-chained-call": "error",
|
|
2014
|
+
"style/no-confusing-arrow": "error",
|
|
2015
|
+
"style/no-extra-parens": [
|
|
2016
|
+
"error",
|
|
2017
|
+
"all",
|
|
2018
|
+
{
|
|
2019
|
+
ignoredNodes: [
|
|
2020
|
+
"ArrowFunctionExpression[body.type=ConditionalExpression]",
|
|
2021
|
+
"SpreadElement[argument.type=ConditionalExpression]",
|
|
2022
|
+
"SpreadElement[argument.type=LogicalExpression]",
|
|
2023
|
+
"SpreadElement[argument.type=AwaitExpression]"
|
|
2024
|
+
],
|
|
2025
|
+
nestedBinaryExpressions: false,
|
|
2026
|
+
nestedConditionalExpressions: false,
|
|
2027
|
+
ternaryOperandBinaryExpressions: false
|
|
2028
|
+
}
|
|
2029
|
+
],
|
|
2030
|
+
"style/no-extra-semi": "error",
|
|
2031
|
+
"style/no-mixed-operators": ["error", {
|
|
2032
|
+
allowSamePrecedence: false,
|
|
2033
|
+
groups: [
|
|
2034
|
+
[
|
|
2035
|
+
"+",
|
|
2036
|
+
"-",
|
|
2037
|
+
"*",
|
|
2038
|
+
"/",
|
|
2039
|
+
"%",
|
|
2040
|
+
"**",
|
|
2041
|
+
"??"
|
|
2042
|
+
],
|
|
2043
|
+
[
|
|
2044
|
+
"&",
|
|
2045
|
+
"|",
|
|
2046
|
+
"^",
|
|
2047
|
+
"~",
|
|
2048
|
+
"<<",
|
|
2049
|
+
">>",
|
|
2050
|
+
">>>",
|
|
2051
|
+
"??"
|
|
2052
|
+
],
|
|
2053
|
+
[
|
|
2054
|
+
"==",
|
|
2055
|
+
"!=",
|
|
2056
|
+
"===",
|
|
2057
|
+
"!==",
|
|
2058
|
+
">",
|
|
2059
|
+
">=",
|
|
2060
|
+
"<",
|
|
2061
|
+
"<=",
|
|
2062
|
+
"??"
|
|
2063
|
+
],
|
|
2064
|
+
[
|
|
2065
|
+
"&&",
|
|
2066
|
+
"||",
|
|
2067
|
+
"?:",
|
|
2068
|
+
"??"
|
|
2069
|
+
],
|
|
2070
|
+
[
|
|
2071
|
+
"in",
|
|
2072
|
+
"instanceof",
|
|
2073
|
+
"??"
|
|
2074
|
+
]
|
|
2075
|
+
]
|
|
2076
|
+
}],
|
|
2077
|
+
"style/nonblock-statement-body-position": ["error", "below"],
|
|
2078
|
+
"style/object-curly-newline": ["error", {
|
|
2079
|
+
ObjectExpression: {
|
|
2080
|
+
minProperties: 4,
|
|
2081
|
+
multiline: true,
|
|
2082
|
+
consistent: true
|
|
2083
|
+
},
|
|
2084
|
+
ObjectPattern: {
|
|
2085
|
+
minProperties: 4,
|
|
2086
|
+
multiline: true,
|
|
2087
|
+
consistent: true
|
|
2088
|
+
},
|
|
2089
|
+
ImportDeclaration: {
|
|
2090
|
+
minProperties: 4,
|
|
2091
|
+
multiline: true,
|
|
2092
|
+
consistent: true
|
|
2093
|
+
},
|
|
2094
|
+
ExportDeclaration: {
|
|
2095
|
+
minProperties: 4,
|
|
2096
|
+
multiline: true,
|
|
2097
|
+
consistent: true
|
|
2098
|
+
}
|
|
2099
|
+
}],
|
|
2100
|
+
"style/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
2101
|
+
"style/one-var-declaration-per-line": ["error", "always"],
|
|
2102
|
+
"style/operator-linebreak": [
|
|
2103
|
+
"error",
|
|
2104
|
+
"before",
|
|
2105
|
+
{ overrides: { "=": "none" } }
|
|
2106
|
+
],
|
|
2107
|
+
"style/padding-line-between-statements": [
|
|
2108
|
+
"error",
|
|
2109
|
+
{
|
|
2110
|
+
blankLine: "always",
|
|
2111
|
+
prev: "*",
|
|
2112
|
+
next: [
|
|
2113
|
+
"block-like",
|
|
2114
|
+
"block",
|
|
2115
|
+
"break",
|
|
2116
|
+
"class",
|
|
2117
|
+
"continue",
|
|
2118
|
+
"enum",
|
|
2119
|
+
"expression",
|
|
2120
|
+
"function-overload",
|
|
2121
|
+
"interface",
|
|
2122
|
+
"multiline-return",
|
|
2123
|
+
"multiline-const",
|
|
2124
|
+
"multiline-export",
|
|
2125
|
+
"multiline-expression",
|
|
2126
|
+
"multiline-let",
|
|
2127
|
+
"multiline-var",
|
|
2128
|
+
"return",
|
|
2129
|
+
"singleline-const",
|
|
2130
|
+
"singleline-export",
|
|
2131
|
+
"singleline-let",
|
|
2132
|
+
"singleline-var",
|
|
2133
|
+
"throw",
|
|
2134
|
+
"type"
|
|
2135
|
+
]
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
blankLine: "always",
|
|
2139
|
+
next: "*",
|
|
2140
|
+
prev: [
|
|
2141
|
+
"block-like",
|
|
2142
|
+
"block",
|
|
2143
|
+
"class",
|
|
2144
|
+
"directive",
|
|
2145
|
+
"enum",
|
|
2146
|
+
"expression",
|
|
2147
|
+
"interface",
|
|
2148
|
+
"multiline-const",
|
|
2149
|
+
"multiline-export",
|
|
2150
|
+
"multiline-expression",
|
|
2151
|
+
"multiline-let",
|
|
2152
|
+
"multiline-var",
|
|
2153
|
+
"singleline-const",
|
|
2154
|
+
"singleline-export",
|
|
2155
|
+
"singleline-let",
|
|
2156
|
+
"singleline-var"
|
|
2157
|
+
]
|
|
2158
|
+
},
|
|
2159
|
+
{
|
|
2160
|
+
blankLine: "never",
|
|
2161
|
+
prev: [
|
|
2162
|
+
"singleline-const",
|
|
2163
|
+
"singleline-let",
|
|
2164
|
+
"singleline-var"
|
|
2165
|
+
],
|
|
2166
|
+
next: [
|
|
2167
|
+
"singleline-const",
|
|
2168
|
+
"singleline-let",
|
|
2169
|
+
"singleline-var"
|
|
2170
|
+
]
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
blankLine: "never",
|
|
2174
|
+
prev: ["singleline-export"],
|
|
2175
|
+
next: ["singleline-export"]
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
blankLine: "never",
|
|
2179
|
+
prev: "function-overload",
|
|
2180
|
+
next: ["function", "function-overload"]
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
blankLine: "never",
|
|
2184
|
+
prev: "directive",
|
|
2185
|
+
next: "directive"
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
blankLine: "any",
|
|
2189
|
+
prev: "expression",
|
|
2190
|
+
next: "expression"
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
blankLine: "always",
|
|
2194
|
+
prev: "*",
|
|
2195
|
+
next: "multiline-expression"
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
blankLine: "always",
|
|
2199
|
+
prev: "multiline-expression",
|
|
2200
|
+
next: "*"
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
blankLine: "never",
|
|
2204
|
+
prev: "type",
|
|
2205
|
+
next: "type"
|
|
2206
|
+
},
|
|
2207
|
+
{
|
|
2208
|
+
blankLine: "always",
|
|
2209
|
+
prev: "multiline-type",
|
|
2210
|
+
next: "type"
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
blankLine: "always",
|
|
2214
|
+
prev: "type",
|
|
2215
|
+
next: "multiline-type"
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
blankLine: "always",
|
|
2219
|
+
prev: "multiline-type",
|
|
2220
|
+
next: "multiline-type"
|
|
2221
|
+
},
|
|
2222
|
+
{
|
|
2223
|
+
blankLine: "always",
|
|
2224
|
+
prev: "cjs-import",
|
|
2225
|
+
next: ["*"]
|
|
2226
|
+
},
|
|
2227
|
+
{
|
|
2228
|
+
blankLine: "any",
|
|
2229
|
+
prev: "cjs-import",
|
|
2230
|
+
next: "cjs-import"
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
blankLine: "always",
|
|
2234
|
+
next: "*",
|
|
2235
|
+
prev: "cjs-export"
|
|
2236
|
+
}
|
|
2237
|
+
],
|
|
2238
|
+
"style/semi-style": "error",
|
|
2239
|
+
"style/switch-colon-spacing": "error",
|
|
2240
|
+
"style/yield-star-spacing": ["error", {
|
|
2241
|
+
before: false,
|
|
2242
|
+
after: true
|
|
2243
|
+
}]
|
|
2244
|
+
}
|
|
2245
|
+
}];
|
|
2246
|
+
};
|
|
2247
|
+
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region src/js/eslint/configs/svelte.ts
|
|
2250
|
+
const extractRelevantConfig = (configs$1, key) => {
|
|
2251
|
+
for (const config of configs$1) if (config.name === `svelte:${key}` && config.rules) return config;
|
|
2252
|
+
throw new Error(`Expected key "${key}" to be contained in given config.`);
|
|
2253
|
+
};
|
|
2254
|
+
const svelte = async () => {
|
|
2255
|
+
const { requiredAll: [isSvelteInstalled, pluginSvelte] } = await resolvePackages(MODULES.svelte);
|
|
2256
|
+
if (!isSvelteInstalled || !pluginSvelte) return [];
|
|
2257
|
+
return [
|
|
2258
|
+
{
|
|
2259
|
+
name: buildConfigName(MAIN_SCOPES.SVELTE, SUB_SCOPES.SETUP),
|
|
2260
|
+
plugins: { svelte: pluginSvelte }
|
|
2261
|
+
},
|
|
2262
|
+
{
|
|
2263
|
+
name: buildConfigName(MAIN_SCOPES.SVELTE, SUB_SCOPES.PARSER),
|
|
2264
|
+
files: [GLOB_SVELTE, GLOB_SVELTE_SCRIPT],
|
|
2265
|
+
languageOptions: {
|
|
2266
|
+
parser: extractRelevantConfig(pluginSvelte.configs["flat/base"], "base:setup-for-svelte").languageOptions?.["parser"],
|
|
2267
|
+
parserOptions: {
|
|
2268
|
+
extraFileExtensions: [".svelte"],
|
|
2269
|
+
parser: await getTsEslintParserIfExists()
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
},
|
|
2273
|
+
{
|
|
2274
|
+
name: buildConfigName(MAIN_SCOPES.SVELTE, SUB_SCOPES.PROCESSOR),
|
|
2275
|
+
files: [GLOB_SVELTE],
|
|
2276
|
+
processor: pluginSvelte.processors.svelte
|
|
2277
|
+
},
|
|
2278
|
+
{
|
|
2279
|
+
name: buildConfigName(MAIN_SCOPES.SVELTE, SUB_SCOPES.RULES),
|
|
2280
|
+
files: [GLOB_SVELTE, GLOB_SVELTE_SCRIPT],
|
|
2281
|
+
rules: {
|
|
2282
|
+
...extractRelevantConfig(pluginSvelte.configs["flat/recommended"], "recommended:rules").rules,
|
|
2283
|
+
"svelte/block-lang": ["error", {
|
|
2284
|
+
enforceScriptPresent: false,
|
|
2285
|
+
enforceStylePresent: false,
|
|
2286
|
+
script: ["ts", null],
|
|
2287
|
+
style: ["scss", null]
|
|
2288
|
+
}],
|
|
2289
|
+
"svelte/button-has-type": "error",
|
|
2290
|
+
"svelte/consistent-selector-style": ["error", {
|
|
2291
|
+
checkGlobal: false,
|
|
2292
|
+
style: [
|
|
2293
|
+
"type",
|
|
2294
|
+
"class",
|
|
2295
|
+
"id"
|
|
2296
|
+
]
|
|
2297
|
+
}],
|
|
2298
|
+
"svelte/derived-has-same-inputs-outputs": "error",
|
|
2299
|
+
"svelte/experimental-require-strict-events": "error",
|
|
2300
|
+
"svelte/experimental-require-slot-types": "error",
|
|
2301
|
+
"svelte/first-attribute-linebreak": "error",
|
|
2302
|
+
"svelte/html-closing-bracket-new-line": "error",
|
|
2303
|
+
"svelte/html-closing-bracket-spacing": ["error", { selfClosingTag: "never" }],
|
|
2304
|
+
"svelte/html-quotes": "error",
|
|
2305
|
+
"svelte/html-self-closing": ["error", {
|
|
2306
|
+
normal: "ignore",
|
|
2307
|
+
void: "never"
|
|
2308
|
+
}],
|
|
2309
|
+
"style/indent": "off",
|
|
2310
|
+
"svelte/indent": ["error", { indent: INDENT }],
|
|
2311
|
+
"svelte/max-attributes-per-line": ["error", {
|
|
2312
|
+
multiline: 1,
|
|
2313
|
+
singleline: 3
|
|
2314
|
+
}],
|
|
2315
|
+
"svelte/mustache-spacing": "error",
|
|
2316
|
+
"svelte/no-add-event-listener": "error",
|
|
2317
|
+
"svelte/no-at-debug-tags": "error",
|
|
2318
|
+
"svelte/no-extra-reactive-curlies": "error",
|
|
2319
|
+
"svelte/no-ignored-unsubscribe": "error",
|
|
2320
|
+
"svelte/no-inline-styles": "error",
|
|
2321
|
+
"svelte/no-inspect": "error",
|
|
2322
|
+
"svelte/no-spaces-around-equal-signs-in-attribute": "error",
|
|
2323
|
+
"svelte/no-target-blank": "error",
|
|
2324
|
+
"svelte/no-top-level-browser-globals": "error",
|
|
2325
|
+
"style/no-trailing-spaces": "off",
|
|
2326
|
+
"svelte/no-trailing-spaces": "error",
|
|
2327
|
+
"svelte/prefer-class-directive": "error",
|
|
2328
|
+
"prefer-const": "off",
|
|
2329
|
+
"svelte/prefer-const": "error",
|
|
2330
|
+
"svelte/prefer-destructured-store-props": "error",
|
|
2331
|
+
"svelte/prefer-style-directive": "error",
|
|
2332
|
+
"svelte/require-event-prefix": "error",
|
|
2333
|
+
"svelte/require-optimized-style-attribute": "error",
|
|
2334
|
+
"svelte/require-store-callbacks-use-set-param": "error",
|
|
2335
|
+
"svelte/require-stores-init": "error",
|
|
2336
|
+
"svelte/shorthand-attribute": "error",
|
|
2337
|
+
"svelte/shorthand-directive": "error",
|
|
2338
|
+
"svelte/sort-attributes": "error",
|
|
2339
|
+
"svelte/spaced-html-comment": "error",
|
|
2340
|
+
"svelte/valid-compile": "error",
|
|
2341
|
+
"svelte/valid-style-parse": "error"
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
];
|
|
2345
|
+
};
|
|
2346
|
+
|
|
2347
|
+
//#endregion
|
|
2348
|
+
//#region src/js/eslint/configs/test.ts
|
|
2349
|
+
const test = async () => {
|
|
2350
|
+
const { requiredAll: [pluginVitest] } = await resolvePackages(MODULES.test);
|
|
2351
|
+
if (!pluginVitest) return [];
|
|
2352
|
+
return [{
|
|
2353
|
+
name: buildConfigName(MAIN_SCOPES.TEST, SUB_SCOPES.SETUP),
|
|
2354
|
+
plugins: { test: pluginVitest }
|
|
2355
|
+
}, {
|
|
2356
|
+
name: buildConfigName(MAIN_SCOPES.TEST, SUB_SCOPES.RULES),
|
|
2357
|
+
files: GLOB_TEST_FILES,
|
|
2358
|
+
rules: {
|
|
2359
|
+
...renameRules(pluginVitest.configs.recommended.rules, { vitest: "test" }),
|
|
2360
|
+
"test/consistent-each-for": ["error", {
|
|
2361
|
+
test: "each",
|
|
2362
|
+
it: "each",
|
|
2363
|
+
describe: "each",
|
|
2364
|
+
suite: "each"
|
|
2365
|
+
}],
|
|
2366
|
+
"test/consistent-test-filename": "error",
|
|
2367
|
+
"test/consistent-test-it": "error",
|
|
2368
|
+
"test/consistent-vitest-vi": "error",
|
|
2369
|
+
"test/hoisted-apis-on-top": "error",
|
|
2370
|
+
"test/no-alias-methods": "error",
|
|
2371
|
+
"test/no-conditional-in-test": "error",
|
|
2372
|
+
"test/no-conditional-tests": "error",
|
|
2373
|
+
"test/no-duplicate-hooks": "error",
|
|
2374
|
+
"test/no-test-prefixes": "error",
|
|
2375
|
+
"test/no-test-return-statement": "error",
|
|
2376
|
+
"test/padding-around-all": "error",
|
|
2377
|
+
"test/prefer-called-once": "error",
|
|
2378
|
+
"test/prefer-called-with": "error",
|
|
2379
|
+
"test/prefer-comparison-matcher": "error",
|
|
2380
|
+
"test/prefer-each": "error",
|
|
2381
|
+
"test/prefer-equality-matcher": "error",
|
|
2382
|
+
"test/prefer-expect-resolves": "error",
|
|
2383
|
+
"test/prefer-expect-type-of": "error",
|
|
2384
|
+
"test/prefer-hooks-in-order": "error",
|
|
2385
|
+
"test/prefer-hooks-on-top": "error",
|
|
2386
|
+
"test/prefer-import-in-mock": "error",
|
|
2387
|
+
"test/prefer-importing-vitest-globals": "error",
|
|
2388
|
+
"test/prefer-lowercase-title": "error",
|
|
2389
|
+
"test/prefer-mock-promise-shorthand": "error",
|
|
2390
|
+
"test/prefer-snapshot-hint": "error",
|
|
2391
|
+
"test/prefer-spy-on": "error",
|
|
2392
|
+
"test/prefer-strict-boolean-matchers": "error",
|
|
2393
|
+
"test/prefer-strict-equal": "error",
|
|
2394
|
+
"test/prefer-to-be-object": "error",
|
|
2395
|
+
"test/prefer-to-be": "error",
|
|
2396
|
+
"test/prefer-to-contain": "error",
|
|
2397
|
+
"test/prefer-to-have-length": "error",
|
|
2398
|
+
"test/prefer-todo": "error",
|
|
2399
|
+
"test/prefer-vi-mocked": "error",
|
|
2400
|
+
"test/require-awaited-expect-poll": "error",
|
|
2401
|
+
"test/require-hook": "error",
|
|
2402
|
+
"test/require-mock-type-parameters": "error",
|
|
2403
|
+
"test/warn-todo": "error"
|
|
2404
|
+
}
|
|
2405
|
+
}];
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
//#endregion
|
|
2409
|
+
//#region src/js/eslint/configs/toml.ts
|
|
2410
|
+
const toml = async () => {
|
|
2411
|
+
const { requiredAll: [pluginToml, parserToml] } = await resolvePackages(MODULES.toml);
|
|
2412
|
+
if (!pluginToml || !parserToml) return [];
|
|
2413
|
+
return [
|
|
2414
|
+
{
|
|
2415
|
+
name: buildConfigName(MAIN_SCOPES.TOML, SUB_SCOPES.SETUP),
|
|
2416
|
+
plugins: { toml: pluginToml }
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
name: buildConfigName(MAIN_SCOPES.TOML, SUB_SCOPES.PARSER),
|
|
2420
|
+
files: [GLOB_TOML],
|
|
2421
|
+
languageOptions: { parser: parserToml }
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
name: buildConfigName(MAIN_SCOPES.TOML, SUB_SCOPES.RULES),
|
|
2425
|
+
files: [GLOB_TOML],
|
|
2426
|
+
language: "toml/toml",
|
|
2427
|
+
rules: {
|
|
2428
|
+
...pluginToml.configs.standard[2]?.rules,
|
|
2429
|
+
"toml/array-bracket-spacing": ["error", "never"],
|
|
2430
|
+
"toml/indent": ["error", INDENT],
|
|
2431
|
+
"toml/no-mixed-type-in-array": "error"
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
];
|
|
2435
|
+
};
|
|
2436
|
+
|
|
2437
|
+
//#endregion
|
|
2438
|
+
//#region src/js/eslint/configs/yaml.ts
|
|
2439
|
+
const yaml = async () => {
|
|
2440
|
+
const { requiredAll: [pluginYaml, parserYaml] } = await resolvePackages(MODULES.yaml);
|
|
2441
|
+
if (!pluginYaml || !parserYaml) return [];
|
|
2442
|
+
return [
|
|
2443
|
+
{
|
|
2444
|
+
name: buildConfigName(MAIN_SCOPES.YAML, SUB_SCOPES.SETUP),
|
|
2445
|
+
plugins: { yaml: pluginYaml }
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
name: buildConfigName(MAIN_SCOPES.YAML, SUB_SCOPES.PARSER),
|
|
2449
|
+
files: [GLOB_YAML],
|
|
2450
|
+
languageOptions: { parser: parserYaml }
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
name: buildConfigName(MAIN_SCOPES.YAML, SUB_SCOPES.RULES),
|
|
2454
|
+
files: [GLOB_YAML],
|
|
2455
|
+
language: "yaml/yaml",
|
|
2456
|
+
rules: {
|
|
2457
|
+
...renameRules(pluginYaml.configs.standard[2]?.rules, { yml: "yaml" }),
|
|
2458
|
+
"yaml/block-mapping-colon-indicator-newline": ["error", "never"],
|
|
2459
|
+
"yaml/file-extension": "error",
|
|
2460
|
+
"yaml/flow-mapping-curly-spacing": ["error", "always"],
|
|
2461
|
+
"yaml/indent": ["error", INDENT],
|
|
2462
|
+
"yaml/no-multiple-empty-lines": "error",
|
|
2463
|
+
"yaml/no-trailing-zeros": "error",
|
|
2464
|
+
"yaml/quotes": ["error", {
|
|
2465
|
+
avoidEscape: true,
|
|
2466
|
+
prefer: "single"
|
|
2467
|
+
}],
|
|
2468
|
+
"yaml/require-string-key": "error"
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
];
|
|
2472
|
+
};
|
|
2473
|
+
|
|
2474
|
+
//#endregion
|
|
2475
|
+
//#region src/js/eslint/configs/index.ts
|
|
2476
|
+
const configs = {
|
|
2477
|
+
[packageOrganization]: builtinConfig[packageOrganization],
|
|
2478
|
+
comments,
|
|
2479
|
+
css,
|
|
2480
|
+
gitignore,
|
|
2481
|
+
ignores,
|
|
2482
|
+
import: imports,
|
|
2483
|
+
javascript,
|
|
2484
|
+
jsdoc,
|
|
2485
|
+
json,
|
|
2486
|
+
markdown,
|
|
2487
|
+
node,
|
|
2488
|
+
overrides,
|
|
2489
|
+
perfectionist,
|
|
2490
|
+
regexp,
|
|
2491
|
+
style,
|
|
2492
|
+
svelte,
|
|
2493
|
+
test,
|
|
2494
|
+
toml,
|
|
2495
|
+
typescript,
|
|
2496
|
+
unicorn,
|
|
2497
|
+
yaml
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
//#endregion
|
|
2501
|
+
//#region src/js/eslint/index.ts
|
|
2502
|
+
const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
2503
|
+
const resolvedOptions = {
|
|
2504
|
+
[packageOrganization]: isModuleEnabledByDefault(MODULES[packageOrganization]),
|
|
2505
|
+
comments: isModuleEnabledByDefault(MODULES.comments),
|
|
2506
|
+
css: isModuleEnabledByDefault(MODULES.css),
|
|
2507
|
+
gitignore: isModuleEnabledByDefault(MODULES.gitignore),
|
|
2508
|
+
import: isModuleEnabledByDefault(MODULES.import),
|
|
2509
|
+
jsdoc: isModuleEnabledByDefault(MODULES.jsdoc),
|
|
2510
|
+
json: isModuleEnabledByDefault(MODULES.json),
|
|
2511
|
+
markdown: isModuleEnabledByDefault(MODULES.markdown),
|
|
2512
|
+
node: isModuleEnabledByDefault(MODULES.node),
|
|
2513
|
+
perfectionist: isModuleEnabledByDefault(MODULES.perfectionist),
|
|
2514
|
+
regexp: isModuleEnabledByDefault(MODULES.regexp),
|
|
2515
|
+
style: isModuleEnabledByDefault(MODULES.style),
|
|
2516
|
+
svelte: isModuleEnabledByDefault(MODULES.svelte),
|
|
2517
|
+
test: isModuleEnabledByDefault(MODULES.test),
|
|
2518
|
+
toml: isModuleEnabledByDefault(MODULES.toml),
|
|
2519
|
+
typescript: isModuleEnabledByDefault(MODULES.typescript),
|
|
2520
|
+
unicorn: isModuleEnabledByDefault(MODULES.unicorn),
|
|
2521
|
+
yaml: isModuleEnabledByDefault(MODULES.yaml),
|
|
2522
|
+
...optionsAndGlobalConfig
|
|
2523
|
+
};
|
|
2524
|
+
setModuleEnabled(MODULES[packageOrganization], resolvedOptions[packageOrganization]);
|
|
2525
|
+
setModuleEnabled(MODULES.comments, resolvedOptions.comments);
|
|
2526
|
+
setModuleEnabled(MODULES.css, resolvedOptions.css);
|
|
2527
|
+
setModuleEnabled(MODULES.gitignore, resolvedOptions.gitignore !== false);
|
|
2528
|
+
setModuleEnabled(MODULES.import, resolvedOptions.import);
|
|
2529
|
+
setModuleEnabled(MODULES.jsdoc, resolvedOptions.jsdoc);
|
|
2530
|
+
setModuleEnabled(MODULES.json, resolvedOptions.json);
|
|
2531
|
+
setModuleEnabled(MODULES.markdown, resolvedOptions.markdown !== false);
|
|
2532
|
+
setModuleEnabled(MODULES.node, resolvedOptions.node !== false);
|
|
2533
|
+
setModuleEnabled(MODULES.perfectionist, resolvedOptions.perfectionist);
|
|
2534
|
+
setModuleEnabled(MODULES.regexp, resolvedOptions.regexp);
|
|
2535
|
+
setModuleEnabled(MODULES.style, resolvedOptions.style);
|
|
2536
|
+
setModuleEnabled(MODULES.svelte, resolvedOptions.svelte);
|
|
2537
|
+
setModuleEnabled(MODULES.test, resolvedOptions.test);
|
|
2538
|
+
setModuleEnabled(MODULES.toml, resolvedOptions.toml);
|
|
2539
|
+
setModuleEnabled(MODULES.typescript, resolvedOptions.typescript !== false);
|
|
2540
|
+
setModuleEnabled(MODULES.unicorn, resolvedOptions.unicorn);
|
|
2541
|
+
setModuleEnabled(MODULES.yaml, resolvedOptions.yaml);
|
|
2542
|
+
const composer = new FlatConfigComposer();
|
|
2543
|
+
const appendToComposer = (...configsToAppend) => {
|
|
2544
|
+
composer.append(...configsToAppend);
|
|
2545
|
+
};
|
|
2546
|
+
appendToComposer(configs.ignores(resolvedOptions.ignores));
|
|
2547
|
+
if (isModuleEnabled(MODULES.gitignore)) appendToComposer(configs.gitignore(typeof resolvedOptions.gitignore === "object" ? resolvedOptions.gitignore : { strict: false }));
|
|
2548
|
+
appendToComposer(configs.javascript());
|
|
2549
|
+
if (isModuleEnabled(MODULES.typescript)) appendToComposer(configs.typescript(typeof resolvedOptions.typescript === "object" ? resolvedOptions.typescript : void 0));
|
|
2550
|
+
if (isModuleEnabled(MODULES.test)) appendToComposer(configs.test());
|
|
2551
|
+
if (isModuleEnabled(MODULES.jsdoc)) appendToComposer(configs.jsdoc());
|
|
2552
|
+
if (isModuleEnabled(MODULES.node)) appendToComposer(configs.node(typeof resolvedOptions.node === "object" ? resolvedOptions.node : void 0));
|
|
2553
|
+
if (isModuleEnabled(MODULES[packageOrganization])) appendToComposer(configs[packageOrganization]());
|
|
2554
|
+
if (isModuleEnabled(MODULES.comments)) appendToComposer(configs.comments());
|
|
2555
|
+
if (isModuleEnabled(MODULES.regexp)) appendToComposer(configs.regexp());
|
|
2556
|
+
if (isModuleEnabled(MODULES.unicorn)) appendToComposer(configs.unicorn());
|
|
2557
|
+
if (isModuleEnabled(MODULES.import)) appendToComposer(configs.import());
|
|
2558
|
+
if (isModuleEnabled(MODULES.style)) appendToComposer(configs.style());
|
|
2559
|
+
if (isModuleEnabled(MODULES.perfectionist)) appendToComposer(configs.perfectionist());
|
|
2560
|
+
if (isModuleEnabled(MODULES.svelte)) appendToComposer(configs.svelte());
|
|
2561
|
+
if (isModuleEnabled(MODULES.json)) appendToComposer(configs.json());
|
|
2562
|
+
if (isModuleEnabled(MODULES.toml)) appendToComposer(configs.toml());
|
|
2563
|
+
if (isModuleEnabled(MODULES.yaml)) appendToComposer(configs.yaml());
|
|
2564
|
+
if (isModuleEnabled(MODULES.css)) appendToComposer(configs.css());
|
|
2565
|
+
if (isModuleEnabled(MODULES.markdown)) appendToComposer(configs.markdown(typeof resolvedOptions.markdown === "object" ? resolvedOptions.markdown : void 0));
|
|
2566
|
+
appendToComposer(configs.overrides());
|
|
2567
|
+
appendToComposer(...getUserConfigs(resolvedOptions, additionalConfigs));
|
|
2568
|
+
return composer;
|
|
2569
|
+
};
|
|
2570
|
+
const getDefaultConfig = async () => getConfig();
|
|
2571
|
+
var eslint_default = getDefaultConfig;
|
|
2572
|
+
|
|
2573
|
+
//#endregion
|
|
2574
|
+
export { eslint_default as default, getConfig };
|