@w5s/eslint-config 7.1.1 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1321 -598
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -109
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/src/config/markdown.ts +57 -11
- package/src/config/regexp.ts +43 -0
- package/src/config.ts +1 -0
- package/src/defineConfig.ts +2 -0
- package/src/typegen/jsdoc.d.ts +37 -1
- package/src/typegen/node.d.ts +1 -1
- package/src/typegen/perfectionist.d.ts +475 -30
- package/src/typegen/react.d.ts +47 -14
- package/src/typegen/regex.d.ts +427 -0
- package/src/typegen/regexp.d.ts +546 -0
- package/src/typegen/ts.d.ts +11 -1
- package/src/typegen/unicorn.d.ts +479 -407
- package/src/typegen/yml.d.ts +16 -0
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import prettierConfig from "@w5s/prettier-config";
|
|
|
3
3
|
import eslintConfig from "@eslint/js";
|
|
4
4
|
import globals from "globals";
|
|
5
5
|
import { eslintIgnores } from "@w5s/eslint-config-ignore";
|
|
6
|
-
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
7
6
|
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
8
|
-
|
|
7
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
8
|
+
import * as yamlParser from "yaml-eslint-parser";
|
|
9
|
+
// src/glob.ts
|
|
9
10
|
const sourceGlob = Project.glob({
|
|
10
11
|
fileExtensions: [Project.sourceExtensions()],
|
|
11
12
|
nested: true
|
|
@@ -38,8 +39,7 @@ const ymlSourceGlob = Project.glob({
|
|
|
38
39
|
fileExtensions: [Project.queryExtensions(["yaml"])],
|
|
39
40
|
nested: true
|
|
40
41
|
});
|
|
41
|
-
|
|
42
|
-
//#region src/type/StylisticConfig.ts
|
|
42
|
+
// src/type/StylisticConfig.ts
|
|
43
43
|
const defaultConfig = {
|
|
44
44
|
enabled: true,
|
|
45
45
|
indent: prettierConfig.tabWidth ?? 2,
|
|
@@ -70,8 +70,7 @@ const StylisticConfig = {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
|
|
74
|
-
//#region src/internal/defaultOptions.ts
|
|
73
|
+
// src/internal/defaultOptions.ts
|
|
75
74
|
/**
|
|
76
75
|
* Return a new plugin option object with default values
|
|
77
76
|
*
|
|
@@ -85,8 +84,7 @@ function defaultPluginOptions(options) {
|
|
|
85
84
|
stylistic: StylisticConfig.from(options.stylistic ?? true)
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
//#region src/internal/withDefaultFiles.ts
|
|
87
|
+
// src/internal/withDefaultFiles.ts
|
|
90
88
|
/**
|
|
91
89
|
* withDefaultFiles
|
|
92
90
|
*
|
|
@@ -97,9 +95,8 @@ function defaultPluginOptions(options) {
|
|
|
97
95
|
function withDefaultFiles(options, defaultFiles) {
|
|
98
96
|
return typeof options === "function" ? options(defaultFiles) : [...options == null ? [] : options.flat(), ...defaultFiles];
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const defaultFiles$12 = [sourceGlob];
|
|
98
|
+
// src/config/e18e.ts
|
|
99
|
+
const defaultFiles$13 = [sourceGlob];
|
|
103
100
|
/**
|
|
104
101
|
* @see https://e18e.dev
|
|
105
102
|
* @param options
|
|
@@ -111,7 +108,7 @@ async function e18e(options = {}) {
|
|
|
111
108
|
name: `${namespace}/e18e/setup`,
|
|
112
109
|
plugins: { e18e: e18ePlugin }
|
|
113
110
|
}, {
|
|
114
|
-
files: withDefaultFiles(files, defaultFiles$
|
|
111
|
+
files: withDefaultFiles(files, defaultFiles$13),
|
|
115
112
|
name: `${namespace}/e18e/rules`,
|
|
116
113
|
rules: {
|
|
117
114
|
...modernization ? e18ePlugin.configs.modernization.rules : {},
|
|
@@ -128,8 +125,7 @@ async function e18e(options = {}) {
|
|
|
128
125
|
}
|
|
129
126
|
}];
|
|
130
127
|
}
|
|
131
|
-
|
|
132
|
-
//#region src/restrictedGlobals.ts
|
|
128
|
+
// src/restrictedGlobals.ts
|
|
133
129
|
/**
|
|
134
130
|
* Default restricted globals used by the ESLint rule no-restricted-globals.
|
|
135
131
|
*
|
|
@@ -142,8 +138,7 @@ const restrictedGlobals = Object.freeze([{
|
|
|
142
138
|
message: "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan",
|
|
143
139
|
name: "isNaN"
|
|
144
140
|
}]);
|
|
145
|
-
|
|
146
|
-
//#region src/restrictedImportPaths.ts
|
|
141
|
+
// src/restrictedImportPaths.ts
|
|
147
142
|
/**
|
|
148
143
|
* This file contains the list of restricted import paths used in the ESLint configuration.
|
|
149
144
|
*
|
|
@@ -191,16 +186,14 @@ const restrictedImportPaths = Object.freeze([
|
|
|
191
186
|
message: "Import from \"rxjs\" or \"rxjs/operators\"."
|
|
192
187
|
}
|
|
193
188
|
]);
|
|
194
|
-
|
|
195
|
-
//#region src/restrictedSyntax.ts
|
|
189
|
+
// src/restrictedSyntax.ts
|
|
196
190
|
/**
|
|
197
191
|
* Default restricted syntax used by the ESLint rule no-restricted-syntax.
|
|
198
192
|
*
|
|
199
193
|
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
200
194
|
*/
|
|
201
195
|
const restrictedSyntax = Object.freeze([]);
|
|
202
|
-
|
|
203
|
-
//#region src/internal/lazy.ts
|
|
196
|
+
// src/internal/lazy.ts
|
|
204
197
|
function lazy(fn) {
|
|
205
198
|
let isSet = false;
|
|
206
199
|
let value;
|
|
@@ -212,8 +205,7 @@ function lazy(fn) {
|
|
|
212
205
|
return value;
|
|
213
206
|
};
|
|
214
207
|
}
|
|
215
|
-
|
|
216
|
-
//#region src/rules/airbnb-base/bestPractices.ts
|
|
208
|
+
// src/rules/airbnb-base/bestPractices.ts
|
|
217
209
|
const bestPractices = () => ({
|
|
218
210
|
"accessor-pairs": "off",
|
|
219
211
|
"array-callback-return": ["error", { allowImplicit: true }],
|
|
@@ -399,8 +391,7 @@ const bestPractices = () => ({
|
|
|
399
391
|
],
|
|
400
392
|
"yoda": "error"
|
|
401
393
|
});
|
|
402
|
-
|
|
403
|
-
//#region src/rules/airbnb-base/errors.ts
|
|
394
|
+
// src/rules/airbnb-base/errors.ts
|
|
404
395
|
const errors = () => ({
|
|
405
396
|
"for-direction": "error",
|
|
406
397
|
"getter-return": ["error", { allowImplicit: true }],
|
|
@@ -451,8 +442,7 @@ const errors = () => ({
|
|
|
451
442
|
"valid-jsdoc": "off",
|
|
452
443
|
"valid-typeof": ["error", { requireStringLiterals: true }]
|
|
453
444
|
});
|
|
454
|
-
|
|
455
|
-
//#region src/rules/airbnb-base/es6.ts
|
|
445
|
+
// src/rules/airbnb-base/es6.ts
|
|
456
446
|
const es6 = () => ({
|
|
457
447
|
"constructor-super": "error",
|
|
458
448
|
"no-class-assign": "error",
|
|
@@ -487,8 +477,7 @@ const es6 = () => ({
|
|
|
487
477
|
"require-yield": "error",
|
|
488
478
|
"symbol-description": "error"
|
|
489
479
|
});
|
|
490
|
-
|
|
491
|
-
//#region src/rules/airbnb-base/overrides.ts
|
|
480
|
+
// src/rules/airbnb-base/overrides.ts
|
|
492
481
|
const overrides = () => ({
|
|
493
482
|
"class-methods-use-this": "off",
|
|
494
483
|
"default-case": "off",
|
|
@@ -500,11 +489,9 @@ const overrides = () => ({
|
|
|
500
489
|
"no-use-before-define": ["error", "nofunc"],
|
|
501
490
|
"no-void": ["error", { allowAsStatement: true }]
|
|
502
491
|
});
|
|
503
|
-
|
|
504
|
-
//#region src/rules/airbnb-base/strict.ts
|
|
492
|
+
// src/rules/airbnb-base/strict.ts
|
|
505
493
|
const strict = () => ({ strict: ["error", "never"] });
|
|
506
|
-
|
|
507
|
-
//#region src/rules/airbnb-base/variables.ts
|
|
494
|
+
// src/rules/airbnb-base/variables.ts
|
|
508
495
|
const variables = () => ({
|
|
509
496
|
"init-declarations": "off",
|
|
510
497
|
"no-catch-shadow": "off",
|
|
@@ -537,8 +524,7 @@ const variables = () => ({
|
|
|
537
524
|
variables: true
|
|
538
525
|
}]
|
|
539
526
|
});
|
|
540
|
-
|
|
541
|
-
//#region src/rules/esRules.ts
|
|
527
|
+
// src/rules/esRules.ts
|
|
542
528
|
const esRules = lazy(() => ({
|
|
543
529
|
...bestPractices(),
|
|
544
530
|
...errors(),
|
|
@@ -547,9 +533,8 @@ const esRules = lazy(() => ({
|
|
|
547
533
|
...variables(),
|
|
548
534
|
...overrides()
|
|
549
535
|
}));
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
const defaultFiles$11 = [jsSourceGlob];
|
|
536
|
+
// src/config/es.ts
|
|
537
|
+
const defaultFiles$12 = [jsSourceGlob];
|
|
553
538
|
async function es(options) {
|
|
554
539
|
const { defaultRestrictedGlobals = restrictedGlobals, defaultRestrictedImportPaths = restrictedImportPaths, defaultRestrictedSyntax = restrictedSyntax, namespace, recommended, restrictedImportPaths: paths, rules = {} } = defaultPluginOptions(options);
|
|
555
540
|
const resolvedGlobals = typeof options.restrictedGlobals === "function" ? options.restrictedGlobals(defaultRestrictedGlobals) : options.restrictedGlobals ?? defaultRestrictedGlobals;
|
|
@@ -590,7 +575,7 @@ async function es(options) {
|
|
|
590
575
|
}
|
|
591
576
|
},
|
|
592
577
|
{
|
|
593
|
-
files: defaultFiles$
|
|
578
|
+
files: defaultFiles$12,
|
|
594
579
|
name: `${namespace}/es/rules`,
|
|
595
580
|
rules: {
|
|
596
581
|
...recommended ? es.recommended : {},
|
|
@@ -606,8 +591,7 @@ es.recommended = {
|
|
|
606
591
|
...eslintConfig.configs.recommended.rules,
|
|
607
592
|
...esRules()
|
|
608
593
|
};
|
|
609
|
-
|
|
610
|
-
//#region src/config/github-actions.ts
|
|
594
|
+
// src/config/github-actions.ts
|
|
611
595
|
const fallbackFiles = [
|
|
612
596
|
".github/workflows/*.{yml,yaml}",
|
|
613
597
|
"**/action.{yml,yaml}",
|
|
@@ -636,13 +620,11 @@ async function githubActions(options = {}) {
|
|
|
636
620
|
}
|
|
637
621
|
}];
|
|
638
622
|
}
|
|
639
|
-
|
|
640
|
-
//#region src/config/ignores.ts
|
|
623
|
+
// src/config/ignores.ts
|
|
641
624
|
async function ignores(options = {}) {
|
|
642
625
|
return [await eslintIgnores(options)];
|
|
643
626
|
}
|
|
644
|
-
|
|
645
|
-
//#region src/config/imports.ts
|
|
627
|
+
// src/config/imports.ts
|
|
646
628
|
async function imports(options = {}) {
|
|
647
629
|
const { namespace, recommended, rules = {}, stylistic } = defaultPluginOptions(options);
|
|
648
630
|
const [importPlugin] = await Promise.all([interopDefault(import("eslint-plugin-import"))]);
|
|
@@ -671,8 +653,7 @@ imports.recommended = {
|
|
|
671
653
|
* Stylistic rules
|
|
672
654
|
*/
|
|
673
655
|
imports.stylistic = { "import/newline-after-import": ["error", { count: 1 }] };
|
|
674
|
-
|
|
675
|
-
//#region src/config/jsdoc.ts
|
|
656
|
+
// src/config/jsdoc.ts
|
|
676
657
|
const defaultJsFiles = [jsSourceGlob];
|
|
677
658
|
const defaultTsFiles = [tsSourceGlob];
|
|
678
659
|
async function jsdoc(options = {}) {
|
|
@@ -737,8 +718,7 @@ async function jsdoc(options = {}) {
|
|
|
737
718
|
}
|
|
738
719
|
];
|
|
739
720
|
}
|
|
740
|
-
|
|
741
|
-
//#region src/internal/withSchema.ts
|
|
721
|
+
// src/internal/withSchema.ts
|
|
742
722
|
async function withSchema(options) {
|
|
743
723
|
const enabled = typeof options === "boolean" ? options : options?.enabled ?? true;
|
|
744
724
|
return {
|
|
@@ -746,9 +726,8 @@ async function withSchema(options) {
|
|
|
746
726
|
rules: enabled ? { "schema/no-invalid": "error" } : {}
|
|
747
727
|
};
|
|
748
728
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const defaultFiles$10 = [jsonSourceGlob];
|
|
729
|
+
// src/config/jsonc.ts
|
|
730
|
+
const defaultFiles$11 = [jsonSourceGlob];
|
|
752
731
|
async function jsonc(options = {}) {
|
|
753
732
|
const [jsoncPlugin, jsoncParser] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
|
|
754
733
|
const { files, namespace, recommended, rules = {}, stylistic } = defaultPluginOptions(options);
|
|
@@ -762,7 +741,7 @@ async function jsonc(options = {}) {
|
|
|
762
741
|
}
|
|
763
742
|
},
|
|
764
743
|
{
|
|
765
|
-
files: withDefaultFiles(files, defaultFiles$
|
|
744
|
+
files: withDefaultFiles(files, defaultFiles$11),
|
|
766
745
|
languageOptions: { parser: jsoncParser },
|
|
767
746
|
name: `${namespace}/jsonc/rules`,
|
|
768
747
|
rules: {
|
|
@@ -990,9 +969,8 @@ function sortTsconfigJson(namespace) {
|
|
|
990
969
|
] }
|
|
991
970
|
};
|
|
992
971
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
const defaultFiles$9 = [jsxSourceGlob];
|
|
972
|
+
// src/config/jsx.ts
|
|
973
|
+
const defaultFiles$10 = [jsxSourceGlob];
|
|
996
974
|
async function jsx(options = {}) {
|
|
997
975
|
const { files, jsxA11y = false, namespace, recommended, rules = {} } = defaultPluginOptions(options);
|
|
998
976
|
const [jsxA11yPlugin] = await Promise.all([jsxA11y ? interopDefault(import("eslint-plugin-jsx-a11y")) : void 0]);
|
|
@@ -1004,7 +982,7 @@ async function jsx(options = {}) {
|
|
|
1004
982
|
name: `${namespace}/jsx/setup`,
|
|
1005
983
|
plugins: { ...jsxA11yPlugin ? { "jsx-a11y": jsxA11yPlugin } : {} }
|
|
1006
984
|
}, {
|
|
1007
|
-
files: withDefaultFiles(files, defaultFiles$
|
|
985
|
+
files: withDefaultFiles(files, defaultFiles$10),
|
|
1008
986
|
name: `${namespace}/jsx/rules`,
|
|
1009
987
|
rules: {
|
|
1010
988
|
...recommended && jsxA11yPlugin != null ? jsxA11yPlugin.configs.recommended.rules : {},
|
|
@@ -1012,8 +990,7 @@ async function jsx(options = {}) {
|
|
|
1012
990
|
}
|
|
1013
991
|
}];
|
|
1014
992
|
}
|
|
1015
|
-
|
|
1016
|
-
//#region src/rules/looseRules.ts
|
|
993
|
+
// src/rules/looseRules.ts
|
|
1017
994
|
const looseRules = lazy(() => {
|
|
1018
995
|
return Object.assign(ESLintConfig.renameRules(tsPlugin.configs["disable-type-checked"].rules, { "@typescript-eslint": "ts" }), {
|
|
1019
996
|
"e18e/prefer-static-regex": "off",
|
|
@@ -1033,36 +1010,61 @@ const looseRules = lazy(() => {
|
|
|
1033
1010
|
"ts/unbound-method": "off"
|
|
1034
1011
|
});
|
|
1035
1012
|
});
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
const defaultFiles$8 = [Project.glob({
|
|
1013
|
+
// src/config/markdown.ts
|
|
1014
|
+
const defaultFiles$9 = [Project.glob({
|
|
1039
1015
|
fileExtensions: [Project.queryExtensions(["markdown"])],
|
|
1040
1016
|
nested: true
|
|
1041
1017
|
})];
|
|
1042
1018
|
async function markdown(options = {}) {
|
|
1043
1019
|
const [markdownPlugin] = await Promise.all([interopDefault(import("@eslint/markdown"))]);
|
|
1044
|
-
const { files, language = "markdown/gfm", languageOptions, namespace, recommended, rules = {}, stylistic } = defaultPluginOptions(options);
|
|
1045
|
-
const
|
|
1020
|
+
const { files, language = "markdown/gfm", languageOptions, namespace, recommended, rules: allRules = {}, stylistic } = defaultPluginOptions(options);
|
|
1021
|
+
const { rules, schemaRules } = splitSchemaRules(allRules);
|
|
1022
|
+
const resolvedFiles = withDefaultFiles(files, defaultFiles$9);
|
|
1023
|
+
const schemaConfig = await withSchema(options.schema);
|
|
1024
|
+
const resolvedLanguageOptions = {
|
|
1025
|
+
frontmatter: "yaml",
|
|
1026
|
+
...languageOptions
|
|
1027
|
+
};
|
|
1028
|
+
const frontmatterSchemaEnabled = Object.keys(schemaConfig.rules).length > 0 && resolvedLanguageOptions.frontmatter === "yaml";
|
|
1046
1029
|
return [
|
|
1047
1030
|
{
|
|
1048
1031
|
name: `${namespace}/markdown/setup`,
|
|
1049
|
-
plugins: {
|
|
1032
|
+
plugins: {
|
|
1033
|
+
markdown: markdownPlugin,
|
|
1034
|
+
...schemaConfig.plugins
|
|
1035
|
+
}
|
|
1050
1036
|
},
|
|
1051
1037
|
{
|
|
1052
1038
|
files: resolvedFiles,
|
|
1053
1039
|
language,
|
|
1054
|
-
languageOptions:
|
|
1055
|
-
frontmatter: "yaml",
|
|
1056
|
-
...languageOptions
|
|
1057
|
-
},
|
|
1040
|
+
languageOptions: resolvedLanguageOptions,
|
|
1058
1041
|
name: `${namespace}/markdown/rules`,
|
|
1059
|
-
processor: mergeProcessors([
|
|
1042
|
+
processor: mergeProcessors([
|
|
1043
|
+
markdownPlugin.processors.markdown,
|
|
1044
|
+
...frontmatterSchemaEnabled ? [schemaConfig.plugins.schema.processors.frontmatter] : [],
|
|
1045
|
+
processorPassThrough
|
|
1046
|
+
]),
|
|
1060
1047
|
rules: {
|
|
1061
1048
|
...recommended ? markdownPlugin.configs.recommended.at(0)?.rules : {},
|
|
1049
|
+
...recommended ? { "markdown/no-multiple-h1": ["error", { frontmatterTitle: "" }] } : {},
|
|
1062
1050
|
...stylistic.enabled ? {} : {},
|
|
1063
1051
|
...rules
|
|
1064
1052
|
}
|
|
1065
1053
|
},
|
|
1054
|
+
{
|
|
1055
|
+
files: resolvedFiles.map((f) => `${f}/**/*.frontmatter.yaml`),
|
|
1056
|
+
languageOptions: { parser: yamlParser },
|
|
1057
|
+
name: `${namespace}/markdown/frontmatter`,
|
|
1058
|
+
rules: frontmatterSchemaEnabled ? {
|
|
1059
|
+
"no-irregular-whitespace": "off",
|
|
1060
|
+
"no-unused-vars": "off",
|
|
1061
|
+
"spaced-comment": "off",
|
|
1062
|
+
"style/eol-last": "off",
|
|
1063
|
+
"style/no-multiple-empty-lines": "off",
|
|
1064
|
+
...schemaConfig.rules,
|
|
1065
|
+
...schemaRules
|
|
1066
|
+
} : {}
|
|
1067
|
+
},
|
|
1066
1068
|
{
|
|
1067
1069
|
files: resolvedFiles.map((f) => `${f}/${sourceGlob}`),
|
|
1068
1070
|
languageOptions: { parserOptions: {
|
|
@@ -1071,7 +1073,6 @@ async function markdown(options = {}) {
|
|
|
1071
1073
|
} },
|
|
1072
1074
|
name: `${namespace}/markdown/embed-code`,
|
|
1073
1075
|
rules: {
|
|
1074
|
-
"markdown/no-multiple-h1": ["error", { frontmatterTitle: "" }],
|
|
1075
1076
|
...looseRules(),
|
|
1076
1077
|
"no-alert": "off",
|
|
1077
1078
|
"no-console": "off",
|
|
@@ -1096,9 +1097,17 @@ async function markdown(options = {}) {
|
|
|
1096
1097
|
}
|
|
1097
1098
|
];
|
|
1098
1099
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
const
|
|
1100
|
+
function splitSchemaRules(allRules) {
|
|
1101
|
+
const rules = {};
|
|
1102
|
+
const schemaRules = {};
|
|
1103
|
+
for (const [name, value] of Object.entries(allRules)) (name.startsWith("schema/") ? schemaRules : rules)[name] = value;
|
|
1104
|
+
return {
|
|
1105
|
+
rules,
|
|
1106
|
+
schemaRules
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
// src/config/next.ts
|
|
1110
|
+
const defaultFiles$8 = [sourceGlob];
|
|
1102
1111
|
async function next(options = {}) {
|
|
1103
1112
|
const [nextPlugin] = await Promise.all([interopDefault(import("@next/eslint-plugin-next"))]);
|
|
1104
1113
|
const { files, recommended, rules = {} } = options;
|
|
@@ -1106,7 +1115,7 @@ async function next(options = {}) {
|
|
|
1106
1115
|
name: "w5s/next/setup",
|
|
1107
1116
|
plugins: { next: nextPlugin }
|
|
1108
1117
|
}, {
|
|
1109
|
-
files: withDefaultFiles(files, defaultFiles$
|
|
1118
|
+
files: withDefaultFiles(files, defaultFiles$8),
|
|
1110
1119
|
languageOptions: {
|
|
1111
1120
|
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
1112
1121
|
sourceType: "module"
|
|
@@ -1120,8 +1129,7 @@ async function next(options = {}) {
|
|
|
1120
1129
|
settings: { react: { version: "detect" } }
|
|
1121
1130
|
}];
|
|
1122
1131
|
}
|
|
1123
|
-
|
|
1124
|
-
//#region src/config/node.ts
|
|
1132
|
+
// src/config/node.ts
|
|
1125
1133
|
async function node(options = {}) {
|
|
1126
1134
|
const [nodePlugin] = await Promise.all([interopDefault(import("eslint-plugin-n"))]);
|
|
1127
1135
|
const { namespace, recommended, rules = {} } = defaultPluginOptions(options);
|
|
@@ -1146,9 +1154,8 @@ async function node(options = {}) {
|
|
|
1146
1154
|
}
|
|
1147
1155
|
}];
|
|
1148
1156
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
const defaultFiles$6 = [sourceGlob];
|
|
1157
|
+
// src/config/perfectionist.ts
|
|
1158
|
+
const defaultFiles$7 = [sourceGlob];
|
|
1152
1159
|
async function perfectionist(options = {}) {
|
|
1153
1160
|
const [perfectionistPlugin] = await Promise.all([interopDefault(import("eslint-plugin-perfectionist"))]);
|
|
1154
1161
|
const { files, namespace, recommended, rules = {}, stylistic } = defaultPluginOptions(options);
|
|
@@ -1156,7 +1163,7 @@ async function perfectionist(options = {}) {
|
|
|
1156
1163
|
name: `${namespace}/perfectionist/setup`,
|
|
1157
1164
|
plugins: { perfectionist: perfectionistPlugin }
|
|
1158
1165
|
}, {
|
|
1159
|
-
files: withDefaultFiles(files, defaultFiles$
|
|
1166
|
+
files: withDefaultFiles(files, defaultFiles$7),
|
|
1160
1167
|
name: `${namespace}/perfectionist/rules`,
|
|
1161
1168
|
rules: {
|
|
1162
1169
|
...recommended ? perfectionistPlugin.configs["recommended-natural"].rules : {},
|
|
@@ -1165,9 +1172,8 @@ async function perfectionist(options = {}) {
|
|
|
1165
1172
|
}
|
|
1166
1173
|
}];
|
|
1167
1174
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
const defaultFiles$5 = [sourceGlob];
|
|
1175
|
+
// src/config/react.ts
|
|
1176
|
+
const defaultFiles$6 = [sourceGlob];
|
|
1171
1177
|
async function react(options = {}) {
|
|
1172
1178
|
const [reactPlugin] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin"))]);
|
|
1173
1179
|
const { files, namespace, recommended, rules = {} } = defaultPluginOptions(options);
|
|
@@ -1175,7 +1181,7 @@ async function react(options = {}) {
|
|
|
1175
1181
|
name: `${namespace}/react/setup`,
|
|
1176
1182
|
plugins: { react: reactPlugin }
|
|
1177
1183
|
}, {
|
|
1178
|
-
files: withDefaultFiles(files, defaultFiles$
|
|
1184
|
+
files: withDefaultFiles(files, defaultFiles$6),
|
|
1179
1185
|
languageOptions: {
|
|
1180
1186
|
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
1181
1187
|
sourceType: "module"
|
|
@@ -1187,8 +1193,25 @@ async function react(options = {}) {
|
|
|
1187
1193
|
}
|
|
1188
1194
|
}];
|
|
1189
1195
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1196
|
+
// src/config/regexp.ts
|
|
1197
|
+
const defaultFiles$5 = [sourceGlob];
|
|
1198
|
+
async function regexp(options = {}) {
|
|
1199
|
+
const regexPlugin = await interopDefault(import("eslint-plugin-regexp"));
|
|
1200
|
+
const { files, namespace, recommended, rules = {}, stylistic } = defaultPluginOptions(options);
|
|
1201
|
+
return [{
|
|
1202
|
+
name: `${namespace}/regexp/setup`,
|
|
1203
|
+
plugins: { regex: regexPlugin }
|
|
1204
|
+
}, {
|
|
1205
|
+
files: withDefaultFiles(files, defaultFiles$5),
|
|
1206
|
+
name: `${namespace}/regexp/rules`,
|
|
1207
|
+
rules: {
|
|
1208
|
+
...recommended ? regexPlugin.configs?.["flat/recommended"]?.rules ?? {} : {},
|
|
1209
|
+
...stylistic ? {} : {},
|
|
1210
|
+
...rules
|
|
1211
|
+
}
|
|
1212
|
+
}];
|
|
1213
|
+
}
|
|
1214
|
+
// src/config/stylistic.ts
|
|
1192
1215
|
async function stylistic(options = {}) {
|
|
1193
1216
|
const [stylisticPlugin] = await Promise.all([interopDefault(import("@stylistic/eslint-plugin"))]);
|
|
1194
1217
|
const { namespace, rules = {} } = defaultPluginOptions(options);
|
|
@@ -1234,8 +1257,7 @@ async function stylistic(options = {}) {
|
|
|
1234
1257
|
}
|
|
1235
1258
|
}];
|
|
1236
1259
|
}
|
|
1237
|
-
|
|
1238
|
-
//#region src/config/test.ts
|
|
1260
|
+
// src/config/test.ts
|
|
1239
1261
|
const defaultFiles$4 = Project.extensionsToTestGlob(Project.sourceExtensions());
|
|
1240
1262
|
async function test(options = {}) {
|
|
1241
1263
|
const [vitestPlugin] = await Promise.all([interopDefault(import("@vitest/eslint-plugin"))]);
|
|
@@ -1258,8 +1280,7 @@ async function test(options = {}) {
|
|
|
1258
1280
|
}
|
|
1259
1281
|
}];
|
|
1260
1282
|
}
|
|
1261
|
-
|
|
1262
|
-
//#region src/config/toml.ts
|
|
1283
|
+
// src/config/toml.ts
|
|
1263
1284
|
const defaultFiles$3 = [tomlSourceGlob];
|
|
1264
1285
|
async function toml(options = {}) {
|
|
1265
1286
|
const tomlPlugin = await interopDefault(import("eslint-plugin-toml"));
|
|
@@ -1293,8 +1314,7 @@ async function toml(options = {}) {
|
|
|
1293
1314
|
}
|
|
1294
1315
|
}];
|
|
1295
1316
|
}
|
|
1296
|
-
|
|
1297
|
-
//#region src/rules/tsRules.ts
|
|
1317
|
+
// src/rules/tsRules.ts
|
|
1298
1318
|
const tsRules = lazy(() => {
|
|
1299
1319
|
const baseRules = esRules();
|
|
1300
1320
|
return ESLintConfig.renameRules({
|
|
@@ -1334,8 +1354,7 @@ const tsRules = lazy(() => {
|
|
|
1334
1354
|
"@typescript-eslint/triple-slash-reference": "error"
|
|
1335
1355
|
}, { "@typescript-eslint": "ts" });
|
|
1336
1356
|
});
|
|
1337
|
-
|
|
1338
|
-
//#region src/config/ts.ts
|
|
1357
|
+
// src/config/ts.ts
|
|
1339
1358
|
const tsRenameMap = { "@typescript-eslint": "ts" };
|
|
1340
1359
|
const defaultFiles$2 = [tsSourceGlob];
|
|
1341
1360
|
async function ts(options = {}) {
|
|
@@ -1399,8 +1418,7 @@ async function ts(options = {}) {
|
|
|
1399
1418
|
}
|
|
1400
1419
|
}];
|
|
1401
1420
|
}
|
|
1402
|
-
|
|
1403
|
-
//#region src/config/unicorn.ts
|
|
1421
|
+
// src/config/unicorn.ts
|
|
1404
1422
|
const defaultFiles$1 = [sourceGlob];
|
|
1405
1423
|
async function unicorn(options = {}) {
|
|
1406
1424
|
const [unicornPlugin] = await Promise.all([interopDefault(import("eslint-plugin-unicorn"))]);
|
|
@@ -1438,8 +1456,7 @@ async function unicorn(options = {}) {
|
|
|
1438
1456
|
}
|
|
1439
1457
|
];
|
|
1440
1458
|
}
|
|
1441
|
-
|
|
1442
|
-
//#region src/config/unused-imports.ts
|
|
1459
|
+
// src/config/unused-imports.ts
|
|
1443
1460
|
async function unusedImports(options = {}) {
|
|
1444
1461
|
const [unusedImportPlugin] = await Promise.all([interopDefault(import("eslint-plugin-unused-imports"))]);
|
|
1445
1462
|
const { files = [sourceGlob], namespace, recommended, rules = {} } = defaultPluginOptions(options);
|
|
@@ -1465,8 +1482,7 @@ async function unusedImports(options = {}) {
|
|
|
1465
1482
|
}
|
|
1466
1483
|
}];
|
|
1467
1484
|
}
|
|
1468
|
-
|
|
1469
|
-
//#region src/config/yml.ts
|
|
1485
|
+
// src/config/yml.ts
|
|
1470
1486
|
const defaultFiles = [ymlSourceGlob];
|
|
1471
1487
|
async function yml(options = {}) {
|
|
1472
1488
|
const [ymlPlugin] = await Promise.all([interopDefault(import("eslint-plugin-yml"))]);
|
|
@@ -1513,8 +1529,7 @@ async function yml(options = {}) {
|
|
|
1513
1529
|
}
|
|
1514
1530
|
}];
|
|
1515
1531
|
}
|
|
1516
|
-
|
|
1517
|
-
//#region src/defineConfig.ts
|
|
1532
|
+
// src/defineConfig.ts
|
|
1518
1533
|
async function defineConfig(options = {}) {
|
|
1519
1534
|
const { overrides = [], plugins = {}, rules, todo = [] } = options;
|
|
1520
1535
|
const stylisticOptions = typeof plugins.stylistic === "boolean" ? { enabled: plugins.stylistic } : {
|
|
@@ -1530,16 +1545,14 @@ async function defineConfig(options = {}) {
|
|
|
1530
1545
|
...optionsOrBoolean
|
|
1531
1546
|
});
|
|
1532
1547
|
const includeEnabled = (factory, input) => input.enabled ? [factory(input)] : [];
|
|
1533
|
-
return ESLintConfig.concat(...includeEnabled(ignores, toOption(options)), ...includeEnabled(es, toOption(plugins.es)), ...includeEnabled(ts, toOption(plugins.ts)), ...includeEnabled(e18e, toOption(plugins.e18e)), ...includeEnabled(jsx, toOption(plugins.jsx)), ...includeEnabled(unusedImports, toOption(plugins["unused-imports"])), ...includeEnabled(jsdoc, toOption(plugins.jsdoc)), ...includeEnabled(imports, toOption(plugins.import)), ...includeEnabled(perfectionist, toOption(plugins.perfectionist)), ...includeEnabled(node, toOption(plugins.node)), ...includeEnabled(next, toOption(plugins.next, false)), ...includeEnabled(react, toOption(plugins.react)), ...includeEnabled(unicorn, toOption(plugins.unicorn)), ...includeEnabled(test, toOption(plugins.test)), ...includeEnabled(stylistic, stylisticOptions), ...includeEnabled(jsonc, toOption(plugins.jsonc)), ...includeEnabled(toml, toOption(plugins.toml)), ...includeEnabled(markdown, toOption(plugins.markdown)), ...includeEnabled(yml, toOption(plugins.yml)), ...includeEnabled(githubActions, toOption(plugins["github-actions"])), ...rules ? [{ rules }] : [], ...todo, ...overrides);
|
|
1548
|
+
return ESLintConfig.concat(...includeEnabled(ignores, toOption(options)), ...includeEnabled(es, toOption(plugins.es)), ...includeEnabled(ts, toOption(plugins.ts)), ...includeEnabled(e18e, toOption(plugins.e18e)), ...includeEnabled(jsx, toOption(plugins.jsx)), ...includeEnabled(unusedImports, toOption(plugins["unused-imports"])), ...includeEnabled(jsdoc, toOption(plugins.jsdoc)), ...includeEnabled(imports, toOption(plugins.import)), ...includeEnabled(perfectionist, toOption(plugins.perfectionist)), ...includeEnabled(node, toOption(plugins.node)), ...includeEnabled(next, toOption(plugins.next, false)), ...includeEnabled(react, toOption(plugins.react)), ...includeEnabled(regexp, toOption(plugins.regexp, false)), ...includeEnabled(unicorn, toOption(plugins.unicorn)), ...includeEnabled(test, toOption(plugins.test)), ...includeEnabled(stylistic, stylisticOptions), ...includeEnabled(jsonc, toOption(plugins.jsonc)), ...includeEnabled(toml, toOption(plugins.toml)), ...includeEnabled(markdown, toOption(plugins.markdown)), ...includeEnabled(yml, toOption(plugins.yml)), ...includeEnabled(githubActions, toOption(plugins["github-actions"])), ...rules ? [{ rules }] : [], ...todo, ...overrides);
|
|
1534
1549
|
}
|
|
1535
|
-
|
|
1536
|
-
//#region src/meta.ts
|
|
1550
|
+
// src/meta.ts
|
|
1537
1551
|
const meta = Object.freeze({
|
|
1538
|
-
buildNumber:
|
|
1552
|
+
buildNumber: 0x6b04cca5,
|
|
1539
1553
|
name: "@w5s/eslint-config",
|
|
1540
|
-
version: "7.
|
|
1554
|
+
version: "7.2.0"
|
|
1541
1555
|
});
|
|
1542
|
-
|
|
1543
|
-
export { StylisticConfig, defineConfig, e18e, es, githubActions, ignores, imports, jsdoc, jsonc, jsx, markdown, meta, next, node, perfectionist, react, restrictedGlobals, restrictedImportPaths, restrictedSyntax, stylistic, test, toml, ts, unicorn, unusedImports, yml };
|
|
1556
|
+
export { StylisticConfig, defineConfig, e18e, es, githubActions, ignores, imports, jsdoc, jsonc, jsx, markdown, meta, next, node, perfectionist, react, regexp, restrictedGlobals, restrictedImportPaths, restrictedSyntax, stylistic, test, toml, ts, unicorn, unusedImports, yml };
|
|
1544
1557
|
|
|
1545
1558
|
//# sourceMappingURL=index.js.map
|