@jsse/eslint-config 0.9.0 → 0.9.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/CHANGELOG.md +14 -0
- package/README.md +68 -21
- package/dist/cli.js +29 -30
- package/dist/dist-DS02OtwI.js +143 -0
- package/dist/{fixable-rules-map-CvRdO-mG.d.ts → fixable-rules-map-CCZ-PRHv.d.ts} +1073 -658
- package/dist/{fixable-rules-map-B2-5HybI.js → fixable-rules-map-dNndx2ig.js} +16 -0
- package/dist/fixable.d.ts +2 -2
- package/dist/fixable.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +851 -335
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +54 -54
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DJK8HYOj.js";
|
|
2
|
-
import { t as FIXABLE_RULES_MAP } from "./fixable-rules-map-
|
|
2
|
+
import { t as FIXABLE_RULES_MAP } from "./fixable-rules-map-dNndx2ig.js";
|
|
3
3
|
import { builtinModules, createRequire } from "node:module";
|
|
4
|
-
import fs, { realpathSync, statSync } from "node:fs";
|
|
5
4
|
import process$1 from "node:process";
|
|
6
5
|
import Debug from "debug";
|
|
7
6
|
import pluginE18e from "@e18e/eslint-plugin";
|
|
@@ -21,6 +20,7 @@ import createCommand from "eslint-plugin-command/config";
|
|
|
21
20
|
import eslintjs from "@eslint/js";
|
|
22
21
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
23
22
|
import tseslint from "typescript-eslint";
|
|
23
|
+
import fs, { realpathSync, statSync } from "node:fs";
|
|
24
24
|
import path, { dirname, join, win32 } from "node:path";
|
|
25
25
|
import fsPromises from "node:fs/promises";
|
|
26
26
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -28,7 +28,7 @@ import assert from "node:assert";
|
|
|
28
28
|
import v8 from "node:v8";
|
|
29
29
|
import { format, inspect } from "node:util";
|
|
30
30
|
//#region src/_generated/version.ts
|
|
31
|
-
const VERSION = "0.9.
|
|
31
|
+
const VERSION = "0.9.2";
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/globs.ts
|
|
34
34
|
var globs_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -118,6 +118,7 @@ const GLOB_EXCLUDE = [
|
|
|
118
118
|
"**/.vitepress/cache",
|
|
119
119
|
"**/*.bak",
|
|
120
120
|
"**/*.min.*",
|
|
121
|
+
"**/.wireit",
|
|
121
122
|
"**/.yarn",
|
|
122
123
|
"**/.pnp.*",
|
|
123
124
|
"**/auto-import?(s).d.ts",
|
|
@@ -227,13 +228,23 @@ const warn = (...args) => {
|
|
|
227
228
|
};
|
|
228
229
|
//#endregion
|
|
229
230
|
//#region src/utils.ts
|
|
231
|
+
function isPromiseLike(value) {
|
|
232
|
+
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
233
|
+
}
|
|
234
|
+
function flattenConfigs(configs) {
|
|
235
|
+
return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
|
|
236
|
+
}
|
|
237
|
+
async function resolveAndFlattenConfigs(configs) {
|
|
238
|
+
return flattenConfigs(await Promise.all(configs.map((config) => Promise.resolve(config))));
|
|
239
|
+
}
|
|
230
240
|
/**
|
|
231
241
|
* Combine array and non-array configs into a single array.
|
|
232
242
|
* @param configs configs to combine and flatten
|
|
233
243
|
* @returns combined configs as a flattened array
|
|
234
244
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
245
|
+
function combineAsync(...configs) {
|
|
246
|
+
if (configs.every((config) => !isPromiseLike(config))) return flattenConfigs(configs);
|
|
247
|
+
return resolveAndFlattenConfigs(configs);
|
|
237
248
|
}
|
|
238
249
|
function renameRules(rules, from, to) {
|
|
239
250
|
if (from === to) return rules;
|
|
@@ -267,6 +278,7 @@ function matchesRulePrefix(ruleName, rulePrefixes) {
|
|
|
267
278
|
return rulePrefixes.some((prefix) => ruleName.startsWith(`${prefix}/`));
|
|
268
279
|
}
|
|
269
280
|
function scopeTypeScriptRules(configs, options) {
|
|
281
|
+
dbg("scoping rules with prefixes %O to files: %O", options.rulePrefixes, options.files);
|
|
270
282
|
const { files, rulePrefixes } = options;
|
|
271
283
|
const normalizedPrefixes = uniqueStrings(rulePrefixes).filter(Boolean);
|
|
272
284
|
if (normalizedPrefixes.length === 0) return configs;
|
|
@@ -354,7 +366,7 @@ async function importPluginStylistic() {
|
|
|
354
366
|
}
|
|
355
367
|
//#endregion
|
|
356
368
|
//#region src/configs/antfu.ts
|
|
357
|
-
const antfu =
|
|
369
|
+
const antfu = (options) => {
|
|
358
370
|
return [{
|
|
359
371
|
files: GLOB_CODE,
|
|
360
372
|
name: "jsse/antfu",
|
|
@@ -374,7 +386,7 @@ const antfu = async (options) => {
|
|
|
374
386
|
* Docs: https://eslint-plugin-command.antfu.me/guide/
|
|
375
387
|
* @returns Typed config arr
|
|
376
388
|
*/
|
|
377
|
-
const command =
|
|
389
|
+
const command = (options) => {
|
|
378
390
|
const config = createCommand();
|
|
379
391
|
return [{
|
|
380
392
|
...config,
|
|
@@ -388,7 +400,7 @@ const command = async (options) => {
|
|
|
388
400
|
};
|
|
389
401
|
//#endregion
|
|
390
402
|
//#region src/configs/de-morgan.ts
|
|
391
|
-
const deMorgan =
|
|
403
|
+
const deMorgan = (options) => {
|
|
392
404
|
return [{
|
|
393
405
|
...pluginDeMorgan.configs.recommended,
|
|
394
406
|
files: GLOB_CODE,
|
|
@@ -401,7 +413,7 @@ const deMorgan = async (options) => {
|
|
|
401
413
|
};
|
|
402
414
|
//#endregion
|
|
403
415
|
//#region src/configs/e18e.ts
|
|
404
|
-
|
|
416
|
+
function e18e(options = {}) {
|
|
405
417
|
const { isInEditor = false, modernization = true, type = "app", moduleReplacements = type === "lib" && isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
406
418
|
const configs = pluginE18e.configs;
|
|
407
419
|
return [{
|
|
@@ -424,7 +436,7 @@ async function e18e(options = {}) {
|
|
|
424
436
|
}
|
|
425
437
|
//#endregion
|
|
426
438
|
//#region src/configs/eslint-comments.ts
|
|
427
|
-
const eslintComments =
|
|
439
|
+
const eslintComments = () => [{
|
|
428
440
|
files: GLOB_CODE,
|
|
429
441
|
name: "jsse/eslint-comments",
|
|
430
442
|
plugins: { "eslint-comments": pluginEslintComments },
|
|
@@ -436,77 +448,8 @@ const eslintComments = async () => [{
|
|
|
436
448
|
}
|
|
437
449
|
}];
|
|
438
450
|
//#endregion
|
|
439
|
-
//#region src/configs/react-hooks.ts
|
|
440
|
-
const reactHooks = async () => {
|
|
441
|
-
const pluginReactHooks = await interopDefault(import("eslint-plugin-react-hooks"));
|
|
442
|
-
return [{
|
|
443
|
-
files: [GLOB_SRC],
|
|
444
|
-
name: "jsse/react-hooks/rules",
|
|
445
|
-
plugins: { "react-hooks": pluginReactHooks },
|
|
446
|
-
rules: {
|
|
447
|
-
"react-hooks/exhaustive-deps": "error",
|
|
448
|
-
"react-hooks/rules-of-hooks": "error",
|
|
449
|
-
...pluginReactHooks.configs.recommended.rules
|
|
450
|
-
},
|
|
451
|
-
settings: { react: { version: "detect" } }
|
|
452
|
-
}];
|
|
453
|
-
};
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region src/configs/eslint-react.ts
|
|
456
|
-
async function importReactPlugins() {
|
|
457
|
-
const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
|
|
458
|
-
return {
|
|
459
|
-
pluginReact,
|
|
460
|
-
pluginReactRefresh
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
const eslintReact = async (options) => {
|
|
464
|
-
const { overrides = {}, reactRefresh } = options ?? {};
|
|
465
|
-
const { pluginReact, pluginReactRefresh } = await importReactPlugins();
|
|
466
|
-
const coreReactPlugins = pluginReact.configs.all.plugins?.["@eslint-react"];
|
|
467
|
-
if (!coreReactPlugins) throw new Error("coreReactPlugins is undefined");
|
|
468
|
-
const reactHooksConfig = await reactHooks();
|
|
469
|
-
const config = [
|
|
470
|
-
{
|
|
471
|
-
files: [GLOB_SRC],
|
|
472
|
-
name: "jsse/react/setup",
|
|
473
|
-
plugins: {
|
|
474
|
-
"@eslint-react": coreReactPlugins,
|
|
475
|
-
"react-refresh": pluginReactRefresh
|
|
476
|
-
}
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
files: [GLOB_SRC],
|
|
480
|
-
name: "jsse/react/rules",
|
|
481
|
-
rules: {
|
|
482
|
-
...pluginReact.configs.recommended.rules,
|
|
483
|
-
"react/dom-no-string-style-prop": "off",
|
|
484
|
-
"react/dom-no-unknown-property": "off",
|
|
485
|
-
...overrides
|
|
486
|
-
},
|
|
487
|
-
settings: { react: { version: "detect" } }
|
|
488
|
-
},
|
|
489
|
-
...reactHooksConfig,
|
|
490
|
-
{
|
|
491
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
492
|
-
name: "jsse/react/disables",
|
|
493
|
-
rules: { "unicorn/no-null": "off" }
|
|
494
|
-
}
|
|
495
|
-
];
|
|
496
|
-
if (reactRefresh) config.push({
|
|
497
|
-
files: [GLOB_SRC],
|
|
498
|
-
name: "jsse/react/refresh",
|
|
499
|
-
rules: { "react-refresh/only-export-components": "error" }
|
|
500
|
-
}, {
|
|
501
|
-
files: ["**/*.stories.tsx"],
|
|
502
|
-
name: "jsse/react-refresh/stories",
|
|
503
|
-
rules: { "react-refresh/only-export-components": "off" }
|
|
504
|
-
});
|
|
505
|
-
return config;
|
|
506
|
-
};
|
|
507
|
-
//#endregion
|
|
508
451
|
//#region src/configs/ignores.ts
|
|
509
|
-
const ignores =
|
|
452
|
+
const ignores = () => {
|
|
510
453
|
return [{
|
|
511
454
|
ignores: GLOB_EXCLUDE,
|
|
512
455
|
name: "jsse/ignores"
|
|
@@ -514,7 +457,7 @@ const ignores = async () => {
|
|
|
514
457
|
};
|
|
515
458
|
//#endregion
|
|
516
459
|
//#region src/configs/imports.ts
|
|
517
|
-
const imports =
|
|
460
|
+
const imports = (options) => {
|
|
518
461
|
const { stylistic = true } = options ?? {};
|
|
519
462
|
return [{
|
|
520
463
|
files: GLOB_CODE,
|
|
@@ -4664,7 +4607,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4664
4607
|
var import_globals = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4665
4608
|
module.exports = require_globals$1();
|
|
4666
4609
|
})))(), 1);
|
|
4667
|
-
function
|
|
4610
|
+
function javascriptSelectedRules() {
|
|
4668
4611
|
return {
|
|
4669
4612
|
"accessor-pairs": ["error", {
|
|
4670
4613
|
enforceForClassMembers: true,
|
|
@@ -4820,7 +4763,7 @@ function javascriptRules() {
|
|
|
4820
4763
|
yoda: ["error", "never"]
|
|
4821
4764
|
};
|
|
4822
4765
|
}
|
|
4823
|
-
const javascript =
|
|
4766
|
+
const javascript = (options) => {
|
|
4824
4767
|
const { isInEditor = false, overrides = {}, reportUnusedDisableDirectives = true } = options ?? {};
|
|
4825
4768
|
return [{
|
|
4826
4769
|
files: GLOB_CODE,
|
|
@@ -4846,7 +4789,7 @@ const javascript = async (options) => {
|
|
|
4846
4789
|
plugins: { "unused-imports": pluginUnusedImports },
|
|
4847
4790
|
rules: {
|
|
4848
4791
|
...eslintjs.configs.recommended.rules,
|
|
4849
|
-
...
|
|
4792
|
+
...javascriptSelectedRules(),
|
|
4850
4793
|
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
4851
4794
|
"unused-imports/no-unused-vars": ["error", {
|
|
4852
4795
|
args: "after-used",
|
|
@@ -4975,11 +4918,95 @@ const jsonc = async (options) => {
|
|
|
4975
4918
|
}];
|
|
4976
4919
|
};
|
|
4977
4920
|
//#endregion
|
|
4978
|
-
//#region src/configs/ts/
|
|
4921
|
+
//#region src/configs/ts/presets.ts
|
|
4922
|
+
const TYPESCRIPT_PRESET_CONFIGS = {
|
|
4923
|
+
all: "all",
|
|
4924
|
+
base: "base",
|
|
4925
|
+
"disable-type-checked": "disableTypeChecked",
|
|
4926
|
+
"eslint-recommended": "eslintRecommended",
|
|
4927
|
+
recommended: "recommended",
|
|
4928
|
+
"recommended-type-checked": "recommendedTypeChecked",
|
|
4929
|
+
"recommended-type-checked-only": "recommendedTypeCheckedOnly",
|
|
4930
|
+
strict: "strict",
|
|
4931
|
+
"strict-type-checked": "strictTypeChecked",
|
|
4932
|
+
"strict-type-checked-only": "strictTypeCheckedOnly",
|
|
4933
|
+
stylistic: "stylistic",
|
|
4934
|
+
"stylistic-type-checked": "stylisticTypeChecked",
|
|
4935
|
+
"stylistic-type-checked-only": "stylisticTypeCheckedOnly"
|
|
4936
|
+
};
|
|
4937
|
+
const TYPE_CHECKED_PRESETS = /* @__PURE__ */ new Set([
|
|
4938
|
+
"all",
|
|
4939
|
+
"disable-type-checked",
|
|
4940
|
+
"recommended-type-checked",
|
|
4941
|
+
"recommended-type-checked-only",
|
|
4942
|
+
"strict-type-checked",
|
|
4943
|
+
"strict-type-checked-only",
|
|
4944
|
+
"stylistic-type-checked",
|
|
4945
|
+
"stylistic-type-checked-only"
|
|
4946
|
+
]);
|
|
4947
|
+
const TYPE_OBLIVIOUS_PRESET_EQUIVALENTS = {
|
|
4948
|
+
"recommended-type-checked": "recommended",
|
|
4949
|
+
"strict-type-checked": "strict",
|
|
4950
|
+
"stylistic-type-checked": "stylistic"
|
|
4951
|
+
};
|
|
4979
4952
|
const extractRules = (configs) => {
|
|
4980
4953
|
const rules = configs.filter((config) => config.rules !== void 0).map((config) => config.rules ?? {});
|
|
4981
4954
|
return Object.assign({}, ...rules);
|
|
4982
4955
|
};
|
|
4956
|
+
function isTypescriptPreset(preset) {
|
|
4957
|
+
return Object.hasOwn(TYPESCRIPT_PRESET_CONFIGS, preset);
|
|
4958
|
+
}
|
|
4959
|
+
function normalizePresets(presets) {
|
|
4960
|
+
if (presets === void 0) return;
|
|
4961
|
+
const presetList = Array.isArray(presets) ? presets : [presets];
|
|
4962
|
+
const normalized = [];
|
|
4963
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4964
|
+
for (const preset of presetList) {
|
|
4965
|
+
if (!isTypescriptPreset(preset)) {
|
|
4966
|
+
const validPresets = Object.keys(TYPESCRIPT_PRESET_CONFIGS).join(", ");
|
|
4967
|
+
throw new Error(`Unknown TypeScript ESLint preset "${String(preset)}". Expected one of: ${validPresets}`);
|
|
4968
|
+
}
|
|
4969
|
+
if (seen.has(preset)) {
|
|
4970
|
+
warn(`Duplicate TypeScript ESLint preset "${preset}" ignored`);
|
|
4971
|
+
continue;
|
|
4972
|
+
}
|
|
4973
|
+
seen.add(preset);
|
|
4974
|
+
normalized.push(preset);
|
|
4975
|
+
}
|
|
4976
|
+
return normalized.length === 0 ? void 0 : normalized;
|
|
4977
|
+
}
|
|
4978
|
+
function defaultPresets(props) {
|
|
4979
|
+
return props?.typeAware ? props.strict ? ["strict-type-checked"] : ["recommended-type-checked"] : props?.strict ? ["strict"] : ["recommended"];
|
|
4980
|
+
}
|
|
4981
|
+
function presetsForScope(presets, typeAware) {
|
|
4982
|
+
if (typeAware) return presets;
|
|
4983
|
+
const scopedPresets = [];
|
|
4984
|
+
for (const preset of presets) {
|
|
4985
|
+
if (!TYPE_CHECKED_PRESETS.has(preset)) {
|
|
4986
|
+
scopedPresets.push(preset);
|
|
4987
|
+
continue;
|
|
4988
|
+
}
|
|
4989
|
+
const equivalent = TYPE_OBLIVIOUS_PRESET_EQUIVALENTS[preset];
|
|
4990
|
+
if (equivalent !== void 0) scopedPresets.push(equivalent);
|
|
4991
|
+
}
|
|
4992
|
+
return scopedPresets;
|
|
4993
|
+
}
|
|
4994
|
+
function configForPreset(preset) {
|
|
4995
|
+
const configName = TYPESCRIPT_PRESET_CONFIGS[preset];
|
|
4996
|
+
return tseslint.configs[configName];
|
|
4997
|
+
}
|
|
4998
|
+
function includesStrictPreset(presets) {
|
|
4999
|
+
if (presets === void 0) return false;
|
|
5000
|
+
return (Array.isArray(presets) ? presets : [presets]).some((preset) => preset === "strict" || preset.startsWith("strict-type-checked"));
|
|
5001
|
+
}
|
|
5002
|
+
function tsPresetRules(props) {
|
|
5003
|
+
const scopedPresets = presetsForScope(normalizePresets(props?.presets) ?? defaultPresets(props), props?.typeAware ?? false);
|
|
5004
|
+
const rules = {};
|
|
5005
|
+
for (const preset of scopedPresets) Object.assign(rules, extractRules(configForPreset(preset)));
|
|
5006
|
+
return rules;
|
|
5007
|
+
}
|
|
5008
|
+
//#endregion
|
|
5009
|
+
//#region src/configs/ts/typescript-rules.ts
|
|
4983
5010
|
function typescriptRulesTypeAware() {
|
|
4984
5011
|
return {
|
|
4985
5012
|
"@typescript-eslint/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
|
|
@@ -4991,9 +5018,25 @@ function typescriptRulesTypeAware() {
|
|
|
4991
5018
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
4992
5019
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
4993
5020
|
"@typescript-eslint/require-array-sort-compare": ["error", { ignoreStringArrays: true }],
|
|
5021
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
4994
5022
|
"@typescript-eslint/no-floating-promises": ["error", {
|
|
4995
5023
|
ignoreVoid: true,
|
|
4996
5024
|
ignoreIIFE: true
|
|
5025
|
+
}],
|
|
5026
|
+
"@typescript-eslint/restrict-template-expressions": ["error", {
|
|
5027
|
+
allow: [{
|
|
5028
|
+
name: [
|
|
5029
|
+
"Error",
|
|
5030
|
+
"URL",
|
|
5031
|
+
"URLSearchParams"
|
|
5032
|
+
],
|
|
5033
|
+
from: "lib"
|
|
5034
|
+
}],
|
|
5035
|
+
allowAny: false,
|
|
5036
|
+
allowBoolean: true,
|
|
5037
|
+
allowNullish: true,
|
|
5038
|
+
allowNumber: true,
|
|
5039
|
+
allowRegExp: true
|
|
4997
5040
|
}]
|
|
4998
5041
|
};
|
|
4999
5042
|
}
|
|
@@ -5109,10 +5152,6 @@ function typescriptRulesTypeOblivious() {
|
|
|
5109
5152
|
]
|
|
5110
5153
|
};
|
|
5111
5154
|
}
|
|
5112
|
-
function tsPresetRules(props) {
|
|
5113
|
-
const tseslintConfig = props?.typeAware ? props.strict ? tseslint.configs.strictTypeChecked : tseslint.configs.recommendedTypeChecked : props?.strict ? tseslint.configs.strict : tseslint.configs.recommended;
|
|
5114
|
-
return extractRules(tseslintConfig);
|
|
5115
|
-
}
|
|
5116
5155
|
function typescriptRules(props) {
|
|
5117
5156
|
const normalized = {
|
|
5118
5157
|
includeTsEslintPresetRules: true,
|
|
@@ -5120,15 +5159,17 @@ function typescriptRules(props) {
|
|
|
5120
5159
|
strict: false,
|
|
5121
5160
|
...props
|
|
5122
5161
|
};
|
|
5162
|
+
if (normalized.presets !== void 0 && normalized.strictProvided) throw new Error("Use either TypeScript `presets` or deprecated `strict`, not both.");
|
|
5123
5163
|
dbg("building typescript rules: %O", normalized);
|
|
5124
5164
|
const rulesFromPreset = normalized.includeTsEslintPresetRules ? tsPresetRules(normalized) : {};
|
|
5165
|
+
const strictRules = normalized.presets === void 0 ? normalized.strict : includesStrictPreset(normalized.presets);
|
|
5125
5166
|
dbg("ts-eslint preset rules: %O", rulesFromPreset);
|
|
5126
5167
|
return {
|
|
5127
5168
|
...rulesFromPreset,
|
|
5128
5169
|
...typescriptRulesTypeOblivious(),
|
|
5129
5170
|
...normalized.typeAware && typescriptRulesTypeAware(),
|
|
5130
|
-
...normalized.typeAware && !
|
|
5131
|
-
...normalized.typeAware &&
|
|
5171
|
+
...normalized.typeAware && !strictRules && { "@typescript-eslint/no-deprecated": "error" },
|
|
5172
|
+
...normalized.typeAware && strictRules && { "@typescript-eslint/no-unnecessary-condition": ["error", { allowConstantLoopConditions: "only-allowed-literals" }] }
|
|
5132
5173
|
};
|
|
5133
5174
|
}
|
|
5134
5175
|
//#endregion
|
|
@@ -5213,7 +5254,7 @@ const markdown = async (options) => {
|
|
|
5213
5254
|
};
|
|
5214
5255
|
//#endregion
|
|
5215
5256
|
//#region src/configs/n.ts
|
|
5216
|
-
const n =
|
|
5257
|
+
const n = (options) => {
|
|
5217
5258
|
return [{
|
|
5218
5259
|
files: GLOB_CODE,
|
|
5219
5260
|
name: "jsse/n",
|
|
@@ -5245,13 +5286,32 @@ const noOnlyTests = async (options = {}) => {
|
|
|
5245
5286
|
}];
|
|
5246
5287
|
};
|
|
5247
5288
|
//#endregion
|
|
5289
|
+
//#region src/configs/node-test.ts
|
|
5290
|
+
const nodeTest = async (options = {}) => {
|
|
5291
|
+
const { overrides = {}, preset = "recommended" } = options;
|
|
5292
|
+
const pluginNodeTest = await interopDefault(import("eslint-node-test"));
|
|
5293
|
+
return [{
|
|
5294
|
+
name: "jsse/node-test/setup",
|
|
5295
|
+
plugins: { "node-test": pluginNodeTest }
|
|
5296
|
+
}, {
|
|
5297
|
+
files: options.files ?? GLOB_TESTS,
|
|
5298
|
+
name: "jsse/node-test",
|
|
5299
|
+
rules: {
|
|
5300
|
+
...pluginNodeTest.configs[preset].rules,
|
|
5301
|
+
"node-test/consistent-test-filename": "error",
|
|
5302
|
+
"node-test/prefer-lowercase-title": "error",
|
|
5303
|
+
...overrides
|
|
5304
|
+
}
|
|
5305
|
+
}];
|
|
5306
|
+
};
|
|
5307
|
+
//#endregion
|
|
5248
5308
|
//#region src/configs/perfectionist.ts
|
|
5249
5309
|
/**
|
|
5250
5310
|
* Optional perfectionist plugin for props and items sorting.
|
|
5251
5311
|
* @returns ESLint config with perfectionist rules
|
|
5252
5312
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
5253
5313
|
*/
|
|
5254
|
-
const perfectionist =
|
|
5314
|
+
const perfectionist = () => {
|
|
5255
5315
|
return [{
|
|
5256
5316
|
files: GLOB_CODE,
|
|
5257
5317
|
name: "jsse/perfectionist",
|
|
@@ -5335,123 +5395,323 @@ const pnpm = async (options) => {
|
|
|
5335
5395
|
}];
|
|
5336
5396
|
};
|
|
5337
5397
|
//#endregion
|
|
5398
|
+
//#region src/_generated/eslint-config-prettier-rules.ts
|
|
5399
|
+
const ESLINT_CONFIG_PRETTIER_RULES = {
|
|
5400
|
+
"@stylistic/array-bracket-newline": "off",
|
|
5401
|
+
"@stylistic/array-bracket-spacing": "off",
|
|
5402
|
+
"@stylistic/array-element-newline": "off",
|
|
5403
|
+
"@stylistic/arrow-parens": "off",
|
|
5404
|
+
"@stylistic/arrow-spacing": "off",
|
|
5405
|
+
"@stylistic/block-spacing": "off",
|
|
5406
|
+
"@stylistic/brace-style": "off",
|
|
5407
|
+
"@stylistic/comma-dangle": "off",
|
|
5408
|
+
"@stylistic/comma-spacing": "off",
|
|
5409
|
+
"@stylistic/comma-style": "off",
|
|
5410
|
+
"@stylistic/computed-property-spacing": "off",
|
|
5411
|
+
"@stylistic/dot-location": "off",
|
|
5412
|
+
"@stylistic/eol-last": "off",
|
|
5413
|
+
"@stylistic/func-call-spacing": "off",
|
|
5414
|
+
"@stylistic/function-call-argument-newline": "off",
|
|
5415
|
+
"@stylistic/function-call-spacing": "off",
|
|
5416
|
+
"@stylistic/function-paren-newline": "off",
|
|
5417
|
+
"@stylistic/generator-star-spacing": "off",
|
|
5418
|
+
"@stylistic/implicit-arrow-linebreak": "off",
|
|
5419
|
+
"@stylistic/indent": "off",
|
|
5420
|
+
"@stylistic/indent-binary-ops": "off",
|
|
5421
|
+
"@stylistic/js/array-bracket-newline": "off",
|
|
5422
|
+
"@stylistic/js/array-bracket-spacing": "off",
|
|
5423
|
+
"@stylistic/js/array-element-newline": "off",
|
|
5424
|
+
"@stylistic/js/arrow-parens": "off",
|
|
5425
|
+
"@stylistic/js/arrow-spacing": "off",
|
|
5426
|
+
"@stylistic/js/block-spacing": "off",
|
|
5427
|
+
"@stylistic/js/brace-style": "off",
|
|
5428
|
+
"@stylistic/js/comma-dangle": "off",
|
|
5429
|
+
"@stylistic/js/comma-spacing": "off",
|
|
5430
|
+
"@stylistic/js/comma-style": "off",
|
|
5431
|
+
"@stylistic/js/computed-property-spacing": "off",
|
|
5432
|
+
"@stylistic/js/dot-location": "off",
|
|
5433
|
+
"@stylistic/js/eol-last": "off",
|
|
5434
|
+
"@stylistic/js/func-call-spacing": "off",
|
|
5435
|
+
"@stylistic/js/function-call-argument-newline": "off",
|
|
5436
|
+
"@stylistic/js/function-call-spacing": "off",
|
|
5437
|
+
"@stylistic/js/function-paren-newline": "off",
|
|
5438
|
+
"@stylistic/js/generator-star-spacing": "off",
|
|
5439
|
+
"@stylistic/js/implicit-arrow-linebreak": "off",
|
|
5440
|
+
"@stylistic/js/indent": "off",
|
|
5441
|
+
"@stylistic/js/jsx-quotes": "off",
|
|
5442
|
+
"@stylistic/js/key-spacing": "off",
|
|
5443
|
+
"@stylistic/js/keyword-spacing": "off",
|
|
5444
|
+
"@stylistic/js/linebreak-style": "off",
|
|
5445
|
+
"@stylistic/js/lines-around-comment": 0,
|
|
5446
|
+
"@stylistic/js/max-len": 0,
|
|
5447
|
+
"@stylistic/js/max-statements-per-line": "off",
|
|
5448
|
+
"@stylistic/js/multiline-ternary": "off",
|
|
5449
|
+
"@stylistic/js/new-parens": "off",
|
|
5450
|
+
"@stylistic/js/newline-per-chained-call": "off",
|
|
5451
|
+
"@stylistic/js/no-confusing-arrow": 0,
|
|
5452
|
+
"@stylistic/js/no-extra-parens": "off",
|
|
5453
|
+
"@stylistic/js/no-extra-semi": "off",
|
|
5454
|
+
"@stylistic/js/no-floating-decimal": "off",
|
|
5455
|
+
"@stylistic/js/no-mixed-operators": 0,
|
|
5456
|
+
"@stylistic/js/no-mixed-spaces-and-tabs": "off",
|
|
5457
|
+
"@stylistic/js/no-multi-spaces": "off",
|
|
5458
|
+
"@stylistic/js/no-multiple-empty-lines": "off",
|
|
5459
|
+
"@stylistic/js/no-tabs": 0,
|
|
5460
|
+
"@stylistic/js/no-trailing-spaces": "off",
|
|
5461
|
+
"@stylistic/js/no-whitespace-before-property": "off",
|
|
5462
|
+
"@stylistic/js/nonblock-statement-body-position": "off",
|
|
5463
|
+
"@stylistic/js/object-curly-newline": "off",
|
|
5464
|
+
"@stylistic/js/object-curly-spacing": "off",
|
|
5465
|
+
"@stylistic/js/object-property-newline": "off",
|
|
5466
|
+
"@stylistic/js/one-var-declaration-per-line": "off",
|
|
5467
|
+
"@stylistic/js/operator-linebreak": "off",
|
|
5468
|
+
"@stylistic/js/padded-blocks": "off",
|
|
5469
|
+
"@stylistic/js/quote-props": "off",
|
|
5470
|
+
"@stylistic/js/quotes": 0,
|
|
5471
|
+
"@stylistic/js/rest-spread-spacing": "off",
|
|
5472
|
+
"@stylistic/js/semi": "off",
|
|
5473
|
+
"@stylistic/js/semi-spacing": "off",
|
|
5474
|
+
"@stylistic/js/semi-style": "off",
|
|
5475
|
+
"@stylistic/js/space-before-blocks": "off",
|
|
5476
|
+
"@stylistic/js/space-before-function-paren": "off",
|
|
5477
|
+
"@stylistic/js/space-in-parens": "off",
|
|
5478
|
+
"@stylistic/js/space-infix-ops": "off",
|
|
5479
|
+
"@stylistic/js/space-unary-ops": "off",
|
|
5480
|
+
"@stylistic/js/switch-colon-spacing": "off",
|
|
5481
|
+
"@stylistic/js/template-curly-spacing": "off",
|
|
5482
|
+
"@stylistic/js/template-tag-spacing": "off",
|
|
5483
|
+
"@stylistic/js/wrap-iife": "off",
|
|
5484
|
+
"@stylistic/js/wrap-regex": "off",
|
|
5485
|
+
"@stylistic/js/yield-star-spacing": "off",
|
|
5486
|
+
"@stylistic/jsx-child-element-spacing": "off",
|
|
5487
|
+
"@stylistic/jsx-closing-bracket-location": "off",
|
|
5488
|
+
"@stylistic/jsx-closing-tag-location": "off",
|
|
5489
|
+
"@stylistic/jsx-curly-newline": "off",
|
|
5490
|
+
"@stylistic/jsx-curly-spacing": "off",
|
|
5491
|
+
"@stylistic/jsx-equals-spacing": "off",
|
|
5492
|
+
"@stylistic/jsx-first-prop-new-line": "off",
|
|
5493
|
+
"@stylistic/jsx-indent": "off",
|
|
5494
|
+
"@stylistic/jsx-indent-props": "off",
|
|
5495
|
+
"@stylistic/jsx-max-props-per-line": "off",
|
|
5496
|
+
"@stylistic/jsx-newline": "off",
|
|
5497
|
+
"@stylistic/jsx-one-expression-per-line": "off",
|
|
5498
|
+
"@stylistic/jsx-props-no-multi-spaces": "off",
|
|
5499
|
+
"@stylistic/jsx-quotes": "off",
|
|
5500
|
+
"@stylistic/jsx-tag-spacing": "off",
|
|
5501
|
+
"@stylistic/jsx-wrap-multilines": "off",
|
|
5502
|
+
"@stylistic/jsx/jsx-child-element-spacing": "off",
|
|
5503
|
+
"@stylistic/jsx/jsx-closing-bracket-location": "off",
|
|
5504
|
+
"@stylistic/jsx/jsx-closing-tag-location": "off",
|
|
5505
|
+
"@stylistic/jsx/jsx-curly-newline": "off",
|
|
5506
|
+
"@stylistic/jsx/jsx-curly-spacing": "off",
|
|
5507
|
+
"@stylistic/jsx/jsx-equals-spacing": "off",
|
|
5508
|
+
"@stylistic/jsx/jsx-first-prop-new-line": "off",
|
|
5509
|
+
"@stylistic/jsx/jsx-indent": "off",
|
|
5510
|
+
"@stylistic/jsx/jsx-indent-props": "off",
|
|
5511
|
+
"@stylistic/jsx/jsx-max-props-per-line": "off",
|
|
5512
|
+
"@stylistic/key-spacing": "off",
|
|
5513
|
+
"@stylistic/keyword-spacing": "off",
|
|
5514
|
+
"@stylistic/linebreak-style": "off",
|
|
5515
|
+
"@stylistic/lines-around-comment": 0,
|
|
5516
|
+
"@stylistic/max-len": 0,
|
|
5517
|
+
"@stylistic/max-statements-per-line": "off",
|
|
5518
|
+
"@stylistic/member-delimiter-style": "off",
|
|
5519
|
+
"@stylistic/multiline-ternary": "off",
|
|
5520
|
+
"@stylistic/new-parens": "off",
|
|
5521
|
+
"@stylistic/newline-per-chained-call": "off",
|
|
5522
|
+
"@stylistic/no-confusing-arrow": 0,
|
|
5523
|
+
"@stylistic/no-extra-parens": "off",
|
|
5524
|
+
"@stylistic/no-extra-semi": "off",
|
|
5525
|
+
"@stylistic/no-floating-decimal": "off",
|
|
5526
|
+
"@stylistic/no-mixed-operators": 0,
|
|
5527
|
+
"@stylistic/no-mixed-spaces-and-tabs": "off",
|
|
5528
|
+
"@stylistic/no-multi-spaces": "off",
|
|
5529
|
+
"@stylistic/no-multiple-empty-lines": "off",
|
|
5530
|
+
"@stylistic/no-tabs": 0,
|
|
5531
|
+
"@stylistic/no-trailing-spaces": "off",
|
|
5532
|
+
"@stylistic/no-whitespace-before-property": "off",
|
|
5533
|
+
"@stylistic/nonblock-statement-body-position": "off",
|
|
5534
|
+
"@stylistic/object-curly-newline": "off",
|
|
5535
|
+
"@stylistic/object-curly-spacing": "off",
|
|
5536
|
+
"@stylistic/object-property-newline": "off",
|
|
5537
|
+
"@stylistic/one-var-declaration-per-line": "off",
|
|
5538
|
+
"@stylistic/operator-linebreak": "off",
|
|
5539
|
+
"@stylistic/padded-blocks": "off",
|
|
5540
|
+
"@stylistic/quote-props": "off",
|
|
5541
|
+
"@stylistic/quotes": 0,
|
|
5542
|
+
"@stylistic/rest-spread-spacing": "off",
|
|
5543
|
+
"@stylistic/semi": "off",
|
|
5544
|
+
"@stylistic/semi-spacing": "off",
|
|
5545
|
+
"@stylistic/semi-style": "off",
|
|
5546
|
+
"@stylistic/space-before-blocks": "off",
|
|
5547
|
+
"@stylistic/space-before-function-paren": "off",
|
|
5548
|
+
"@stylistic/space-in-parens": "off",
|
|
5549
|
+
"@stylistic/space-infix-ops": "off",
|
|
5550
|
+
"@stylistic/space-unary-ops": "off",
|
|
5551
|
+
"@stylistic/switch-colon-spacing": "off",
|
|
5552
|
+
"@stylistic/template-curly-spacing": "off",
|
|
5553
|
+
"@stylistic/template-tag-spacing": "off",
|
|
5554
|
+
"@stylistic/ts/block-spacing": "off",
|
|
5555
|
+
"@stylistic/ts/brace-style": "off",
|
|
5556
|
+
"@stylistic/ts/comma-dangle": "off",
|
|
5557
|
+
"@stylistic/ts/comma-spacing": "off",
|
|
5558
|
+
"@stylistic/ts/func-call-spacing": "off",
|
|
5559
|
+
"@stylistic/ts/function-call-spacing": "off",
|
|
5560
|
+
"@stylistic/ts/indent": "off",
|
|
5561
|
+
"@stylistic/ts/key-spacing": "off",
|
|
5562
|
+
"@stylistic/ts/keyword-spacing": "off",
|
|
5563
|
+
"@stylistic/ts/lines-around-comment": 0,
|
|
5564
|
+
"@stylistic/ts/member-delimiter-style": "off",
|
|
5565
|
+
"@stylistic/ts/no-extra-parens": "off",
|
|
5566
|
+
"@stylistic/ts/no-extra-semi": "off",
|
|
5567
|
+
"@stylistic/ts/object-curly-spacing": "off",
|
|
5568
|
+
"@stylistic/ts/quotes": 0,
|
|
5569
|
+
"@stylistic/ts/semi": "off",
|
|
5570
|
+
"@stylistic/ts/space-before-blocks": "off",
|
|
5571
|
+
"@stylistic/ts/space-before-function-paren": "off",
|
|
5572
|
+
"@stylistic/ts/space-infix-ops": "off",
|
|
5573
|
+
"@stylistic/ts/type-annotation-spacing": "off",
|
|
5574
|
+
"@stylistic/type-annotation-spacing": "off",
|
|
5575
|
+
"@stylistic/type-generic-spacing": "off",
|
|
5576
|
+
"@stylistic/type-named-tuple-spacing": "off",
|
|
5577
|
+
"@stylistic/wrap-iife": "off",
|
|
5578
|
+
"@stylistic/wrap-regex": "off",
|
|
5579
|
+
"@stylistic/yield-star-spacing": "off",
|
|
5580
|
+
"@typescript-eslint/block-spacing": "off",
|
|
5581
|
+
"@typescript-eslint/brace-style": "off",
|
|
5582
|
+
"@typescript-eslint/comma-dangle": "off",
|
|
5583
|
+
"@typescript-eslint/comma-spacing": "off",
|
|
5584
|
+
"@typescript-eslint/func-call-spacing": "off",
|
|
5585
|
+
"@typescript-eslint/indent": "off",
|
|
5586
|
+
"@typescript-eslint/key-spacing": "off",
|
|
5587
|
+
"@typescript-eslint/keyword-spacing": "off",
|
|
5588
|
+
"@typescript-eslint/lines-around-comment": 0,
|
|
5589
|
+
"@typescript-eslint/member-delimiter-style": "off",
|
|
5590
|
+
"@typescript-eslint/no-extra-parens": "off",
|
|
5591
|
+
"@typescript-eslint/no-extra-semi": "off",
|
|
5592
|
+
"@typescript-eslint/object-curly-spacing": "off",
|
|
5593
|
+
"@typescript-eslint/quotes": 0,
|
|
5594
|
+
"@typescript-eslint/semi": "off",
|
|
5595
|
+
"@typescript-eslint/space-before-blocks": "off",
|
|
5596
|
+
"@typescript-eslint/space-before-function-paren": "off",
|
|
5597
|
+
"@typescript-eslint/space-infix-ops": "off",
|
|
5598
|
+
"@typescript-eslint/type-annotation-spacing": "off",
|
|
5599
|
+
"array-bracket-newline": "off",
|
|
5600
|
+
"array-bracket-spacing": "off",
|
|
5601
|
+
"array-element-newline": "off",
|
|
5602
|
+
"arrow-parens": "off",
|
|
5603
|
+
"arrow-spacing": "off",
|
|
5604
|
+
"block-spacing": "off",
|
|
5605
|
+
"brace-style": "off",
|
|
5606
|
+
"comma-dangle": "off",
|
|
5607
|
+
"comma-spacing": "off",
|
|
5608
|
+
"comma-style": "off",
|
|
5609
|
+
"computed-property-spacing": "off",
|
|
5610
|
+
curly: 0,
|
|
5611
|
+
"dot-location": "off",
|
|
5612
|
+
"eol-last": "off",
|
|
5613
|
+
"func-call-spacing": "off",
|
|
5614
|
+
"function-call-argument-newline": "off",
|
|
5615
|
+
"function-paren-newline": "off",
|
|
5616
|
+
"generator-star": "off",
|
|
5617
|
+
"generator-star-spacing": "off",
|
|
5618
|
+
"implicit-arrow-linebreak": "off",
|
|
5619
|
+
indent: "off",
|
|
5620
|
+
"indent-legacy": "off",
|
|
5621
|
+
"jsx-quotes": "off",
|
|
5622
|
+
"key-spacing": "off",
|
|
5623
|
+
"keyword-spacing": "off",
|
|
5624
|
+
"linebreak-style": "off",
|
|
5625
|
+
"lines-around-comment": 0,
|
|
5626
|
+
"max-len": 0,
|
|
5627
|
+
"max-statements-per-line": "off",
|
|
5628
|
+
"multiline-ternary": "off",
|
|
5629
|
+
"new-parens": "off",
|
|
5630
|
+
"newline-per-chained-call": "off",
|
|
5631
|
+
"no-arrow-condition": "off",
|
|
5632
|
+
"no-comma-dangle": "off",
|
|
5633
|
+
"no-confusing-arrow": 0,
|
|
5634
|
+
"no-extra-parens": "off",
|
|
5635
|
+
"no-extra-semi": "off",
|
|
5636
|
+
"no-floating-decimal": "off",
|
|
5637
|
+
"no-mixed-operators": 0,
|
|
5638
|
+
"no-mixed-spaces-and-tabs": "off",
|
|
5639
|
+
"no-multi-spaces": "off",
|
|
5640
|
+
"no-multiple-empty-lines": "off",
|
|
5641
|
+
"no-reserved-keys": "off",
|
|
5642
|
+
"no-space-before-semi": "off",
|
|
5643
|
+
"no-spaced-func": "off",
|
|
5644
|
+
"no-tabs": 0,
|
|
5645
|
+
"no-trailing-spaces": "off",
|
|
5646
|
+
"no-unexpected-multiline": 0,
|
|
5647
|
+
"no-whitespace-before-property": "off",
|
|
5648
|
+
"no-wrap-func": "off",
|
|
5649
|
+
"nonblock-statement-body-position": "off",
|
|
5650
|
+
"object-curly-newline": "off",
|
|
5651
|
+
"object-curly-spacing": "off",
|
|
5652
|
+
"object-property-newline": "off",
|
|
5653
|
+
"one-var-declaration-per-line": "off",
|
|
5654
|
+
"operator-linebreak": "off",
|
|
5655
|
+
"padded-blocks": "off",
|
|
5656
|
+
"quote-props": "off",
|
|
5657
|
+
quotes: 0,
|
|
5658
|
+
"react/jsx-child-element-spacing": "off",
|
|
5659
|
+
"react/jsx-closing-bracket-location": "off",
|
|
5660
|
+
"react/jsx-closing-tag-location": "off",
|
|
5661
|
+
"react/jsx-curly-newline": "off",
|
|
5662
|
+
"react/jsx-curly-spacing": "off",
|
|
5663
|
+
"react/jsx-equals-spacing": "off",
|
|
5664
|
+
"react/jsx-first-prop-new-line": "off",
|
|
5665
|
+
"react/jsx-indent": "off",
|
|
5666
|
+
"react/jsx-indent-props": "off",
|
|
5667
|
+
"react/jsx-max-props-per-line": "off",
|
|
5668
|
+
"react/jsx-newline": "off",
|
|
5669
|
+
"react/jsx-one-expression-per-line": "off",
|
|
5670
|
+
"react/jsx-props-no-multi-spaces": "off",
|
|
5671
|
+
"react/jsx-space-before-closing": "off",
|
|
5672
|
+
"react/jsx-tag-spacing": "off",
|
|
5673
|
+
"react/jsx-wrap-multilines": "off",
|
|
5674
|
+
"rest-spread-spacing": "off",
|
|
5675
|
+
semi: "off",
|
|
5676
|
+
"semi-spacing": "off",
|
|
5677
|
+
"semi-style": "off",
|
|
5678
|
+
"space-after-function-name": "off",
|
|
5679
|
+
"space-after-keywords": "off",
|
|
5680
|
+
"space-before-blocks": "off",
|
|
5681
|
+
"space-before-function-paren": "off",
|
|
5682
|
+
"space-before-function-parentheses": "off",
|
|
5683
|
+
"space-before-keywords": "off",
|
|
5684
|
+
"space-in-brackets": "off",
|
|
5685
|
+
"space-in-parens": "off",
|
|
5686
|
+
"space-infix-ops": "off",
|
|
5687
|
+
"space-return-throw-case": "off",
|
|
5688
|
+
"space-unary-ops": "off",
|
|
5689
|
+
"space-unary-word-ops": "off",
|
|
5690
|
+
"standard/array-bracket-even-spacing": "off",
|
|
5691
|
+
"standard/computed-property-even-spacing": "off",
|
|
5692
|
+
"standard/object-curly-even-spacing": "off",
|
|
5693
|
+
"switch-colon-spacing": "off",
|
|
5694
|
+
"template-curly-spacing": "off",
|
|
5695
|
+
"template-tag-spacing": "off",
|
|
5696
|
+
"unicorn/empty-brace-spaces": "off",
|
|
5697
|
+
"unicorn/no-nested-ternary": "off",
|
|
5698
|
+
"unicorn/number-literal-case": "off",
|
|
5699
|
+
"unicorn/template-indent": 0,
|
|
5700
|
+
"wrap-iife": "off",
|
|
5701
|
+
"wrap-regex": "off",
|
|
5702
|
+
"yield-star-spacing": "off"
|
|
5703
|
+
};
|
|
5704
|
+
//#endregion
|
|
5338
5705
|
//#region src/configs/prettier.ts
|
|
5339
5706
|
/**
|
|
5340
|
-
*
|
|
5707
|
+
* Generated from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
|
|
5341
5708
|
* Main difference is we exclude rules we don't care about.... (flow/babel/etc)
|
|
5342
5709
|
* @returns ESLint rules to disable when using Prettier
|
|
5343
5710
|
*/
|
|
5344
5711
|
function eslintConfigPrettierRules() {
|
|
5345
|
-
return
|
|
5346
|
-
"@typescript-eslint/block-spacing": "off",
|
|
5347
|
-
"@typescript-eslint/brace-style": "off",
|
|
5348
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
5349
|
-
"@typescript-eslint/comma-spacing": "off",
|
|
5350
|
-
"@typescript-eslint/func-call-spacing": "off",
|
|
5351
|
-
"@typescript-eslint/indent": "off",
|
|
5352
|
-
"@typescript-eslint/key-spacing": "off",
|
|
5353
|
-
"@typescript-eslint/keyword-spacing": "off",
|
|
5354
|
-
"@typescript-eslint/lines-around-comment": 0,
|
|
5355
|
-
"@typescript-eslint/member-delimiter-style": "off",
|
|
5356
|
-
"@typescript-eslint/no-extra-parens": "off",
|
|
5357
|
-
"@typescript-eslint/no-extra-semi": "off",
|
|
5358
|
-
"@typescript-eslint/object-curly-spacing": "off",
|
|
5359
|
-
"@typescript-eslint/quotes": 0,
|
|
5360
|
-
"@typescript-eslint/semi": "off",
|
|
5361
|
-
"@typescript-eslint/space-before-blocks": "off",
|
|
5362
|
-
"@typescript-eslint/space-before-function-paren": "off",
|
|
5363
|
-
"@typescript-eslint/space-infix-ops": "off",
|
|
5364
|
-
"@typescript-eslint/type-annotation-spacing": "off",
|
|
5365
|
-
"array-bracket-newline": "off",
|
|
5366
|
-
"array-bracket-spacing": "off",
|
|
5367
|
-
"array-element-newline": "off",
|
|
5368
|
-
"arrow-parens": "off",
|
|
5369
|
-
"arrow-spacing": "off",
|
|
5370
|
-
"block-spacing": "off",
|
|
5371
|
-
"brace-style": "off",
|
|
5372
|
-
"comma-dangle": "off",
|
|
5373
|
-
"comma-spacing": "off",
|
|
5374
|
-
"comma-style": "off",
|
|
5375
|
-
"computed-property-spacing": "off",
|
|
5376
|
-
curly: 0,
|
|
5377
|
-
"dot-location": "off",
|
|
5378
|
-
"eol-last": "off",
|
|
5379
|
-
"func-call-spacing": "off",
|
|
5380
|
-
"function-call-argument-newline": "off",
|
|
5381
|
-
"function-paren-newline": "off",
|
|
5382
|
-
"generator-star-spacing": "off",
|
|
5383
|
-
"implicit-arrow-linebreak": "off",
|
|
5384
|
-
indent: "off",
|
|
5385
|
-
"jsx-quotes": "off",
|
|
5386
|
-
"key-spacing": "off",
|
|
5387
|
-
"keyword-spacing": "off",
|
|
5388
|
-
"linebreak-style": "off",
|
|
5389
|
-
"lines-around-comment": 0,
|
|
5390
|
-
"max-len": 0,
|
|
5391
|
-
"max-statements-per-line": "off",
|
|
5392
|
-
"multiline-ternary": "off",
|
|
5393
|
-
"new-parens": "off",
|
|
5394
|
-
"newline-per-chained-call": "off",
|
|
5395
|
-
"no-confusing-arrow": 0,
|
|
5396
|
-
"no-extra-parens": "off",
|
|
5397
|
-
"no-extra-semi": "off",
|
|
5398
|
-
"no-floating-decimal": "off",
|
|
5399
|
-
"no-mixed-operators": 0,
|
|
5400
|
-
"no-mixed-spaces-and-tabs": "off",
|
|
5401
|
-
"no-multi-spaces": "off",
|
|
5402
|
-
"no-multiple-empty-lines": "off",
|
|
5403
|
-
"no-tabs": 0,
|
|
5404
|
-
"no-trailing-spaces": "off",
|
|
5405
|
-
"no-unexpected-multiline": 0,
|
|
5406
|
-
"no-whitespace-before-property": "off",
|
|
5407
|
-
"nonblock-statement-body-position": "off",
|
|
5408
|
-
"object-curly-newline": "off",
|
|
5409
|
-
"object-curly-spacing": "off",
|
|
5410
|
-
"object-property-newline": "off",
|
|
5411
|
-
"one-var-declaration-per-line": "off",
|
|
5412
|
-
"operator-linebreak": "off",
|
|
5413
|
-
"padded-blocks": "off",
|
|
5414
|
-
"quote-props": "off",
|
|
5415
|
-
quotes: 0,
|
|
5416
|
-
"react/jsx-child-element-spacing": "off",
|
|
5417
|
-
"react/jsx-closing-bracket-location": "off",
|
|
5418
|
-
"react/jsx-closing-tag-location": "off",
|
|
5419
|
-
"react/jsx-curly-newline": "off",
|
|
5420
|
-
"react/jsx-curly-spacing": "off",
|
|
5421
|
-
"react/jsx-equals-spacing": "off",
|
|
5422
|
-
"react/jsx-first-prop-new-line": "off",
|
|
5423
|
-
"react/jsx-indent": "off",
|
|
5424
|
-
"react/jsx-indent-props": "off",
|
|
5425
|
-
"react/jsx-max-props-per-line": "off",
|
|
5426
|
-
"react/jsx-newline": "off",
|
|
5427
|
-
"react/jsx-one-expression-per-line": "off",
|
|
5428
|
-
"react/jsx-props-no-multi-spaces": "off",
|
|
5429
|
-
"react/jsx-tag-spacing": "off",
|
|
5430
|
-
"react/jsx-wrap-multilines": "off",
|
|
5431
|
-
"rest-spread-spacing": "off",
|
|
5432
|
-
semi: "off",
|
|
5433
|
-
"semi-spacing": "off",
|
|
5434
|
-
"semi-style": "off",
|
|
5435
|
-
"space-before-blocks": "off",
|
|
5436
|
-
"space-before-function-paren": "off",
|
|
5437
|
-
"space-in-parens": "off",
|
|
5438
|
-
"space-infix-ops": "off",
|
|
5439
|
-
"space-unary-ops": "off",
|
|
5440
|
-
"standard/array-bracket-even-spacing": "off",
|
|
5441
|
-
"standard/computed-property-even-spacing": "off",
|
|
5442
|
-
"standard/object-curly-even-spacing": "off",
|
|
5443
|
-
"switch-colon-spacing": "off",
|
|
5444
|
-
"template-curly-spacing": "off",
|
|
5445
|
-
"template-tag-spacing": "off",
|
|
5446
|
-
"unicorn/empty-brace-spaces": "off",
|
|
5447
|
-
"unicorn/no-nested-ternary": "off",
|
|
5448
|
-
"unicorn/number-literal-case": "off",
|
|
5449
|
-
"wrap-iife": "off",
|
|
5450
|
-
"wrap-regex": "off",
|
|
5451
|
-
"yield-star-spacing": "off"
|
|
5452
|
-
};
|
|
5712
|
+
return ESLINT_CONFIG_PRETTIER_RULES;
|
|
5453
5713
|
}
|
|
5454
|
-
const prettier =
|
|
5714
|
+
const prettier = () => {
|
|
5455
5715
|
return [{
|
|
5456
5716
|
files: GLOB_CODE,
|
|
5457
5717
|
name: "jsse/prettier/config",
|
|
@@ -5459,26 +5719,299 @@ const prettier = async () => {
|
|
|
5459
5719
|
}];
|
|
5460
5720
|
};
|
|
5461
5721
|
//#endregion
|
|
5722
|
+
//#region src/configs/react/eslint-react.ts
|
|
5723
|
+
const REACT_PRESETS = /* @__PURE__ */ new Set([
|
|
5724
|
+
"recommended",
|
|
5725
|
+
"recommended-type-checked",
|
|
5726
|
+
"recommended-typescript",
|
|
5727
|
+
"strict",
|
|
5728
|
+
"strict-type-checked",
|
|
5729
|
+
"strict-typescript"
|
|
5730
|
+
]);
|
|
5731
|
+
function isReactPreset(preset) {
|
|
5732
|
+
return REACT_PRESETS.has(preset);
|
|
5733
|
+
}
|
|
5734
|
+
function normalizeReactPreset(preset) {
|
|
5735
|
+
if (preset === void 0) return "recommended";
|
|
5736
|
+
if (!isReactPreset(preset)) {
|
|
5737
|
+
const validPresets = [...REACT_PRESETS].join(", ");
|
|
5738
|
+
throw new Error(`Unknown @eslint-react preset "${String(preset)}". Expected one of: ${validPresets}`);
|
|
5739
|
+
}
|
|
5740
|
+
return preset;
|
|
5741
|
+
}
|
|
5742
|
+
async function importReactPlugins() {
|
|
5743
|
+
return { pluginReact: await Promise.resolve(interopDefault(import("@eslint-react/eslint-plugin"))) };
|
|
5744
|
+
}
|
|
5745
|
+
const eslintReact = async (options) => {
|
|
5746
|
+
const { preset } = options ?? {};
|
|
5747
|
+
const { pluginReact } = await importReactPlugins();
|
|
5748
|
+
const coreReactPlugins = pluginReact.configs.all.plugins?.["@eslint-react"];
|
|
5749
|
+
if (!coreReactPlugins) throw new Error("coreReactPlugins is undefined");
|
|
5750
|
+
const presetRules = pluginReact.configs[normalizeReactPreset(preset)].rules;
|
|
5751
|
+
return [{
|
|
5752
|
+
files: [GLOB_SRC],
|
|
5753
|
+
name: "jsse/react/setup",
|
|
5754
|
+
plugins: { "@eslint-react": coreReactPlugins }
|
|
5755
|
+
}, {
|
|
5756
|
+
files: [GLOB_SRC],
|
|
5757
|
+
name: "jsse/react/rules",
|
|
5758
|
+
rules: { ...presetRules },
|
|
5759
|
+
settings: { react: { version: "detect" } }
|
|
5760
|
+
}];
|
|
5761
|
+
};
|
|
5762
|
+
//#endregion
|
|
5763
|
+
//#region src/configs/react/hooks.ts
|
|
5764
|
+
async function importPluginReactHooks() {
|
|
5765
|
+
try {
|
|
5766
|
+
return await interopDefault(import("eslint-plugin-react-hooks"));
|
|
5767
|
+
} catch (error) {
|
|
5768
|
+
throw new Error("eslint-plugin-react-hooks is not installed", { cause: error });
|
|
5769
|
+
}
|
|
5770
|
+
}
|
|
5771
|
+
const reactHooks = async ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
5772
|
+
const pluginReactHooks = await importPluginReactHooks();
|
|
5773
|
+
const presetRules = pluginReactHooks.configs[preset].rules;
|
|
5774
|
+
return [{
|
|
5775
|
+
files: [GLOB_SRC],
|
|
5776
|
+
name: "jsse/react-hooks/rules",
|
|
5777
|
+
plugins: { "react-hooks": pluginReactHooks },
|
|
5778
|
+
rules: {
|
|
5779
|
+
"react-hooks/exhaustive-deps": "error",
|
|
5780
|
+
"react-hooks/rules-of-hooks": "error",
|
|
5781
|
+
...presetRules,
|
|
5782
|
+
...overrides
|
|
5783
|
+
},
|
|
5784
|
+
settings: { react: { version: "detect" } }
|
|
5785
|
+
}];
|
|
5786
|
+
};
|
|
5787
|
+
//#endregion
|
|
5788
|
+
//#region src/configs/react/refresh.ts
|
|
5789
|
+
async function importPluginReactRefresh() {
|
|
5790
|
+
try {
|
|
5791
|
+
return await interopDefault(import("eslint-plugin-react-refresh"));
|
|
5792
|
+
} catch (error) {
|
|
5793
|
+
throw new Error("eslint-plugin-react-refresh is not installed", { cause: error });
|
|
5794
|
+
}
|
|
5795
|
+
}
|
|
5796
|
+
const reactRefresh = async () => {
|
|
5797
|
+
const pluginReactRefresh = await importPluginReactRefresh();
|
|
5798
|
+
return [
|
|
5799
|
+
{
|
|
5800
|
+
files: [GLOB_SRC],
|
|
5801
|
+
name: "jsse/react-refresh/setup",
|
|
5802
|
+
plugins: { "react-refresh": pluginReactRefresh }
|
|
5803
|
+
},
|
|
5804
|
+
{
|
|
5805
|
+
files: [GLOB_SRC],
|
|
5806
|
+
name: "jsse/react/refresh",
|
|
5807
|
+
rules: { "react-refresh/only-export-components": "error" }
|
|
5808
|
+
},
|
|
5809
|
+
{
|
|
5810
|
+
files: ["**/*.stories.tsx"],
|
|
5811
|
+
name: "jsse/react-refresh/stories",
|
|
5812
|
+
rules: { "react-refresh/only-export-components": "off" }
|
|
5813
|
+
}
|
|
5814
|
+
];
|
|
5815
|
+
};
|
|
5816
|
+
//#endregion
|
|
5817
|
+
//#region src/configs/react/react.ts
|
|
5818
|
+
const LEGACY_REACT_REFRESH_OPTION = "reactRefresh";
|
|
5819
|
+
const react = async (options) => {
|
|
5820
|
+
const { hooks = true, overrides, ...rest } = options ?? {};
|
|
5821
|
+
const refresh = options?.refresh ?? options?.[LEGACY_REACT_REFRESH_OPTION] ?? true;
|
|
5822
|
+
const config = [
|
|
5823
|
+
...await eslintReact({
|
|
5824
|
+
...rest,
|
|
5825
|
+
overrides
|
|
5826
|
+
}),
|
|
5827
|
+
...hooks === false ? [] : await reactHooks({
|
|
5828
|
+
overrides,
|
|
5829
|
+
preset: hooks === true ? void 0 : hooks
|
|
5830
|
+
}),
|
|
5831
|
+
{
|
|
5832
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
5833
|
+
name: "jsse/react/disables",
|
|
5834
|
+
rules: { "unicorn/no-null": "off" }
|
|
5835
|
+
}
|
|
5836
|
+
];
|
|
5837
|
+
if (refresh) config.push(...await reactRefresh());
|
|
5838
|
+
if (options?.overrides) config.push({
|
|
5839
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
5840
|
+
name: "jsse/react/overrides",
|
|
5841
|
+
rules: { ...options.overrides }
|
|
5842
|
+
});
|
|
5843
|
+
return config;
|
|
5844
|
+
};
|
|
5845
|
+
//#endregion
|
|
5462
5846
|
//#region src/configs/regexp.ts
|
|
5463
|
-
const regexp =
|
|
5847
|
+
const regexp = () => {
|
|
5464
5848
|
const config = configs["flat/recommended"];
|
|
5465
|
-
const rules = { ...config.rules };
|
|
5466
5849
|
return [{
|
|
5467
5850
|
...config,
|
|
5468
5851
|
files: [GLOB_SRC],
|
|
5469
5852
|
name: "jsse/regexp/rules",
|
|
5470
|
-
rules
|
|
5853
|
+
rules: { ...config.rules }
|
|
5471
5854
|
}];
|
|
5472
5855
|
};
|
|
5473
5856
|
//#endregion
|
|
5474
5857
|
//#region src/configs/sort-package-json.ts
|
|
5858
|
+
const WIREIT_SCRIPT_PATH = String.raw`wireit(?:\.[A-Za-z_$][\w$]*|\[[^\]]+\])`;
|
|
5859
|
+
const WIREIT_ENV_PATH_BASE = String.raw`${WIREIT_SCRIPT_PATH}\.env`;
|
|
5860
|
+
const WIREIT_SERVICE_PATH_BASE = String.raw`${WIREIT_SCRIPT_PATH}\.service`;
|
|
5861
|
+
const WIREIT_DEPENDENCY_PATH = String.raw`^${WIREIT_SCRIPT_PATH}\.dependencies\[\d+\]$`;
|
|
5862
|
+
const WIREIT_ENV_PATH = `^${WIREIT_ENV_PATH_BASE}$`;
|
|
5863
|
+
const WIREIT_ENV_VALUE_PATH = String.raw`^${WIREIT_ENV_PATH_BASE}(?:\.[A-Za-z_$][\w$]*|\[[^\]]+\])$`;
|
|
5864
|
+
const WIREIT_SERVICE_PATH = `^${WIREIT_SERVICE_PATH_BASE}$`;
|
|
5865
|
+
const WIREIT_READY_WHEN_PATH = String.raw`^${WIREIT_SERVICE_PATH_BASE}\.readyWhen$`;
|
|
5866
|
+
const PACKAGE_JSON_ORDER = [
|
|
5867
|
+
"$schema",
|
|
5868
|
+
"name",
|
|
5869
|
+
"displayName",
|
|
5870
|
+
"version",
|
|
5871
|
+
"stableVersion",
|
|
5872
|
+
"gitHead",
|
|
5873
|
+
"private",
|
|
5874
|
+
"description",
|
|
5875
|
+
"categories",
|
|
5876
|
+
"keywords",
|
|
5877
|
+
"homepage",
|
|
5878
|
+
"bugs",
|
|
5879
|
+
"license",
|
|
5880
|
+
"author",
|
|
5881
|
+
"maintainers",
|
|
5882
|
+
"contributors",
|
|
5883
|
+
"repository",
|
|
5884
|
+
"funding",
|
|
5885
|
+
"donate",
|
|
5886
|
+
"sponsor",
|
|
5887
|
+
"qna",
|
|
5888
|
+
"publisher",
|
|
5889
|
+
"man",
|
|
5890
|
+
"style",
|
|
5891
|
+
"example",
|
|
5892
|
+
"examplestyle",
|
|
5893
|
+
"assets",
|
|
5894
|
+
"bin",
|
|
5895
|
+
"source",
|
|
5896
|
+
"directories",
|
|
5897
|
+
"workspaces",
|
|
5898
|
+
"binary",
|
|
5899
|
+
"files",
|
|
5900
|
+
"os",
|
|
5901
|
+
"cpu",
|
|
5902
|
+
"libc",
|
|
5903
|
+
"type",
|
|
5904
|
+
"sideEffects",
|
|
5905
|
+
"main",
|
|
5906
|
+
"module",
|
|
5907
|
+
"browser",
|
|
5908
|
+
"types",
|
|
5909
|
+
"typings",
|
|
5910
|
+
"typesVersions",
|
|
5911
|
+
"typeScriptVersion",
|
|
5912
|
+
"typesPublisherContentHash",
|
|
5913
|
+
"react-native",
|
|
5914
|
+
"svelte",
|
|
5915
|
+
"unpkg",
|
|
5916
|
+
"jsdelivr",
|
|
5917
|
+
"jsnext:main",
|
|
5918
|
+
"umd",
|
|
5919
|
+
"umd:main",
|
|
5920
|
+
"es5",
|
|
5921
|
+
"esm5",
|
|
5922
|
+
"fesm5",
|
|
5923
|
+
"es2015",
|
|
5924
|
+
"esm2015",
|
|
5925
|
+
"fesm2015",
|
|
5926
|
+
"es2020",
|
|
5927
|
+
"esm2020",
|
|
5928
|
+
"fesm2020",
|
|
5929
|
+
"esnext",
|
|
5930
|
+
"imports",
|
|
5931
|
+
"exports",
|
|
5932
|
+
"publishConfig",
|
|
5933
|
+
"scripts",
|
|
5934
|
+
"betterScripts",
|
|
5935
|
+
"wireit",
|
|
5936
|
+
"dependencies",
|
|
5937
|
+
"devDependencies",
|
|
5938
|
+
"dependenciesMeta",
|
|
5939
|
+
"peerDependencies",
|
|
5940
|
+
"peerDependenciesMeta",
|
|
5941
|
+
"optionalDependencies",
|
|
5942
|
+
"bundledDependencies",
|
|
5943
|
+
"bundleDependencies",
|
|
5944
|
+
"resolutions",
|
|
5945
|
+
"overrides",
|
|
5946
|
+
"husky",
|
|
5947
|
+
"simple-git-hooks",
|
|
5948
|
+
"vite-staged",
|
|
5949
|
+
"lint-staged",
|
|
5950
|
+
"nano-staged",
|
|
5951
|
+
"pre-commit",
|
|
5952
|
+
"commitlint",
|
|
5953
|
+
"l10n",
|
|
5954
|
+
"contributes",
|
|
5955
|
+
"activationEvents",
|
|
5956
|
+
"extensionPack",
|
|
5957
|
+
"extensionDependencies",
|
|
5958
|
+
"extensionKind",
|
|
5959
|
+
"icon",
|
|
5960
|
+
"badges",
|
|
5961
|
+
"galleryBanner",
|
|
5962
|
+
"preview",
|
|
5963
|
+
"markdown",
|
|
5964
|
+
"napi",
|
|
5965
|
+
"flat",
|
|
5966
|
+
"config",
|
|
5967
|
+
"nodemonConfig",
|
|
5968
|
+
"browserify",
|
|
5969
|
+
"babel",
|
|
5970
|
+
"browserslist",
|
|
5971
|
+
"xo",
|
|
5972
|
+
"prettier",
|
|
5973
|
+
"eslintConfig",
|
|
5974
|
+
"eslintIgnore",
|
|
5975
|
+
"standard",
|
|
5976
|
+
"npmpkgjsonlint",
|
|
5977
|
+
"npmPackageJsonLintConfig",
|
|
5978
|
+
"npmpackagejsonlint",
|
|
5979
|
+
"release",
|
|
5980
|
+
"auto-changelog",
|
|
5981
|
+
"remarkConfig",
|
|
5982
|
+
"stylelint",
|
|
5983
|
+
"typescript",
|
|
5984
|
+
"typedoc",
|
|
5985
|
+
"tshy",
|
|
5986
|
+
"tsdown",
|
|
5987
|
+
"size-limit",
|
|
5988
|
+
"ava",
|
|
5989
|
+
"jest",
|
|
5990
|
+
"jest-junit",
|
|
5991
|
+
"jest-stare",
|
|
5992
|
+
"mocha",
|
|
5993
|
+
"nyc",
|
|
5994
|
+
"c8",
|
|
5995
|
+
"tap",
|
|
5996
|
+
"tsd",
|
|
5997
|
+
"typeCoverage",
|
|
5998
|
+
"oclif",
|
|
5999
|
+
"languageName",
|
|
6000
|
+
"preferGlobal",
|
|
6001
|
+
"devEngines",
|
|
6002
|
+
"engines",
|
|
6003
|
+
"engineStrict",
|
|
6004
|
+
"volta",
|
|
6005
|
+
"packageManager",
|
|
6006
|
+
"pnpm"
|
|
6007
|
+
];
|
|
5475
6008
|
/**
|
|
5476
6009
|
* Sort package.json
|
|
5477
6010
|
*
|
|
5478
6011
|
* Requires `jsonc` config
|
|
5479
6012
|
* @returns ESLint config to sort package.json files
|
|
5480
6013
|
*/
|
|
5481
|
-
const sortPackageJson =
|
|
6014
|
+
const sortPackageJson = () => {
|
|
5482
6015
|
return [{
|
|
5483
6016
|
files: ["**/package.json"],
|
|
5484
6017
|
name: "jsse/sort/package-json",
|
|
@@ -5490,53 +6023,7 @@ const sortPackageJson = async () => {
|
|
|
5490
6023
|
"jsonc/sort-keys": [
|
|
5491
6024
|
"error",
|
|
5492
6025
|
{
|
|
5493
|
-
order: [
|
|
5494
|
-
"publisher",
|
|
5495
|
-
"name",
|
|
5496
|
-
"displayName",
|
|
5497
|
-
"type",
|
|
5498
|
-
"version",
|
|
5499
|
-
"private",
|
|
5500
|
-
"packageManager",
|
|
5501
|
-
"description",
|
|
5502
|
-
"author",
|
|
5503
|
-
"contributors",
|
|
5504
|
-
"license",
|
|
5505
|
-
"funding",
|
|
5506
|
-
"homepage",
|
|
5507
|
-
"repository",
|
|
5508
|
-
"bugs",
|
|
5509
|
-
"keywords",
|
|
5510
|
-
"categories",
|
|
5511
|
-
"sideEffects",
|
|
5512
|
-
"imports",
|
|
5513
|
-
"exports",
|
|
5514
|
-
"main",
|
|
5515
|
-
"module",
|
|
5516
|
-
"unpkg",
|
|
5517
|
-
"jsdelivr",
|
|
5518
|
-
"types",
|
|
5519
|
-
"typesVersions",
|
|
5520
|
-
"bin",
|
|
5521
|
-
"icon",
|
|
5522
|
-
"files",
|
|
5523
|
-
"engines",
|
|
5524
|
-
"activationEvents",
|
|
5525
|
-
"contributes",
|
|
5526
|
-
"scripts",
|
|
5527
|
-
"peerDependencies",
|
|
5528
|
-
"peerDependenciesMeta",
|
|
5529
|
-
"dependencies",
|
|
5530
|
-
"optionalDependencies",
|
|
5531
|
-
"devDependencies",
|
|
5532
|
-
"pnpm",
|
|
5533
|
-
"overrides",
|
|
5534
|
-
"resolutions",
|
|
5535
|
-
"husky",
|
|
5536
|
-
"simple-git-hooks",
|
|
5537
|
-
"lint-staged",
|
|
5538
|
-
"eslintConfig"
|
|
5539
|
-
],
|
|
6026
|
+
order: [...PACKAGE_JSON_ORDER],
|
|
5540
6027
|
pathPattern: "^$"
|
|
5541
6028
|
},
|
|
5542
6029
|
{
|
|
@@ -5547,6 +6034,60 @@ const sortPackageJson = async () => {
|
|
|
5547
6034
|
order: { type: "asc" },
|
|
5548
6035
|
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
5549
6036
|
},
|
|
6037
|
+
{
|
|
6038
|
+
order: { type: "asc" },
|
|
6039
|
+
pathPattern: "^wireit$"
|
|
6040
|
+
},
|
|
6041
|
+
{
|
|
6042
|
+
order: [
|
|
6043
|
+
"command",
|
|
6044
|
+
"dependencies",
|
|
6045
|
+
"files",
|
|
6046
|
+
"output",
|
|
6047
|
+
{
|
|
6048
|
+
keyPattern: ".*",
|
|
6049
|
+
order: { type: "asc" }
|
|
6050
|
+
}
|
|
6051
|
+
],
|
|
6052
|
+
pathPattern: `^${WIREIT_SCRIPT_PATH}$`
|
|
6053
|
+
},
|
|
6054
|
+
{
|
|
6055
|
+
order: [
|
|
6056
|
+
"script",
|
|
6057
|
+
"cascade",
|
|
6058
|
+
{
|
|
6059
|
+
keyPattern: ".*",
|
|
6060
|
+
order: { type: "asc" }
|
|
6061
|
+
}
|
|
6062
|
+
],
|
|
6063
|
+
pathPattern: WIREIT_DEPENDENCY_PATH
|
|
6064
|
+
},
|
|
6065
|
+
{
|
|
6066
|
+
order: { type: "asc" },
|
|
6067
|
+
pathPattern: WIREIT_ENV_PATH
|
|
6068
|
+
},
|
|
6069
|
+
{
|
|
6070
|
+
order: [
|
|
6071
|
+
"external",
|
|
6072
|
+
"default",
|
|
6073
|
+
{
|
|
6074
|
+
keyPattern: ".*",
|
|
6075
|
+
order: { type: "asc" }
|
|
6076
|
+
}
|
|
6077
|
+
],
|
|
6078
|
+
pathPattern: WIREIT_ENV_VALUE_PATH
|
|
6079
|
+
},
|
|
6080
|
+
{
|
|
6081
|
+
order: ["readyWhen", {
|
|
6082
|
+
keyPattern: ".*",
|
|
6083
|
+
order: { type: "asc" }
|
|
6084
|
+
}],
|
|
6085
|
+
pathPattern: WIREIT_SERVICE_PATH
|
|
6086
|
+
},
|
|
6087
|
+
{
|
|
6088
|
+
order: { type: "asc" },
|
|
6089
|
+
pathPattern: WIREIT_READY_WHEN_PATH
|
|
6090
|
+
},
|
|
5550
6091
|
{
|
|
5551
6092
|
order: [
|
|
5552
6093
|
"types",
|
|
@@ -5585,7 +6126,7 @@ const sortPackageJson = async () => {
|
|
|
5585
6126
|
const tsconfigGlobs = (extendGlobs) => {
|
|
5586
6127
|
return extendGlobs === void 0 || extendGlobs.length === 0 ? GLOB_TSCONFIG : uniqueStrings(GLOB_TSCONFIG, extendGlobs);
|
|
5587
6128
|
};
|
|
5588
|
-
const sortTsconfig =
|
|
6129
|
+
const sortTsconfig = (options) => {
|
|
5589
6130
|
return [{
|
|
5590
6131
|
files: tsconfigGlobs(options?.extendTsconfigGlobs),
|
|
5591
6132
|
name: "jsse/sort/tsconfig",
|
|
@@ -5787,9 +6328,10 @@ function typescriptParser(options) {
|
|
|
5787
6328
|
}
|
|
5788
6329
|
//#endregion
|
|
5789
6330
|
//#region src/configs/ts/typescript.ts
|
|
5790
|
-
const typescript =
|
|
6331
|
+
const typescript = (options) => {
|
|
5791
6332
|
dbg("typescript-options: %O", options);
|
|
5792
|
-
const { componentExts = [], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [GLOB_MARKDOWN], overrides = {}, overridesTypeAware = {}, parserOptions = {}, prefix, strict = false, tsconfig: tsconfigPath, typeAware = true } = options ?? {};
|
|
6333
|
+
const { componentExts = [], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [GLOB_MARKDOWN], overrides = {}, overridesTypeAware = {}, parserOptions = {}, prefix, presets, strict = false, tsconfig: tsconfigPath, typeAware = true } = options ?? {};
|
|
6334
|
+
const strictProvided = options?.strict !== void 0;
|
|
5793
6335
|
const hasCustomTypeAwareScope = options?.filesTypeAware !== void 0 || options?.ignoresTypeAware !== void 0;
|
|
5794
6336
|
const parserConfigs = typeAware ? [typescriptParser({
|
|
5795
6337
|
filesTypeAware,
|
|
@@ -5815,7 +6357,9 @@ const typescript = async (options) => {
|
|
|
5815
6357
|
const tsRules = {
|
|
5816
6358
|
"no-invalid-this": "off",
|
|
5817
6359
|
...typescriptRules({
|
|
6360
|
+
presets,
|
|
5818
6361
|
strict,
|
|
6362
|
+
strictProvided,
|
|
5819
6363
|
typeAware: false
|
|
5820
6364
|
}),
|
|
5821
6365
|
...overrides
|
|
@@ -5845,7 +6389,9 @@ const typescript = async (options) => {
|
|
|
5845
6389
|
name: "jsse/typescript/rules-type-aware",
|
|
5846
6390
|
rules: renameRules({
|
|
5847
6391
|
...typescriptRules({
|
|
6392
|
+
presets,
|
|
5848
6393
|
strict,
|
|
6394
|
+
strictProvided,
|
|
5849
6395
|
typeAware: true
|
|
5850
6396
|
}),
|
|
5851
6397
|
...overrides,
|
|
@@ -5883,9 +6429,7 @@ const typescript = async (options) => {
|
|
|
5883
6429
|
function unicornOff() {
|
|
5884
6430
|
return {
|
|
5885
6431
|
"unicorn/catch-error-name": "off",
|
|
5886
|
-
"unicorn/comment-content": "off",
|
|
5887
6432
|
"unicorn/consistent-boolean-name": "off",
|
|
5888
|
-
"unicorn/consistent-destructuring": "off",
|
|
5889
6433
|
"unicorn/name-replacements": "off",
|
|
5890
6434
|
"unicorn/no-array-reduce": "off",
|
|
5891
6435
|
"unicorn/no-nested-ternary": "off",
|
|
@@ -5896,6 +6440,16 @@ function unicornOff() {
|
|
|
5896
6440
|
"unicorn/prevent-abbreviations": "off"
|
|
5897
6441
|
};
|
|
5898
6442
|
}
|
|
6443
|
+
function unicornSelectedRules() {
|
|
6444
|
+
return {
|
|
6445
|
+
"unicorn/better-regex": "error",
|
|
6446
|
+
"unicorn/custom-error-definition": "error",
|
|
6447
|
+
"unicorn/no-array-push-push": "error",
|
|
6448
|
+
"unicorn/no-hex-escape": "error",
|
|
6449
|
+
"unicorn/no-instanceof-array": "error",
|
|
6450
|
+
"unicorn/prefer-dom-node-dataset": "error"
|
|
6451
|
+
};
|
|
6452
|
+
}
|
|
5899
6453
|
function unicornRecommended(pluginUnicorn) {
|
|
5900
6454
|
const rules = pluginUnicorn.configs.recommended.rules;
|
|
5901
6455
|
if (rules === void 0) throw new Error("Expected rules to be defined in unicorn plugin");
|
|
@@ -5909,7 +6463,7 @@ function unicornPresetRules(pluginUnicorn, preset) {
|
|
|
5909
6463
|
default: throw new Error(`Unknown preset: ${preset}`);
|
|
5910
6464
|
}
|
|
5911
6465
|
}
|
|
5912
|
-
const unicorn =
|
|
6466
|
+
const unicorn = ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
5913
6467
|
return [{
|
|
5914
6468
|
files: GLOB_CODE,
|
|
5915
6469
|
name: "jsse/unicorn",
|
|
@@ -5917,59 +6471,7 @@ const unicorn = async ({ overrides = {}, preset = "recommended" } = {}) => {
|
|
|
5917
6471
|
rules: {
|
|
5918
6472
|
...unicornPresetRules(pluginUnicorn, preset),
|
|
5919
6473
|
...unicornOff(),
|
|
5920
|
-
|
|
5921
|
-
"unicorn/consistent-empty-array-spread": "error",
|
|
5922
|
-
"unicorn/custom-error-definition": "error",
|
|
5923
|
-
"unicorn/error-message": "error",
|
|
5924
|
-
"unicorn/escape-case": "error",
|
|
5925
|
-
"unicorn/explicit-length-check": "error",
|
|
5926
|
-
"unicorn/filename-case": "error",
|
|
5927
|
-
"unicorn/new-for-builtins": "error",
|
|
5928
|
-
"unicorn/no-array-callback-reference": "error",
|
|
5929
|
-
"unicorn/no-array-method-this-argument": "error",
|
|
5930
|
-
"unicorn/no-array-push-push": "error",
|
|
5931
|
-
"unicorn/no-console-spaces": "error",
|
|
5932
|
-
"unicorn/no-for-loop": "error",
|
|
5933
|
-
"unicorn/no-hex-escape": "error",
|
|
5934
|
-
"unicorn/no-instanceof-array": "error",
|
|
5935
|
-
"unicorn/no-invalid-remove-event-listener": "error",
|
|
5936
|
-
"unicorn/no-lonely-if": "error",
|
|
5937
|
-
"unicorn/no-new-array": "error",
|
|
5938
|
-
"unicorn/no-new-buffer": "error",
|
|
5939
|
-
"unicorn/no-static-only-class": "error",
|
|
5940
|
-
"unicorn/no-unnecessary-await": "error",
|
|
5941
|
-
"unicorn/no-zero-fractions": "error",
|
|
5942
|
-
"unicorn/number-literal-case": "error",
|
|
5943
|
-
"unicorn/prefer-add-event-listener": "error",
|
|
5944
|
-
"unicorn/prefer-array-find": "error",
|
|
5945
|
-
"unicorn/prefer-array-flat-map": "error",
|
|
5946
|
-
"unicorn/prefer-array-index-of": "error",
|
|
5947
|
-
"unicorn/prefer-array-some": "error",
|
|
5948
|
-
"unicorn/prefer-at": "error",
|
|
5949
|
-
"unicorn/prefer-blob-reading-methods": "error",
|
|
5950
|
-
"unicorn/prefer-date-now": "error",
|
|
5951
|
-
"unicorn/prefer-dom-node-append": "error",
|
|
5952
|
-
"unicorn/prefer-dom-node-dataset": "error",
|
|
5953
|
-
"unicorn/prefer-dom-node-remove": "error",
|
|
5954
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
|
5955
|
-
"unicorn/prefer-includes": "error",
|
|
5956
|
-
"unicorn/prefer-keyboard-event-key": "error",
|
|
5957
|
-
"unicorn/prefer-math-trunc": "error",
|
|
5958
|
-
"unicorn/prefer-modern-dom-apis": "error",
|
|
5959
|
-
"unicorn/prefer-modern-math-apis": "error",
|
|
5960
|
-
"unicorn/prefer-negative-index": "error",
|
|
5961
|
-
"unicorn/prefer-node-protocol": "error",
|
|
5962
|
-
"unicorn/prefer-number-properties": "error",
|
|
5963
|
-
"unicorn/prefer-prototype-methods": "error",
|
|
5964
|
-
"unicorn/prefer-query-selector": "error",
|
|
5965
|
-
"unicorn/prefer-reflect-apply": "error",
|
|
5966
|
-
"unicorn/prefer-regexp-test": "error",
|
|
5967
|
-
"unicorn/prefer-string-replace-all": "error",
|
|
5968
|
-
"unicorn/prefer-string-slice": "error",
|
|
5969
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
5970
|
-
"unicorn/prefer-string-trim-start-end": "error",
|
|
5971
|
-
"unicorn/prefer-type-error": "error",
|
|
5972
|
-
"unicorn/throw-new-error": "error",
|
|
6474
|
+
...unicornSelectedRules(),
|
|
5973
6475
|
...overrides
|
|
5974
6476
|
}
|
|
5975
6477
|
}, {
|
|
@@ -6048,7 +6550,7 @@ const yml = async (options) => {
|
|
|
6048
6550
|
};
|
|
6049
6551
|
//#endregion
|
|
6050
6552
|
//#region src/configs/sort-geojson.ts
|
|
6051
|
-
const sortGeojson =
|
|
6553
|
+
const sortGeojson = () => {
|
|
6052
6554
|
return [{
|
|
6053
6555
|
files: [GLOB_GEOJSON, "!**/*.min.geojson"],
|
|
6054
6556
|
name: "jsse/sort/geojson",
|
|
@@ -12650,6 +13152,7 @@ function defaultOptions() {
|
|
|
12650
13152
|
jsonc: true,
|
|
12651
13153
|
markdown: false,
|
|
12652
13154
|
n: true,
|
|
13155
|
+
nodeTest: false,
|
|
12653
13156
|
off: [],
|
|
12654
13157
|
pnpm: false,
|
|
12655
13158
|
prettier: true,
|
|
@@ -12663,16 +13166,16 @@ function defaultOptions() {
|
|
|
12663
13166
|
sortTsconfig: true,
|
|
12664
13167
|
stylistic: true,
|
|
12665
13168
|
tailwind: false,
|
|
12666
|
-
test: vitestExists,
|
|
12667
13169
|
tsPrefix: "@typescript-eslint",
|
|
12668
13170
|
typeAware: false,
|
|
12669
13171
|
typescript: typescriptExists,
|
|
12670
13172
|
unicorn: true,
|
|
13173
|
+
vitest: vitestExists,
|
|
12671
13174
|
yaml: false
|
|
12672
13175
|
};
|
|
12673
13176
|
}
|
|
12674
13177
|
function normalizeOff(off) {
|
|
12675
|
-
const offArr = [...off instanceof Set ? off : new Set(off)].
|
|
13178
|
+
const offArr = [...off instanceof Set ? off : new Set(off)].toSorted((a, b) => a.localeCompare(b, void 0, {
|
|
12676
13179
|
numeric: true,
|
|
12677
13180
|
sensitivity: "base"
|
|
12678
13181
|
}));
|
|
@@ -12748,6 +13251,17 @@ const FLAT_CFG_PROPS = [
|
|
|
12748
13251
|
"rules",
|
|
12749
13252
|
"settings"
|
|
12750
13253
|
];
|
|
13254
|
+
function getReactRefreshOption(options) {
|
|
13255
|
+
const compatOptions = options;
|
|
13256
|
+
return options.refresh ?? compatOptions.reactRefresh;
|
|
13257
|
+
}
|
|
13258
|
+
async function gitignoreConfig(options) {
|
|
13259
|
+
if (options === false) return [];
|
|
13260
|
+
const flatGitignore = await interopDefault(import("./dist-DS02OtwI.js"));
|
|
13261
|
+
const config = options === true ? flatGitignore() : flatGitignore(options);
|
|
13262
|
+
dbg("Using eslint-config-flat-gitignore: %O", config);
|
|
13263
|
+
return [config];
|
|
13264
|
+
}
|
|
12751
13265
|
/**
|
|
12752
13266
|
* Construct an array of ESLint flat config items.
|
|
12753
13267
|
* @param options Configuration options `@jsse/eslint-config` & ESLint Flat Config
|
|
@@ -12757,30 +13271,26 @@ const FLAT_CFG_PROPS = [
|
|
|
12757
13271
|
async function jsse(options = {}, ...userConfigs) {
|
|
12758
13272
|
const startTime = process$1.hrtime.bigint();
|
|
12759
13273
|
const normalizedOptions = normalizeOptions(options);
|
|
12760
|
-
const { antfu: antfuOptions, command: commandOptions, componentExts, debug = false, demorgan: deMorganOptions, e18e: e18eOptions, gitignore: enableGitignore, isInEditor, javascript: javascriptOptions, jsdoc: jsdocOptions, jsonc: enableJsonc, markdown: enableMarkdown, n: nOptions, off, pnpm: pnpmOptions, prettier: enablePrettier, react: enableReact, regexp: enableRegexp, reportUnusedDisableDirectives, rootId, sortGeojson: enableSortGeojson, sortImports: enableSortImports, sortPackageJson: enableSortPackageJson, sortTsconfig: enableSortTsconfig, stylistic: stylisticOptions, tailwind: tailwindOptions,
|
|
13274
|
+
const { antfu: antfuOptions, command: commandOptions, componentExts, debug = false, demorgan: deMorganOptions, e18e: e18eOptions, gitignore: enableGitignore, isInEditor, javascript: javascriptOptions, jsdoc: jsdocOptions, jsonc: enableJsonc, markdown: enableMarkdown, n: nOptions, nodeTest: nodeTestOptions, off, pnpm: pnpmOptions, prettier: enablePrettier, react: enableReact, regexp: enableRegexp, reportUnusedDisableDirectives, rootId, sortGeojson: enableSortGeojson, sortImports: enableSortImports, sortPackageJson: enableSortPackageJson, sortTsconfig: enableSortTsconfig, stylistic: stylisticOptions, tailwind: tailwindOptions, tsPrefix, typescript: typescriptOptions, unicorn: unicornOptions, vitest: enableVitest, yaml: enableYaml } = normalizedOptions;
|
|
12761
13275
|
if (debug || process$1.argv.includes("--debug")) enableDbg();
|
|
12762
13276
|
dbg("@jsse/eslint-config debug=true");
|
|
12763
13277
|
dbg("@jsse/eslint-config isInEditor: %O", isInEditor);
|
|
12764
13278
|
dbg("@jsse/eslint-config enableTypeScript: %O", typescriptOptions);
|
|
12765
13279
|
dbg("@jsse/eslint-config normalizedOptions: %O", normalizedOptions);
|
|
12766
13280
|
const configs = [];
|
|
12767
|
-
if (enableGitignore)
|
|
12768
|
-
if (fs.existsSync(".gitignore")) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => {
|
|
12769
|
-
const res = r();
|
|
12770
|
-
dbg("Using eslint-config-flat-gitignore res: %O", res);
|
|
12771
|
-
return [res];
|
|
12772
|
-
}));
|
|
12773
|
-
} else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => {
|
|
12774
|
-
dbg("Using eslint-config-flat-gitignore: %O", r);
|
|
12775
|
-
const res = r(enableGitignore);
|
|
12776
|
-
dbg("Using eslint-config-flat-gitignore: %O", res);
|
|
12777
|
-
return [res];
|
|
12778
|
-
}));
|
|
13281
|
+
if (enableGitignore) configs.push(gitignoreConfig(enableGitignore));
|
|
12779
13282
|
configs.push(ignores(), javascript({
|
|
12780
13283
|
isInEditor,
|
|
12781
13284
|
...javascriptOptions,
|
|
12782
13285
|
reportUnusedDisableDirectives
|
|
12783
|
-
}), eslintComments()
|
|
13286
|
+
}), eslintComments());
|
|
13287
|
+
if (nOptions) configs.push(n(typeof nOptions === "object" ? nOptions : void 0));
|
|
13288
|
+
if (jsdocOptions) configs.push(jsdoc(typeof jsdocOptions === "object" ? jsdocOptions : void 0));
|
|
13289
|
+
configs.push(imports({ stylistic: stylisticOptions }));
|
|
13290
|
+
if (unicornOptions) configs.push(unicorn(typeof unicornOptions === "object" ? unicornOptions : {}));
|
|
13291
|
+
if (antfuOptions) configs.push(antfu(typeof antfuOptions === "object" ? antfuOptions : void 0));
|
|
13292
|
+
if (deMorganOptions) configs.push(deMorgan(typeof deMorganOptions === "object" ? deMorganOptions : void 0));
|
|
13293
|
+
if (e18eOptions) configs.push(e18e(typeof e18eOptions === "object" ? e18eOptions : {}));
|
|
12784
13294
|
if (enableSortImports) configs.push(perfectionist());
|
|
12785
13295
|
/**
|
|
12786
13296
|
* =========================================================================
|
|
@@ -12824,17 +13334,18 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12824
13334
|
const ymlConfig = yml(typeof enableYaml === "object" ? enableYaml : void 0);
|
|
12825
13335
|
configs.push(ymlConfig);
|
|
12826
13336
|
}
|
|
12827
|
-
if (enableReact) configs.push(
|
|
13337
|
+
if (enableReact) configs.push(react({
|
|
12828
13338
|
...typeof enableReact === "object" && enableReact,
|
|
12829
|
-
|
|
13339
|
+
refresh: typeof enableReact === "object" && getReactRefreshOption(enableReact) !== void 0 ? getReactRefreshOption(enableReact) : normalizedOptions.reactRefresh !== false
|
|
12830
13340
|
}));
|
|
12831
13341
|
if (enablePrettier) configs.push(prettier());
|
|
12832
13342
|
if (stylisticOptions) configs.push(stylistic(stylisticOptions === true ? {} : stylisticOptions));
|
|
12833
13343
|
if (enableRegexp) configs.push(regexp());
|
|
12834
|
-
if (
|
|
13344
|
+
if (enableVitest) configs.push(vitest({
|
|
12835
13345
|
isInEditor,
|
|
12836
|
-
...typeof
|
|
13346
|
+
...typeof enableVitest === "object" && enableVitest
|
|
12837
13347
|
}), noOnlyTests({ isInEditor }));
|
|
13348
|
+
if (nodeTestOptions) configs.push(nodeTest(typeof nodeTestOptions === "object" ? nodeTestOptions : void 0));
|
|
12838
13349
|
if (enableJsonc) {
|
|
12839
13350
|
configs.push(jsonc({
|
|
12840
13351
|
stylistic: stylisticOptions,
|
|
@@ -12853,7 +13364,11 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12853
13364
|
return acc;
|
|
12854
13365
|
}, {});
|
|
12855
13366
|
if (Object.keys(fusedConfig).length > 0) configs.push([fusedConfig]);
|
|
12856
|
-
|
|
13367
|
+
dbg("ENTER::combining-configs");
|
|
13368
|
+
const combinedConfigs = await combineAsync(...configs, ...userConfigs);
|
|
13369
|
+
dbg("EXIT::combining-configs");
|
|
13370
|
+
dbg("ENTER::post-processing configs");
|
|
13371
|
+
const finalizedConfigs = postProcessConfigs(combinedConfigs, {
|
|
12857
13372
|
componentExts,
|
|
12858
13373
|
debug,
|
|
12859
13374
|
off,
|
|
@@ -12861,6 +13376,7 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12861
13376
|
tsPrefix,
|
|
12862
13377
|
typescript: !!typescriptOptions
|
|
12863
13378
|
});
|
|
13379
|
+
dbg("EXIT::post-processing configs");
|
|
12864
13380
|
if (normalizedOptions.preReturn) {
|
|
12865
13381
|
dbg("Running preReturn");
|
|
12866
13382
|
const res = await normalizedOptions.preReturn(finalizedConfigs);
|