@brnshkr/config 0.0.1-alpha.8 → 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -32
- package/conf/tsconfig.json +3 -7
- package/dist/eslint/index.d.mts +1351 -1643
- package/dist/eslint/index.mjs +247 -176
- package/dist/scripts/eslint.mjs +2 -4
- package/dist/scripts/stylelint.mjs +2 -4
- package/dist/shared.mjs +79 -240
- package/dist/stylelint/index.d.mts +3 -3
- package/dist/stylelint/index.mjs +98 -66
- package/package.json +93 -109
package/dist/eslint/index.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as objectAssign, d as objectFromEntries, f as objectKeys, h as version, i as resolvePackagesSharedAsynchronously, l as objectEntries, m as packageOrganizationUpper, n as GLOB_IGNORES, o as ESLINT_PACKAGES, p as packageOrganization, r as isModuleEnabledByDefault, t as QUOTES, u as objectFreeze } from "../shared.mjs";
|
|
2
2
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
3
|
import jsEslint from "@eslint/js";
|
|
4
4
|
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
5
5
|
import globals from "globals";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
|
|
9
|
-
//#region src/js/eslint/types/scopes.ts
|
|
8
|
+
//#region ../src/js/eslint/types/scopes.ts
|
|
10
9
|
const MAIN_SCOPES = {
|
|
11
10
|
[packageOrganizationUpper]: "builtin",
|
|
12
11
|
COMMENTS: "comments",
|
|
@@ -42,9 +41,8 @@ const SUB_SCOPES = {
|
|
|
42
41
|
SETUP: "setup",
|
|
43
42
|
UNNAMED: "unnamed"
|
|
44
43
|
};
|
|
45
|
-
|
|
46
44
|
//#endregion
|
|
47
|
-
//#region src/js/eslint/utils/config.ts
|
|
45
|
+
//#region ../src/js/eslint/utils/config.ts
|
|
48
46
|
const buildConfigName = (mainScope, subScope) => [
|
|
49
47
|
packageOrganization,
|
|
50
48
|
mainScope,
|
|
@@ -85,9 +83,8 @@ const ensureNamesForSyncAdditionalConfigs = (additionalConfigs) => {
|
|
|
85
83
|
return validConfigs;
|
|
86
84
|
};
|
|
87
85
|
const getUserConfigs = (resolvedOptions, additionalConfigs) => [getGlobalAdditionalConfig(resolvedOptions), ...ensureNamesForSyncAdditionalConfigs(additionalConfigs)];
|
|
88
|
-
|
|
89
86
|
//#endregion
|
|
90
|
-
//#region src/js/eslint/utils/globs.ts
|
|
87
|
+
//#region ../src/js/eslint/utils/globs.ts
|
|
91
88
|
const GLOB_CJS = "**/*.cjs";
|
|
92
89
|
const GLOB_TS = "**/*.?(c|m)ts?(x)";
|
|
93
90
|
const GLOB_DTS = "**/*.d.?(c|m)ts";
|
|
@@ -120,9 +117,8 @@ const GLOB_TEST_FILES = [
|
|
|
120
117
|
"**/*.bench.?(c|m)[jt]s",
|
|
121
118
|
"**/*.benchmark.?(c|m)[jt]s"
|
|
122
119
|
];
|
|
123
|
-
|
|
124
120
|
//#endregion
|
|
125
|
-
//#region src/js/eslint/configs/builtin.ts
|
|
121
|
+
//#region ../src/js/eslint/configs/builtin.ts
|
|
126
122
|
const FILE_TYPE_MAP = {
|
|
127
123
|
".json": "json",
|
|
128
124
|
".css": "css",
|
|
@@ -137,7 +133,7 @@ const FILE_TYPE_MAP = {
|
|
|
137
133
|
const MESSAGE_ID_MISSING_WITH_KEYWORD = "missingWithKeyword";
|
|
138
134
|
const MESSAGE_ID_MISSING_TYPE_PROPERTY = "missingTypeProperty";
|
|
139
135
|
const MESSAGE_ID_WRONG_TYPE_VALUE = "wrongTypeValue";
|
|
140
|
-
const
|
|
136
|
+
const RULE_DEFINITIONS = { "require-import-attributes": {
|
|
141
137
|
meta: {
|
|
142
138
|
type: "problem",
|
|
143
139
|
docs: { description: "Require non-JavaScript imports (e.g. .json and .css) to include import attributes." },
|
|
@@ -147,17 +143,17 @@ const requireImportAttributesRule = {
|
|
|
147
143
|
[MESSAGE_ID_WRONG_TYPE_VALUE]: "Import attribute 'type' for '{{ file }}' must be '{{ expectedValue }}'."
|
|
148
144
|
}
|
|
149
145
|
},
|
|
150
|
-
create: (context) => ({ ImportDeclaration: (node
|
|
151
|
-
const sourceValue = node
|
|
146
|
+
create: (context) => ({ ImportDeclaration: (node) => {
|
|
147
|
+
const sourceValue = node.source.value;
|
|
152
148
|
const extensionIndex = sourceValue.lastIndexOf(".");
|
|
153
149
|
if (extensionIndex === -1) return;
|
|
154
150
|
const extension = sourceValue.slice(extensionIndex).toLowerCase();
|
|
155
151
|
const expectedValue = FILE_TYPE_MAP[extension];
|
|
156
152
|
if (expectedValue === void 0) return;
|
|
157
|
-
const { attributes } = node
|
|
153
|
+
const { attributes } = node;
|
|
158
154
|
if (attributes.length === 0) {
|
|
159
155
|
context.report({
|
|
160
|
-
node
|
|
156
|
+
node,
|
|
161
157
|
messageId: MESSAGE_ID_MISSING_WITH_KEYWORD,
|
|
162
158
|
data: {
|
|
163
159
|
extension,
|
|
@@ -169,13 +165,13 @@ const requireImportAttributesRule = {
|
|
|
169
165
|
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
166
|
if (!typeProperty) {
|
|
171
167
|
context.report({
|
|
172
|
-
node
|
|
168
|
+
node,
|
|
173
169
|
messageId: MESSAGE_ID_MISSING_TYPE_PROPERTY
|
|
174
170
|
});
|
|
175
171
|
return;
|
|
176
172
|
}
|
|
177
173
|
if (typeProperty.value.value !== expectedValue) context.report({
|
|
178
|
-
node
|
|
174
|
+
node,
|
|
179
175
|
messageId: MESSAGE_ID_WRONG_TYPE_VALUE,
|
|
180
176
|
data: {
|
|
181
177
|
expectedValue,
|
|
@@ -183,8 +179,7 @@ const requireImportAttributesRule = {
|
|
|
183
179
|
}
|
|
184
180
|
});
|
|
185
181
|
} })
|
|
186
|
-
};
|
|
187
|
-
const RULE_DEFINITIONS = { "require-import-attributes": requireImportAttributesRule };
|
|
182
|
+
} };
|
|
188
183
|
const RULES = objectFreeze(objectFromEntries(objectKeys(RULE_DEFINITIONS).map((ruleName) => [`${packageOrganization}/${ruleName}`, "error"])));
|
|
189
184
|
const builtin = () => [{
|
|
190
185
|
name: buildConfigName(MAIN_SCOPES[packageOrganizationUpper], SUB_SCOPES.SETUP),
|
|
@@ -201,9 +196,100 @@ const builtin = () => [{
|
|
|
201
196
|
rules: RULES
|
|
202
197
|
}];
|
|
203
198
|
const builtinConfig = { [packageOrganization]: builtin };
|
|
204
|
-
|
|
205
199
|
//#endregion
|
|
206
|
-
//#region src/js/eslint/
|
|
200
|
+
//#region ../src/js/eslint/utils/module.ts
|
|
201
|
+
const MODULES = {
|
|
202
|
+
[packageOrganization]: { name: packageOrganization },
|
|
203
|
+
comments: {
|
|
204
|
+
name: "comments",
|
|
205
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_ESLINT_COMMENTS] }
|
|
206
|
+
},
|
|
207
|
+
css: {
|
|
208
|
+
name: "css",
|
|
209
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_CSS] }
|
|
210
|
+
},
|
|
211
|
+
gitignore: {
|
|
212
|
+
name: "gitignore",
|
|
213
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_FLAT_CONFIG_GITIGNORE] }
|
|
214
|
+
},
|
|
215
|
+
import: {
|
|
216
|
+
name: "import",
|
|
217
|
+
packages: {
|
|
218
|
+
requiredAny: [ESLINT_PACKAGES.ESLINT_PLUGIN_IMPORT_X, ESLINT_PACKAGES.ESLINT_PLUGIN_ANTFU],
|
|
219
|
+
optional: [ESLINT_PACKAGES.ESLINT_IMPORT_RESOVLER_TYPESCRIPT]
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
javascript: {
|
|
223
|
+
name: "javascript",
|
|
224
|
+
packages: { optional: [ESLINT_PACKAGES.ESLINT_PLUGIN_ANTFU, ESLINT_PACKAGES.ESLINT_PLUGIN_UNUSED_IMPORTS] }
|
|
225
|
+
},
|
|
226
|
+
jsdoc: {
|
|
227
|
+
name: "jsdoc",
|
|
228
|
+
packages: {
|
|
229
|
+
requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_JSDOC],
|
|
230
|
+
optional: [ESLINT_PACKAGES.ESLINT_PLUGIN_JSDOC_PROCESSOR]
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
json: {
|
|
234
|
+
name: "json",
|
|
235
|
+
packages: {
|
|
236
|
+
requiredAll: [ESLINT_PACKAGES.ESLINT_JSON],
|
|
237
|
+
optional: [ESLINT_PACKAGES.ESLINT_PLUGIN_JSONC]
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
markdown: {
|
|
241
|
+
name: "markdown",
|
|
242
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_MARKDOWN, ESLINT_PACKAGES.ESLINT_MERGE_PROCESSORS] }
|
|
243
|
+
},
|
|
244
|
+
node: {
|
|
245
|
+
name: "node",
|
|
246
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_N] }
|
|
247
|
+
},
|
|
248
|
+
perfectionist: {
|
|
249
|
+
name: "perfectionist",
|
|
250
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_PERFECTIONIST] }
|
|
251
|
+
},
|
|
252
|
+
regexp: {
|
|
253
|
+
name: "regexp",
|
|
254
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_REGEXP] }
|
|
255
|
+
},
|
|
256
|
+
style: {
|
|
257
|
+
name: "style",
|
|
258
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_STYLISTIC] }
|
|
259
|
+
},
|
|
260
|
+
svelte: {
|
|
261
|
+
name: "svelte",
|
|
262
|
+
packages: { requiredAll: [ESLINT_PACKAGES.SVELTE, ESLINT_PACKAGES.ESLINT_PLUGIN_SVELTE] }
|
|
263
|
+
},
|
|
264
|
+
test: {
|
|
265
|
+
name: "test",
|
|
266
|
+
packages: { requiredAll: [ESLINT_PACKAGES.VITEST_ESLINT_PLUGIN] }
|
|
267
|
+
},
|
|
268
|
+
toml: {
|
|
269
|
+
name: "toml",
|
|
270
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_TOML] }
|
|
271
|
+
},
|
|
272
|
+
typescript: {
|
|
273
|
+
name: "typescript",
|
|
274
|
+
packages: { requiredAll: [ESLINT_PACKAGES.TYPESCRIPT, ESLINT_PACKAGES.TYPESCRIPT_ESLINT] }
|
|
275
|
+
},
|
|
276
|
+
unicorn: {
|
|
277
|
+
name: "unicorn",
|
|
278
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_UNICORN] }
|
|
279
|
+
},
|
|
280
|
+
yaml: {
|
|
281
|
+
name: "yaml",
|
|
282
|
+
packages: { requiredAll: [ESLINT_PACKAGES.ESLINT_PLUGIN_YML] }
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const resolvePackages = async (moduleInfo, type) => resolvePackagesSharedAsynchronously(moduleInfo, type);
|
|
286
|
+
const enabledStates = {};
|
|
287
|
+
const isModuleEnabled = (moduleInfo) => enabledStates[moduleInfo.name] ?? isModuleEnabledByDefault(moduleInfo);
|
|
288
|
+
const setModuleEnabled = (moduleInfo, state) => {
|
|
289
|
+
enabledStates[moduleInfo.name] = state;
|
|
290
|
+
};
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region ../src/js/eslint/configs/comments.ts
|
|
207
293
|
const comments = async () => {
|
|
208
294
|
const { requiredAll: [pluginComments] } = await resolvePackages(MODULES.comments);
|
|
209
295
|
if (!pluginComments) return [];
|
|
@@ -217,14 +303,12 @@ const comments = async () => {
|
|
|
217
303
|
files: GLOB_SCRIPT_FILES,
|
|
218
304
|
rules: {
|
|
219
305
|
...renameRules(recommendedRules, { "@eslint-community/eslint-comments": "comments" }),
|
|
220
|
-
"comments/no-unused-disable": "error",
|
|
221
306
|
"comments/require-description": "error"
|
|
222
307
|
}
|
|
223
308
|
}];
|
|
224
309
|
};
|
|
225
|
-
|
|
226
310
|
//#endregion
|
|
227
|
-
//#region src/js/eslint/configs/css.ts
|
|
311
|
+
//#region ../src/js/eslint/configs/css.ts
|
|
228
312
|
const css = async () => {
|
|
229
313
|
const { requiredAll: [pluginCss] } = await resolvePackages(MODULES.css);
|
|
230
314
|
if (!pluginCss) return [];
|
|
@@ -243,9 +327,8 @@ const css = async () => {
|
|
|
243
327
|
}
|
|
244
328
|
}];
|
|
245
329
|
};
|
|
246
|
-
|
|
247
330
|
//#endregion
|
|
248
|
-
//#region src/js/eslint/configs/gitignore.ts
|
|
331
|
+
//#region ../src/js/eslint/configs/gitignore.ts
|
|
249
332
|
const gitignore = async (options) => {
|
|
250
333
|
const { requiredAll: [pluginGitignore] } = await resolvePackages(MODULES.gitignore);
|
|
251
334
|
if (!pluginGitignore) return [];
|
|
@@ -254,16 +337,14 @@ const gitignore = async (options) => {
|
|
|
254
337
|
...options
|
|
255
338
|
})];
|
|
256
339
|
};
|
|
257
|
-
|
|
258
340
|
//#endregion
|
|
259
|
-
//#region src/js/eslint/configs/ignores.ts
|
|
341
|
+
//#region ../src/js/eslint/configs/ignores.ts
|
|
260
342
|
const ignores = (customIgnores = []) => [{
|
|
261
343
|
name: buildConfigName(MAIN_SCOPES.IGNORES, SUB_SCOPES.BASE),
|
|
262
344
|
ignores: [...GLOB_IGNORES, ...customIgnores]
|
|
263
345
|
}];
|
|
264
|
-
|
|
265
346
|
//#endregion
|
|
266
|
-
//#region src/js/eslint/configs/import.ts
|
|
347
|
+
//#region ../src/js/eslint/configs/import.ts
|
|
267
348
|
const imports = async () => {
|
|
268
349
|
const { requiredAny: [pluginImport, pluginAntfu], optional: [importResovlerTypescript] } = await resolvePackages(MODULES.import);
|
|
269
350
|
const plugins = {};
|
|
@@ -372,9 +453,8 @@ const imports = async () => {
|
|
|
372
453
|
}
|
|
373
454
|
}];
|
|
374
455
|
};
|
|
375
|
-
|
|
376
456
|
//#endregion
|
|
377
|
-
//#region src/js/eslint/configs/javascript.ts
|
|
457
|
+
//#region ../src/js/eslint/configs/javascript.ts
|
|
378
458
|
const javascript = async () => {
|
|
379
459
|
const { optional: [pluginAntfu, pluginUnusedImports] } = await resolvePackages(MODULES.javascript);
|
|
380
460
|
const plugins = {};
|
|
@@ -387,7 +467,7 @@ const javascript = async () => {
|
|
|
387
467
|
if (pluginUnusedImports) {
|
|
388
468
|
plugins["unused"] = pluginUnusedImports;
|
|
389
469
|
pluginRules["unused/no-unused-imports"] = "error";
|
|
390
|
-
pluginRules["unused/no-unused-vars"] =
|
|
470
|
+
pluginRules["unused/no-unused-vars"] = "error";
|
|
391
471
|
}
|
|
392
472
|
return [{
|
|
393
473
|
name: buildConfigName(MAIN_SCOPES.JAVASCRIPT, SUB_SCOPES.SETUP),
|
|
@@ -565,14 +645,12 @@ const javascript = async () => {
|
|
|
565
645
|
"no-shadow": "error",
|
|
566
646
|
"no-template-curly-in-string": "error",
|
|
567
647
|
"no-throw-literal": "error",
|
|
568
|
-
"no-unassigned-vars": "error",
|
|
569
648
|
"no-underscore-dangle": "error",
|
|
570
649
|
"no-unmodified-loop-condition": "error",
|
|
571
650
|
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
572
651
|
"no-unreachable-loop": "error",
|
|
573
652
|
"no-unused-expressions": "error",
|
|
574
653
|
"no-use-before-define": "error",
|
|
575
|
-
"no-useless-assignment": "error",
|
|
576
654
|
"no-useless-call": "error",
|
|
577
655
|
"no-useless-computed-key": "error",
|
|
578
656
|
"no-useless-concat": "error",
|
|
@@ -604,7 +682,6 @@ const javascript = async () => {
|
|
|
604
682
|
"prefer-rest-params": "error",
|
|
605
683
|
"prefer-spread": "error",
|
|
606
684
|
"prefer-template": "error",
|
|
607
|
-
"preserve-caught-error": "error",
|
|
608
685
|
radix: "error",
|
|
609
686
|
"require-atomic-updates": "error",
|
|
610
687
|
"require-await": "error",
|
|
@@ -619,9 +696,8 @@ const javascript = async () => {
|
|
|
619
696
|
}
|
|
620
697
|
}];
|
|
621
698
|
};
|
|
622
|
-
|
|
623
699
|
//#endregion
|
|
624
|
-
//#region src/js/eslint/configs/typescript.ts
|
|
700
|
+
//#region ../src/js/eslint/configs/typescript.ts
|
|
625
701
|
const DEFAULT_TYPE_AWARE_IGNORES = [`${GLOB_MD}/**`];
|
|
626
702
|
const getTsEslintParserIfExists = async () => {
|
|
627
703
|
const isTypescriptModuleEnabled = isModuleEnabled(MODULES.typescript);
|
|
@@ -632,17 +708,17 @@ const getTsEslintParserIfExists = async () => {
|
|
|
632
708
|
}
|
|
633
709
|
return parser;
|
|
634
710
|
};
|
|
635
|
-
const resolveTypeAwareOptions = (resolvedOptions, files, ignores
|
|
711
|
+
const resolveTypeAwareOptions = (resolvedOptions, files, ignores) => {
|
|
636
712
|
const typeAwareOptions = typeof resolvedOptions.typeAware === "object" ? resolvedOptions.typeAware : {
|
|
637
713
|
ignores: DEFAULT_TYPE_AWARE_IGNORES,
|
|
638
714
|
tsconfig: typeof resolvedOptions.typeAware === "string" ? resolvedOptions.typeAware : void 0
|
|
639
715
|
};
|
|
640
716
|
typeAwareOptions.files = [...new Set([...typeAwareOptions.files ?? [], ...files])];
|
|
641
|
-
typeAwareOptions.ignores = [...new Set([...typeAwareOptions.ignores ?? [], ...ignores
|
|
717
|
+
typeAwareOptions.ignores = [...new Set([...typeAwareOptions.ignores ?? [], ...ignores])];
|
|
642
718
|
return typeAwareOptions;
|
|
643
719
|
};
|
|
644
|
-
const extractRelevantRules = (configs
|
|
645
|
-
for (const config of configs
|
|
720
|
+
const extractRelevantRules = (configs, key) => {
|
|
721
|
+
for (const config of configs) if (config.name === `typescript-eslint/${key}` && config.rules) return renameRules(config.rules, { "@typescript-eslint": "ts" });
|
|
646
722
|
throw new Error(`Expected key "${key}" to be contained in given config.`);
|
|
647
723
|
};
|
|
648
724
|
const getNamingConvention = (isTypeAware) => {
|
|
@@ -716,6 +792,7 @@ const getNamingConvention = (isTypeAware) => {
|
|
|
716
792
|
types: ["boolean"],
|
|
717
793
|
format: ["StrictPascalCase"],
|
|
718
794
|
prefix: [
|
|
795
|
+
"as",
|
|
719
796
|
"is",
|
|
720
797
|
"does",
|
|
721
798
|
"do",
|
|
@@ -730,6 +807,7 @@ const getNamingConvention = (isTypeAware) => {
|
|
|
730
807
|
const typescript = async (options) => {
|
|
731
808
|
const { requiredAll: [isTypescriptInstalled, tsEslint] } = await resolvePackages(MODULES.typescript);
|
|
732
809
|
if (!isTypescriptInstalled || !tsEslint) return [];
|
|
810
|
+
const { optional: [, pluginUnusedImports] } = await resolvePackages(MODULES.javascript);
|
|
733
811
|
const cwd = process.cwd();
|
|
734
812
|
let hasTsConfig = false;
|
|
735
813
|
try {
|
|
@@ -742,14 +820,14 @@ const typescript = async (options) => {
|
|
|
742
820
|
typeAware: hasTsConfig,
|
|
743
821
|
...options
|
|
744
822
|
};
|
|
745
|
-
const ignores
|
|
823
|
+
const ignores = resolvedOptions.ignores ?? [];
|
|
746
824
|
const files = [...new Set([...resolvedOptions.extraFileExtensions.map((extension) => `**/*.${extension}`), ...resolvedOptions.files ?? GLOB_SCRIPT_FILES])];
|
|
747
825
|
const hasEnabledTypeAwareness = resolvedOptions.typeAware !== false;
|
|
748
|
-
const typeAwareOptions = hasEnabledTypeAwareness ? resolveTypeAwareOptions(resolvedOptions, files, ignores
|
|
826
|
+
const typeAwareOptions = hasEnabledTypeAwareness ? resolveTypeAwareOptions(resolvedOptions, files, ignores) : {};
|
|
749
827
|
const createParserConfig = (isTypeAware) => ({
|
|
750
828
|
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, `${SUB_SCOPES.PARSER}${isTypeAware ? "-type-aware" : ""}`),
|
|
751
829
|
files: isTypeAware ? typeAwareOptions.files : files,
|
|
752
|
-
ignores: isTypeAware ? typeAwareOptions.ignores : ignores
|
|
830
|
+
ignores: isTypeAware ? typeAwareOptions.ignores : ignores,
|
|
753
831
|
languageOptions: {
|
|
754
832
|
parser: tsEslint.parser,
|
|
755
833
|
parserOptions: {
|
|
@@ -765,7 +843,7 @@ const typescript = async (options) => {
|
|
|
765
843
|
const createRulesConfig = (isTypeAware) => ({
|
|
766
844
|
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, `${SUB_SCOPES.RULES}${isTypeAware ? "-type-aware" : ""}`),
|
|
767
845
|
files: isTypeAware ? typeAwareOptions.files : files,
|
|
768
|
-
ignores: isTypeAware ? typeAwareOptions.ignores : ignores
|
|
846
|
+
ignores: isTypeAware ? typeAwareOptions.ignores : ignores,
|
|
769
847
|
rules: {
|
|
770
848
|
"ts/naming-convention": getNamingConvention(isTypeAware),
|
|
771
849
|
...isTypeAware ? {
|
|
@@ -789,6 +867,7 @@ const typescript = async (options) => {
|
|
|
789
867
|
...extractRelevantRules(tsEslint.configs.recommended, "recommended"),
|
|
790
868
|
...extractRelevantRules(tsEslint.configs.strict, "strict"),
|
|
791
869
|
...extractRelevantRules(tsEslint.configs.stylistic, "stylistic"),
|
|
870
|
+
...pluginUnusedImports ? { "ts/no-unused-vars": "off" } : void 0,
|
|
792
871
|
"ts/consistent-type-assertions": ["error", { assertionStyle: "angle-bracket" }],
|
|
793
872
|
"ts/consistent-type-imports": "error",
|
|
794
873
|
"ts/member-ordering": "error",
|
|
@@ -816,7 +895,7 @@ const typescript = async (options) => {
|
|
|
816
895
|
{
|
|
817
896
|
name: buildConfigName(MAIN_SCOPES.TYPESCRIPT, `${SUB_SCOPES.RULES}-typescript`),
|
|
818
897
|
files: [GLOB_TS],
|
|
819
|
-
ignores: typeAwareOptions.ignores ?? ignores
|
|
898
|
+
ignores: typeAwareOptions.ignores ?? ignores,
|
|
820
899
|
rules: {
|
|
821
900
|
"ts/explicit-function-return-type": "error",
|
|
822
901
|
"ts/explicit-member-accessibility": "error"
|
|
@@ -824,9 +903,8 @@ const typescript = async (options) => {
|
|
|
824
903
|
}
|
|
825
904
|
].filter(Boolean);
|
|
826
905
|
};
|
|
827
|
-
|
|
828
906
|
//#endregion
|
|
829
|
-
//#region src/js/eslint/configs/jsdoc.ts
|
|
907
|
+
//#region ../src/js/eslint/configs/jsdoc.ts
|
|
830
908
|
const jsdoc = async () => {
|
|
831
909
|
const { requiredAll: [pluginJsdoc], optional: [getJsdocProcessorPlugin] } = await resolvePackages(MODULES.jsdoc);
|
|
832
910
|
if (!pluginJsdoc) return [];
|
|
@@ -844,13 +922,13 @@ const jsdoc = async () => {
|
|
|
844
922
|
"jsdoc/require-returns": "off"
|
|
845
923
|
} : {
|
|
846
924
|
...pluginJsdoc.configs["flat/recommended-error"].rules,
|
|
847
|
-
"jsdoc/check-indentation": "error",
|
|
925
|
+
"jsdoc/check-indentation": ["error", { allowIndentedSections: true }],
|
|
848
926
|
"jsdoc/check-line-alignment": "error",
|
|
849
927
|
"jsdoc/check-syntax": "error",
|
|
850
928
|
"jsdoc/check-template-names": "error",
|
|
851
929
|
"jsdoc/convert-to-jsdoc-comments": ["error", { lineOrBlockStyle: "block" }],
|
|
852
930
|
"jsdoc/imports-as-dependencies": "error",
|
|
853
|
-
"jsdoc/informative-docs": "error",
|
|
931
|
+
"jsdoc/informative-docs": ["error", { excludedTags: ["default"] }],
|
|
854
932
|
"jsdoc/match-description": "error",
|
|
855
933
|
"jsdoc/multiline-blocks": ["error", {
|
|
856
934
|
noSingleLineBlocks: true,
|
|
@@ -978,20 +1056,14 @@ const jsdoc = async () => {
|
|
|
978
1056
|
"any",
|
|
979
1057
|
{
|
|
980
1058
|
maxBlockLines: 1,
|
|
981
|
-
startLines: 1
|
|
1059
|
+
startLines: 1,
|
|
1060
|
+
startLinesWithNoTags: 0
|
|
982
1061
|
}
|
|
983
1062
|
],
|
|
984
1063
|
"jsdoc/text-escaping": ["error", { escapeHTML: true }],
|
|
985
1064
|
"jsdoc/ts-method-signature-style": "error",
|
|
986
1065
|
"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
|
-
}]
|
|
1066
|
+
"jsdoc/ts-prefer-function-type": "error"
|
|
995
1067
|
} }
|
|
996
1068
|
});
|
|
997
1069
|
const parser = await getTsEslintParserIfExists();
|
|
@@ -1017,9 +1089,8 @@ const jsdoc = async () => {
|
|
|
1017
1089
|
}] : []
|
|
1018
1090
|
].filter(Boolean);
|
|
1019
1091
|
};
|
|
1020
|
-
|
|
1021
1092
|
//#endregion
|
|
1022
|
-
//#region src/js/eslint/configs/json.ts
|
|
1093
|
+
//#region ../src/js/eslint/configs/json.ts
|
|
1023
1094
|
const TSCONFIG_FILES = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
1024
1095
|
const JSON_FILES_TO_TREAT_AS_JSONC = [...TSCONFIG_FILES, ".vscode/**/*.json"];
|
|
1025
1096
|
const LANGUAGE_TO_GLOB_MAP = {
|
|
@@ -1027,9 +1098,9 @@ const LANGUAGE_TO_GLOB_MAP = {
|
|
|
1027
1098
|
jsonc: [GLOB_JSONC, ...JSON_FILES_TO_TREAT_AS_JSONC],
|
|
1028
1099
|
json5: [GLOB_JSON5]
|
|
1029
1100
|
};
|
|
1030
|
-
const extractAllRules = (configs
|
|
1101
|
+
const extractAllRules = (configs) => {
|
|
1031
1102
|
const rules = {};
|
|
1032
|
-
for (const config of configs
|
|
1103
|
+
for (const config of configs) if (config.rules) objectAssign(rules, config.rules);
|
|
1033
1104
|
return rules;
|
|
1034
1105
|
};
|
|
1035
1106
|
const getJsoncSortConfigs = () => [
|
|
@@ -1069,6 +1140,7 @@ const getJsoncSortConfigs = () => [
|
|
|
1069
1140
|
"libc",
|
|
1070
1141
|
"engines",
|
|
1071
1142
|
"devEngines",
|
|
1143
|
+
"browserslist",
|
|
1072
1144
|
"scripts",
|
|
1073
1145
|
"esnext",
|
|
1074
1146
|
"module",
|
|
@@ -1455,7 +1527,7 @@ const getJsoncSortConfigs = () => [
|
|
|
1455
1527
|
}
|
|
1456
1528
|
];
|
|
1457
1529
|
const json = async () => {
|
|
1458
|
-
const { requiredAll: [pluginJson], optional: [pluginJsonc
|
|
1530
|
+
const { requiredAll: [pluginJson], optional: [pluginJsonc] } = await resolvePackages(MODULES.json);
|
|
1459
1531
|
if (!pluginJson) return [];
|
|
1460
1532
|
const createRulesConfig = (language) => ({
|
|
1461
1533
|
name: buildConfigName(MAIN_SCOPES.JSON, `${SUB_SCOPES.RULES}-${language}`),
|
|
@@ -1464,17 +1536,20 @@ const json = async () => {
|
|
|
1464
1536
|
...language === "json" ? { ignores: JSON_FILES_TO_TREAT_AS_JSONC } : void 0,
|
|
1465
1537
|
rules: {
|
|
1466
1538
|
...pluginJson.configs.recommended.rules,
|
|
1467
|
-
...pluginJsonc ? extractAllRules(pluginJsonc.configs[`
|
|
1539
|
+
...pluginJsonc ? extractAllRules(pluginJsonc.configs[`recommended-with-${language}`]) : void 0,
|
|
1468
1540
|
...pluginJsonc ? {
|
|
1469
1541
|
"jsonc/array-bracket-newline": ["error", "consistent"],
|
|
1470
1542
|
"jsonc/array-bracket-spacing": "error",
|
|
1471
1543
|
"jsonc/comma-style": "error",
|
|
1472
|
-
"jsonc/indent": ["error",
|
|
1544
|
+
"jsonc/indent": ["error", 2],
|
|
1473
1545
|
"jsonc/key-spacing": "error",
|
|
1474
|
-
"jsonc/no-irregular-whitespace": "error",
|
|
1475
1546
|
"jsonc/no-octal-escape": "error",
|
|
1476
1547
|
"jsonc/object-curly-newline": "error",
|
|
1477
|
-
"jsonc/object-curly-spacing": [
|
|
1548
|
+
"jsonc/object-curly-spacing": [
|
|
1549
|
+
"error",
|
|
1550
|
+
"always",
|
|
1551
|
+
{ emptyObjects: "never" }
|
|
1552
|
+
],
|
|
1478
1553
|
"jsonc/object-property-newline": "error",
|
|
1479
1554
|
"jsonc/quotes": ["error", "double"]
|
|
1480
1555
|
} : void 0
|
|
@@ -1491,26 +1566,16 @@ const json = async () => {
|
|
|
1491
1566
|
name: buildConfigName(MAIN_SCOPES.JSON, SUB_SCOPES.SETUP),
|
|
1492
1567
|
plugins
|
|
1493
1568
|
},
|
|
1494
|
-
parserJsonc ? {
|
|
1495
|
-
name: buildConfigName(MAIN_SCOPES.JSON, SUB_SCOPES.PARSER),
|
|
1496
|
-
files: [
|
|
1497
|
-
GLOB_JSON,
|
|
1498
|
-
GLOB_JSONC,
|
|
1499
|
-
GLOB_JSON5
|
|
1500
|
-
],
|
|
1501
|
-
languageOptions: { parser: parserJsonc }
|
|
1502
|
-
} : void 0,
|
|
1503
1569
|
createRulesConfig("json"),
|
|
1504
1570
|
createRulesConfig("jsonc"),
|
|
1505
|
-
|
|
1506
|
-
|
|
1571
|
+
createRulesConfig("json5"),
|
|
1572
|
+
...jsoncSortConfigs
|
|
1507
1573
|
].filter(Boolean);
|
|
1508
1574
|
};
|
|
1509
|
-
|
|
1510
1575
|
//#endregion
|
|
1511
|
-
//#region src/js/eslint/configs/markdown.ts
|
|
1512
|
-
const extractRelevantValues = (identifier, configs
|
|
1513
|
-
for (const config of configs
|
|
1576
|
+
//#region ../src/js/eslint/configs/markdown.ts
|
|
1577
|
+
const extractRelevantValues = (identifier, configs, key) => {
|
|
1578
|
+
for (const config of configs) if (config.name === `markdown/${key}` && config[identifier] !== void 0 && config[identifier] !== null) return config[identifier];
|
|
1514
1579
|
throw new Error(`Expected key "${key}" to be contained in given config.`);
|
|
1515
1580
|
};
|
|
1516
1581
|
const markdown = async (options) => {
|
|
@@ -1573,6 +1638,7 @@ const markdown = async (options) => {
|
|
|
1573
1638
|
"no-alert": "off",
|
|
1574
1639
|
"no-console": "off",
|
|
1575
1640
|
"no-inline-comments": "off",
|
|
1641
|
+
"no-magic-numbers": "off",
|
|
1576
1642
|
"import/no-default-export": "off",
|
|
1577
1643
|
"import/unambiguous": "off",
|
|
1578
1644
|
"node/no-missing-import": "off",
|
|
@@ -1584,9 +1650,8 @@ const markdown = async (options) => {
|
|
|
1584
1650
|
}
|
|
1585
1651
|
];
|
|
1586
1652
|
};
|
|
1587
|
-
|
|
1588
1653
|
//#endregion
|
|
1589
|
-
//#region src/js/eslint/configs/node.ts
|
|
1654
|
+
//#region ../src/js/eslint/configs/node.ts
|
|
1590
1655
|
const node = async (options) => {
|
|
1591
1656
|
const { requiredAll: [pluginNode] } = await resolvePackages(MODULES.node);
|
|
1592
1657
|
if (!pluginNode) return [];
|
|
@@ -1610,9 +1675,11 @@ const node = async (options) => {
|
|
|
1610
1675
|
"node/no-sync": "error",
|
|
1611
1676
|
"node/prefer-global/buffer": "error",
|
|
1612
1677
|
"node/prefer-global/console": "error",
|
|
1678
|
+
"node/prefer-global/crypto": "error",
|
|
1613
1679
|
"node/prefer-global/process": "error",
|
|
1614
1680
|
"node/prefer-global/text-decoder": "error",
|
|
1615
1681
|
"node/prefer-global/text-encoder": "error",
|
|
1682
|
+
"node/prefer-global/timers": "error",
|
|
1616
1683
|
"node/prefer-global/url-search-params": "error",
|
|
1617
1684
|
"node/prefer-global/url": "error",
|
|
1618
1685
|
"node/prefer-node-protocol": "error",
|
|
@@ -1621,9 +1688,8 @@ const node = async (options) => {
|
|
|
1621
1688
|
}
|
|
1622
1689
|
}];
|
|
1623
1690
|
};
|
|
1624
|
-
|
|
1625
1691
|
//#endregion
|
|
1626
|
-
//#region src/js/eslint/configs/unicorn.ts
|
|
1692
|
+
//#region ../src/js/eslint/configs/unicorn.ts
|
|
1627
1693
|
const FILE_NAMES_TO_IGNORE = [
|
|
1628
1694
|
"ACKNOWLEDGMENTS.md",
|
|
1629
1695
|
"ADOPTERS.md",
|
|
@@ -1633,6 +1699,7 @@ const FILE_NAMES_TO_IGNORE = [
|
|
|
1633
1699
|
"AUTHORS.md",
|
|
1634
1700
|
"BUILD.md",
|
|
1635
1701
|
"CHANGELOG.md",
|
|
1702
|
+
"CLAUDE.md",
|
|
1636
1703
|
"CODE_OF_CONDUCT.md",
|
|
1637
1704
|
"CODEOWNERS.md",
|
|
1638
1705
|
"CODING_STANDARDS.md",
|
|
@@ -1674,6 +1741,7 @@ const FILE_NAMES_TO_IGNORE = [
|
|
|
1674
1741
|
"RELEASING.md",
|
|
1675
1742
|
"RESEARCH.md",
|
|
1676
1743
|
"ROADMAP.md",
|
|
1744
|
+
"SKILL.md",
|
|
1677
1745
|
"SPEC.md",
|
|
1678
1746
|
"SECURITY_POLICY.md",
|
|
1679
1747
|
"SECURITY.md",
|
|
@@ -1714,13 +1782,13 @@ const unicorn = async () => {
|
|
|
1714
1782
|
"unicorn/string-content": ["error", { patterns: {
|
|
1715
1783
|
"\\.\\.\\.": "…",
|
|
1716
1784
|
"^http:\\/\\/": String.raw`^https:\/\/`
|
|
1717
|
-
} }]
|
|
1785
|
+
} }],
|
|
1786
|
+
"unicorn/text-encoding-identifier-case": ["error", { withDash: true }]
|
|
1718
1787
|
}
|
|
1719
1788
|
}];
|
|
1720
1789
|
};
|
|
1721
|
-
|
|
1722
1790
|
//#endregion
|
|
1723
|
-
//#region src/js/eslint/configs/overrides.ts
|
|
1791
|
+
//#region ../src/js/eslint/configs/overrides.ts
|
|
1724
1792
|
const jsOverrides = [{
|
|
1725
1793
|
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.JAVASCRIPT}/scripts`),
|
|
1726
1794
|
files: ["scripts/**/*.?(c)js"],
|
|
@@ -1797,7 +1865,9 @@ const jsdocOverrides = isModuleEnabled(MODULES.jsdoc) ? [{
|
|
|
1797
1865
|
"style/eol-last": "off",
|
|
1798
1866
|
"style/no-multiple-empty-lines": "off",
|
|
1799
1867
|
"ts/no-unused-expressions": "off",
|
|
1800
|
-
"ts/no-unused-vars": "off"
|
|
1868
|
+
"ts/no-unused-vars": "off",
|
|
1869
|
+
"unused/no-unused-imports": "off",
|
|
1870
|
+
"unused/no-unused-vars": "off"
|
|
1801
1871
|
}
|
|
1802
1872
|
}, {
|
|
1803
1873
|
name: buildConfigName(MAIN_SCOPES.OVERRIDES, `${MAIN_SCOPES.JSDOC}/default-expressions`),
|
|
@@ -1870,9 +1940,8 @@ const overrides = () => [
|
|
|
1870
1940
|
}
|
|
1871
1941
|
}
|
|
1872
1942
|
];
|
|
1873
|
-
|
|
1874
1943
|
//#endregion
|
|
1875
|
-
//#region src/js/eslint/configs/perfectionist.ts
|
|
1944
|
+
//#region ../src/js/eslint/configs/perfectionist.ts
|
|
1876
1945
|
const perfectionist = async () => {
|
|
1877
1946
|
const { requiredAll: [pluginPerfectionist] } = await resolvePackages(MODULES.perfectionist);
|
|
1878
1947
|
if (!pluginPerfectionist) return [];
|
|
@@ -1892,9 +1961,8 @@ const perfectionist = async () => {
|
|
|
1892
1961
|
}
|
|
1893
1962
|
}];
|
|
1894
1963
|
};
|
|
1895
|
-
|
|
1896
1964
|
//#endregion
|
|
1897
|
-
//#region src/js/eslint/configs/regexp.ts
|
|
1965
|
+
//#region ../src/js/eslint/configs/regexp.ts
|
|
1898
1966
|
const regexp = async () => {
|
|
1899
1967
|
const { requiredAll: [pluginRegExp] } = await resolvePackages(MODULES.regexp);
|
|
1900
1968
|
if (!pluginRegExp) return [];
|
|
@@ -1944,17 +2012,16 @@ const regexp = async () => {
|
|
|
1944
2012
|
}
|
|
1945
2013
|
}];
|
|
1946
2014
|
};
|
|
1947
|
-
|
|
1948
2015
|
//#endregion
|
|
1949
|
-
//#region src/js/eslint/configs/style.ts
|
|
2016
|
+
//#region ../src/js/eslint/configs/style.ts
|
|
1950
2017
|
const style = async () => {
|
|
1951
2018
|
const { requiredAll: [pluginStyle] } = await resolvePackages(MODULES.style);
|
|
1952
2019
|
if (!pluginStyle) return [];
|
|
1953
2020
|
const styleConfig = pluginStyle.configs.customize({
|
|
1954
2021
|
jsx: true,
|
|
1955
2022
|
semi: true,
|
|
1956
|
-
indent:
|
|
1957
|
-
quotes:
|
|
2023
|
+
indent: 2,
|
|
2024
|
+
quotes: QUOTES,
|
|
1958
2025
|
quoteProps: "as-needed",
|
|
1959
2026
|
arrowParens: true,
|
|
1960
2027
|
blockSpacing: true,
|
|
@@ -1972,6 +2039,20 @@ const style = async () => {
|
|
|
1972
2039
|
...renameRules(styleConfig.rules, { "@stylistic": "style" }),
|
|
1973
2040
|
"style/array-bracket-newline": ["error", "consistent"],
|
|
1974
2041
|
"style/array-element-newline": ["error", "consistent"],
|
|
2042
|
+
"style/exp-jsx-props-style": ["error", {
|
|
2043
|
+
singleLine: { maxItems: 3 },
|
|
2044
|
+
multiLine: {
|
|
2045
|
+
minItems: 2,
|
|
2046
|
+
maxItemsPerLine: 1
|
|
2047
|
+
}
|
|
2048
|
+
}],
|
|
2049
|
+
"style/exp-list-style": ["error", {
|
|
2050
|
+
singleLine: {
|
|
2051
|
+
spacing: "never",
|
|
2052
|
+
maxItems: 3
|
|
2053
|
+
},
|
|
2054
|
+
multiLine: { minItems: 1 }
|
|
2055
|
+
}],
|
|
1975
2056
|
"style/function-call-argument-newline": ["error", "consistent"],
|
|
1976
2057
|
"style/function-call-spacing": "error",
|
|
1977
2058
|
"style/function-paren-newline": ["error", "multiline-arguments"],
|
|
@@ -1984,7 +2065,7 @@ const style = async () => {
|
|
|
1984
2065
|
"style/implicit-arrow-linebreak": "error",
|
|
1985
2066
|
"style/indent": [
|
|
1986
2067
|
"error",
|
|
1987
|
-
|
|
2068
|
+
2,
|
|
1988
2069
|
{
|
|
1989
2070
|
...indentRuleConfig,
|
|
1990
2071
|
offsetTernaryExpressions: false
|
|
@@ -1993,10 +2074,14 @@ const style = async () => {
|
|
|
1993
2074
|
"style/jsx-child-element-spacing": "error",
|
|
1994
2075
|
"style/jsx-pascal-case": "error",
|
|
1995
2076
|
"style/jsx-self-closing-comp": "error",
|
|
2077
|
+
"style/jsx-newline": ["error", {
|
|
2078
|
+
prevent: true,
|
|
2079
|
+
allowMultilines: true
|
|
2080
|
+
}],
|
|
1996
2081
|
"style/line-comment-position": "error",
|
|
1997
2082
|
"style/linebreak-style": "error",
|
|
1998
2083
|
"style/lines-around-comment": ["error", {
|
|
1999
|
-
beforeBlockComment:
|
|
2084
|
+
beforeBlockComment: false,
|
|
2000
2085
|
afterHashbangComment: true,
|
|
2001
2086
|
allowBlockStart: true,
|
|
2002
2087
|
allowObjectStart: true,
|
|
@@ -2008,8 +2093,8 @@ const style = async () => {
|
|
|
2008
2093
|
allowTypeStart: true
|
|
2009
2094
|
}],
|
|
2010
2095
|
"style/max-len": ["error", {
|
|
2011
|
-
code:
|
|
2012
|
-
tabWidth:
|
|
2096
|
+
code: 120,
|
|
2097
|
+
tabWidth: 2,
|
|
2013
2098
|
ignoreUrls: true,
|
|
2014
2099
|
ignoreStrings: true,
|
|
2015
2100
|
ignoreComments: true
|
|
@@ -2248,11 +2333,10 @@ const style = async () => {
|
|
|
2248
2333
|
}
|
|
2249
2334
|
}];
|
|
2250
2335
|
};
|
|
2251
|
-
|
|
2252
2336
|
//#endregion
|
|
2253
|
-
//#region src/js/eslint/configs/svelte.ts
|
|
2254
|
-
const extractRelevantConfig = (configs
|
|
2255
|
-
for (const config of configs
|
|
2337
|
+
//#region ../src/js/eslint/configs/svelte.ts
|
|
2338
|
+
const extractRelevantConfig = (configs, key) => {
|
|
2339
|
+
for (const config of configs) if (config.name === `svelte:${key}` && config.rules) return config;
|
|
2256
2340
|
throw new Error(`Expected key "${key}" to be contained in given config.`);
|
|
2257
2341
|
};
|
|
2258
2342
|
const svelte = async () => {
|
|
@@ -2267,7 +2351,7 @@ const svelte = async () => {
|
|
|
2267
2351
|
name: buildConfigName(MAIN_SCOPES.SVELTE, SUB_SCOPES.PARSER),
|
|
2268
2352
|
files: [GLOB_SVELTE, GLOB_SVELTE_SCRIPT],
|
|
2269
2353
|
languageOptions: {
|
|
2270
|
-
parser: extractRelevantConfig(pluginSvelte.configs
|
|
2354
|
+
parser: extractRelevantConfig(pluginSvelte.configs.base, "base:setup-for-svelte").languageOptions?.["parser"],
|
|
2271
2355
|
parserOptions: {
|
|
2272
2356
|
extraFileExtensions: [".svelte"],
|
|
2273
2357
|
parser: await getTsEslintParserIfExists()
|
|
@@ -2283,7 +2367,7 @@ const svelte = async () => {
|
|
|
2283
2367
|
name: buildConfigName(MAIN_SCOPES.SVELTE, SUB_SCOPES.RULES),
|
|
2284
2368
|
files: [GLOB_SVELTE, GLOB_SVELTE_SCRIPT],
|
|
2285
2369
|
rules: {
|
|
2286
|
-
...extractRelevantConfig(pluginSvelte.configs
|
|
2370
|
+
...extractRelevantConfig(pluginSvelte.configs.recommended, "recommended:rules").rules,
|
|
2287
2371
|
"svelte/block-lang": ["error", {
|
|
2288
2372
|
enforceScriptPresent: false,
|
|
2289
2373
|
enforceStylePresent: false,
|
|
@@ -2311,7 +2395,7 @@ const svelte = async () => {
|
|
|
2311
2395
|
void: "never"
|
|
2312
2396
|
}],
|
|
2313
2397
|
"style/indent": "off",
|
|
2314
|
-
"svelte/indent": ["error", { indent:
|
|
2398
|
+
"svelte/indent": ["error", { indent: 2 }],
|
|
2315
2399
|
"svelte/max-attributes-per-line": ["error", {
|
|
2316
2400
|
multiline: 1,
|
|
2317
2401
|
singleline: 3
|
|
@@ -2347,9 +2431,8 @@ const svelte = async () => {
|
|
|
2347
2431
|
}
|
|
2348
2432
|
];
|
|
2349
2433
|
};
|
|
2350
|
-
|
|
2351
2434
|
//#endregion
|
|
2352
|
-
//#region src/js/eslint/configs/test.ts
|
|
2435
|
+
//#region ../src/js/eslint/configs/test.ts
|
|
2353
2436
|
const test = async () => {
|
|
2354
2437
|
const { requiredAll: [pluginVitest] } = await resolvePackages(MODULES.test);
|
|
2355
2438
|
if (!pluginVitest) return [];
|
|
@@ -2408,75 +2491,65 @@ const test = async () => {
|
|
|
2408
2491
|
}
|
|
2409
2492
|
}];
|
|
2410
2493
|
};
|
|
2411
|
-
|
|
2412
2494
|
//#endregion
|
|
2413
|
-
//#region src/js/eslint/configs/toml.ts
|
|
2495
|
+
//#region ../src/js/eslint/configs/toml.ts
|
|
2414
2496
|
const toml = async () => {
|
|
2415
|
-
const { requiredAll: [pluginToml
|
|
2416
|
-
if (!pluginToml
|
|
2417
|
-
return [
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
"toml/indent": ["error", INDENT],
|
|
2435
|
-
"toml/no-mixed-type-in-array": "error"
|
|
2436
|
-
}
|
|
2497
|
+
const { requiredAll: [pluginToml] } = await resolvePackages(MODULES.toml);
|
|
2498
|
+
if (!pluginToml) return [];
|
|
2499
|
+
return [{
|
|
2500
|
+
name: buildConfigName(MAIN_SCOPES.TOML, SUB_SCOPES.SETUP),
|
|
2501
|
+
plugins: { toml: pluginToml }
|
|
2502
|
+
}, {
|
|
2503
|
+
name: buildConfigName(MAIN_SCOPES.TOML, SUB_SCOPES.RULES),
|
|
2504
|
+
files: [GLOB_TOML],
|
|
2505
|
+
language: "toml/toml",
|
|
2506
|
+
rules: {
|
|
2507
|
+
...pluginToml.configs.standard[2]?.rules,
|
|
2508
|
+
"toml/array-bracket-spacing": ["error", "never"],
|
|
2509
|
+
"toml/indent": ["error", 2],
|
|
2510
|
+
"toml/inline-table-curly-spacing": [
|
|
2511
|
+
"error",
|
|
2512
|
+
"always",
|
|
2513
|
+
{ emptyObjects: "never" }
|
|
2514
|
+
],
|
|
2515
|
+
"toml/no-mixed-type-in-array": "error"
|
|
2437
2516
|
}
|
|
2438
|
-
];
|
|
2517
|
+
}];
|
|
2439
2518
|
};
|
|
2440
|
-
|
|
2441
2519
|
//#endregion
|
|
2442
|
-
//#region src/js/eslint/configs/yaml.ts
|
|
2520
|
+
//#region ../src/js/eslint/configs/yaml.ts
|
|
2443
2521
|
const yaml = async () => {
|
|
2444
|
-
const { requiredAll: [pluginYaml
|
|
2445
|
-
if (!pluginYaml
|
|
2446
|
-
return [
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
prefer: "single"
|
|
2471
|
-
}],
|
|
2472
|
-
"yaml/require-string-key": "error"
|
|
2473
|
-
}
|
|
2522
|
+
const { requiredAll: [pluginYaml] } = await resolvePackages(MODULES.yaml);
|
|
2523
|
+
if (!pluginYaml) return [];
|
|
2524
|
+
return [{
|
|
2525
|
+
name: buildConfigName(MAIN_SCOPES.YAML, SUB_SCOPES.SETUP),
|
|
2526
|
+
plugins: { yaml: pluginYaml }
|
|
2527
|
+
}, {
|
|
2528
|
+
name: buildConfigName(MAIN_SCOPES.YAML, SUB_SCOPES.RULES),
|
|
2529
|
+
files: [GLOB_YAML],
|
|
2530
|
+
language: "yaml/yaml",
|
|
2531
|
+
rules: {
|
|
2532
|
+
...renameRules(pluginYaml.configs.standard[2]?.rules, { yml: "yaml" }),
|
|
2533
|
+
"yaml/block-mapping-colon-indicator-newline": ["error", "never"],
|
|
2534
|
+
"yaml/file-extension": "error",
|
|
2535
|
+
"yaml/flow-mapping-curly-spacing": [
|
|
2536
|
+
"error",
|
|
2537
|
+
"always",
|
|
2538
|
+
{ emptyObjects: "never" }
|
|
2539
|
+
],
|
|
2540
|
+
"yaml/indent": ["error", 2],
|
|
2541
|
+
"yaml/no-multiple-empty-lines": "error",
|
|
2542
|
+
"yaml/no-trailing-zeros": "error",
|
|
2543
|
+
"yaml/quotes": ["error", {
|
|
2544
|
+
avoidEscape: true,
|
|
2545
|
+
prefer: QUOTES
|
|
2546
|
+
}],
|
|
2547
|
+
"yaml/require-string-key": "error"
|
|
2474
2548
|
}
|
|
2475
|
-
];
|
|
2549
|
+
}];
|
|
2476
2550
|
};
|
|
2477
|
-
|
|
2478
2551
|
//#endregion
|
|
2479
|
-
//#region src/js/eslint/configs/index.ts
|
|
2552
|
+
//#region ../src/js/eslint/configs/index.ts
|
|
2480
2553
|
const configs = {
|
|
2481
2554
|
[packageOrganization]: builtinConfig[packageOrganization],
|
|
2482
2555
|
comments,
|
|
@@ -2500,9 +2573,8 @@ const configs = {
|
|
|
2500
2573
|
unicorn,
|
|
2501
2574
|
yaml
|
|
2502
2575
|
};
|
|
2503
|
-
|
|
2504
2576
|
//#endregion
|
|
2505
|
-
//#region src/js/eslint/index.ts
|
|
2577
|
+
//#region ../src/js/eslint/index.ts
|
|
2506
2578
|
const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
2507
2579
|
const resolvedOptions = {
|
|
2508
2580
|
[packageOrganization]: isModuleEnabledByDefault(MODULES[packageOrganization]),
|
|
@@ -2572,6 +2644,5 @@ const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
|
2572
2644
|
return composer;
|
|
2573
2645
|
};
|
|
2574
2646
|
var eslint_default = getConfig();
|
|
2575
|
-
|
|
2576
2647
|
//#endregion
|
|
2577
|
-
export { eslint_default as default, getConfig };
|
|
2648
|
+
export { eslint_default as default, getConfig };
|