@debbl/eslint-config 1.1.1 → 1.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.cjs +214 -190
- package/dist/index.d.cts +24 -50
- package/dist/index.d.ts +24 -50
- package/dist/index.js +216 -168
- package/package.json +23 -16
package/dist/index.js
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
// src/plugins.ts
|
|
2
|
-
import { default as default2 } from "eslint-plugin-antfu";
|
|
3
|
-
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
4
|
-
import * as pluginImport from "eslint-plugin-i";
|
|
5
|
-
import { default as default4 } from "eslint-plugin-jsdoc";
|
|
6
|
-
import { default as default5 } from "eslint-plugin-markdown";
|
|
7
|
-
import { default as default6 } from "eslint-plugin-n";
|
|
8
|
-
import { default as default7 } from "eslint-plugin-unicorn";
|
|
9
|
-
import { default as default8 } from "eslint-plugin-unused-imports";
|
|
10
|
-
import { default as default9 } from "eslint-plugin-no-only-tests";
|
|
11
|
-
import { default as default10 } from "eslint-plugin-vitest";
|
|
12
|
-
import { default as default11 } from "eslint-plugin-perfectionist";
|
|
13
|
-
import { default as default12 } from "eslint-plugin-prettier";
|
|
14
|
-
import { default as default13 } from "eslint-config-prettier";
|
|
15
|
-
import { default as default14 } from "eslint-plugin-react";
|
|
16
|
-
import { default as default15 } from "eslint-plugin-react-hooks";
|
|
17
|
-
import { default as default16 } from "@next/eslint-plugin-next";
|
|
18
|
-
import * as parserTs from "@typescript-eslint/parser";
|
|
19
|
-
import { default as default17 } from "@typescript-eslint/eslint-plugin";
|
|
20
|
-
import { default as default18 } from "eslint-plugin-vue";
|
|
21
|
-
import { default as default19 } from "vue-eslint-parser";
|
|
22
|
-
import * as pluginYml from "eslint-plugin-yml";
|
|
23
|
-
import { default as default20 } from "yaml-eslint-parser";
|
|
24
|
-
import * as pluginJsonc from "eslint-plugin-jsonc";
|
|
25
|
-
import { default as default21 } from "jsonc-eslint-parser";
|
|
26
|
-
import { default as default22 } from "eslint-plugin-tailwindcss";
|
|
27
|
-
|
|
28
1
|
// src/configs/comments.ts
|
|
29
|
-
function comments() {
|
|
2
|
+
async function comments() {
|
|
3
|
+
const pluginComments = await interopDefault(
|
|
4
|
+
// @ts-expect-error missing types
|
|
5
|
+
import("eslint-plugin-eslint-comments")
|
|
6
|
+
);
|
|
30
7
|
return [
|
|
31
8
|
{
|
|
32
9
|
name: "eslint:eslint-comments",
|
|
33
10
|
plugins: {
|
|
34
|
-
"eslint-comments":
|
|
11
|
+
"eslint-comments": pluginComments
|
|
35
12
|
},
|
|
36
13
|
rules: {
|
|
37
14
|
"eslint-comments/no-aggregating-enable": "error",
|
|
@@ -113,7 +90,7 @@ var GLOB_EXCLUDE = [
|
|
|
113
90
|
// src/configs/ignores.ts
|
|
114
91
|
var REGEX_SPLIT_ALL_CRLF = /\r?\n/g;
|
|
115
92
|
var splitPattern = (pattern) => pattern.split(REGEX_SPLIT_ALL_CRLF);
|
|
116
|
-
function ignores(options) {
|
|
93
|
+
async function ignores(options) {
|
|
117
94
|
const { enableGitignore } = options;
|
|
118
95
|
if (enableGitignore) {
|
|
119
96
|
let ignorePath = ".gitignore";
|
|
@@ -138,13 +115,28 @@ function ignores(options) {
|
|
|
138
115
|
];
|
|
139
116
|
}
|
|
140
117
|
|
|
118
|
+
// src/utils.ts
|
|
119
|
+
async function combine(...configs) {
|
|
120
|
+
const resolved = await Promise.all(configs);
|
|
121
|
+
return resolved.flat();
|
|
122
|
+
}
|
|
123
|
+
async function interopDefault(m) {
|
|
124
|
+
const resolved = await m;
|
|
125
|
+
return resolved.default || resolved;
|
|
126
|
+
}
|
|
127
|
+
|
|
141
128
|
// src/configs/imports.ts
|
|
142
|
-
function imports() {
|
|
129
|
+
async function imports() {
|
|
130
|
+
const [pluginAntfu, pluginImport] = await Promise.all([
|
|
131
|
+
interopDefault(import("eslint-plugin-antfu")),
|
|
132
|
+
// @ts-expect-error missing types
|
|
133
|
+
interopDefault(import("eslint-plugin-i"))
|
|
134
|
+
]);
|
|
143
135
|
return [
|
|
144
136
|
{
|
|
145
137
|
name: "eslint:imports",
|
|
146
138
|
plugins: {
|
|
147
|
-
antfu:
|
|
139
|
+
antfu: pluginAntfu,
|
|
148
140
|
import: pluginImport
|
|
149
141
|
},
|
|
150
142
|
rules: {
|
|
@@ -168,9 +160,15 @@ function imports() {
|
|
|
168
160
|
|
|
169
161
|
// src/configs/javascript.ts
|
|
170
162
|
import globals from "globals";
|
|
171
|
-
function javascript() {
|
|
163
|
+
async function javascript() {
|
|
164
|
+
const [pluginAntfu, pluginUnusedImports] = await Promise.all([
|
|
165
|
+
interopDefault(import("eslint-plugin-antfu")),
|
|
166
|
+
// @ts-expect-error missing types
|
|
167
|
+
interopDefault(import("eslint-plugin-unused-imports"))
|
|
168
|
+
]);
|
|
172
169
|
return [
|
|
173
170
|
{
|
|
171
|
+
name: "eslint:javascript",
|
|
174
172
|
languageOptions: {
|
|
175
173
|
ecmaVersion: 2022,
|
|
176
174
|
globals: {
|
|
@@ -193,10 +191,9 @@ function javascript() {
|
|
|
193
191
|
linterOptions: {
|
|
194
192
|
reportUnusedDisableDirectives: true
|
|
195
193
|
},
|
|
196
|
-
name: "eslint:javascript",
|
|
197
194
|
plugins: {
|
|
198
|
-
"antfu":
|
|
199
|
-
"unused-imports":
|
|
195
|
+
"antfu": pluginAntfu,
|
|
196
|
+
"unused-imports": pluginUnusedImports
|
|
200
197
|
},
|
|
201
198
|
rules: {
|
|
202
199
|
"accessor-pairs": [
|
|
@@ -408,8 +405,8 @@ function javascript() {
|
|
|
408
405
|
}
|
|
409
406
|
},
|
|
410
407
|
{
|
|
411
|
-
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
412
408
|
name: "eslint:scripts-overrides",
|
|
409
|
+
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
413
410
|
rules: {
|
|
414
411
|
"no-console": "off"
|
|
415
412
|
}
|
|
@@ -418,12 +415,13 @@ function javascript() {
|
|
|
418
415
|
}
|
|
419
416
|
|
|
420
417
|
// src/configs/jsdoc.ts
|
|
421
|
-
function jsdoc() {
|
|
418
|
+
async function jsdoc() {
|
|
422
419
|
return [
|
|
423
420
|
{
|
|
424
421
|
name: "eslint:jsdoc",
|
|
425
422
|
plugins: {
|
|
426
|
-
|
|
423
|
+
// @ts-expect-error missing types
|
|
424
|
+
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
427
425
|
},
|
|
428
426
|
rules: {
|
|
429
427
|
"jsdoc/check-access": "warn",
|
|
@@ -449,7 +447,11 @@ function jsdoc() {
|
|
|
449
447
|
}
|
|
450
448
|
|
|
451
449
|
// src/configs/jsonc.ts
|
|
452
|
-
function jsonc() {
|
|
450
|
+
async function jsonc() {
|
|
451
|
+
const [pluginJsonc, parserJsonc] = await Promise.all([
|
|
452
|
+
interopDefault(import("eslint-plugin-jsonc")),
|
|
453
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
454
|
+
]);
|
|
453
455
|
return [
|
|
454
456
|
{
|
|
455
457
|
name: "eslint:jsonc:setup",
|
|
@@ -458,11 +460,11 @@ function jsonc() {
|
|
|
458
460
|
}
|
|
459
461
|
},
|
|
460
462
|
{
|
|
463
|
+
name: "eslint:jsonc:rules",
|
|
461
464
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
462
465
|
languageOptions: {
|
|
463
|
-
parser:
|
|
466
|
+
parser: parserJsonc
|
|
464
467
|
},
|
|
465
|
-
name: "eslint:jsonc:rules",
|
|
466
468
|
rules: {
|
|
467
469
|
"jsonc/no-bigint-literals": "error",
|
|
468
470
|
"jsonc/no-binary-expression": "error",
|
|
@@ -515,21 +517,23 @@ function jsonc() {
|
|
|
515
517
|
}
|
|
516
518
|
|
|
517
519
|
// src/configs/markdown.ts
|
|
518
|
-
function markdown(options = {}) {
|
|
520
|
+
async function markdown(options = {}) {
|
|
519
521
|
const { componentExts = [] } = options;
|
|
520
522
|
return [
|
|
521
523
|
{
|
|
522
|
-
name: "
|
|
524
|
+
name: "eslint:markdown:setup",
|
|
523
525
|
plugins: {
|
|
524
|
-
|
|
526
|
+
// @ts-expect-error missing types
|
|
527
|
+
markdown: await interopDefault(import("eslint-plugin-markdown"))
|
|
525
528
|
}
|
|
526
529
|
},
|
|
527
530
|
{
|
|
531
|
+
name: "eslint:markdown:processor",
|
|
528
532
|
files: [GLOB_MARKDOWN],
|
|
529
|
-
name: "antfu:markdown:processor",
|
|
530
533
|
processor: "markdown/markdown"
|
|
531
534
|
},
|
|
532
535
|
{
|
|
536
|
+
name: "eslint:markdown:rules",
|
|
533
537
|
files: [
|
|
534
538
|
GLOB_MARKDOWN_CODE,
|
|
535
539
|
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
@@ -541,7 +545,6 @@ function markdown(options = {}) {
|
|
|
541
545
|
}
|
|
542
546
|
}
|
|
543
547
|
},
|
|
544
|
-
name: "antfu:markdown:rules",
|
|
545
548
|
rules: {
|
|
546
549
|
"antfu/no-cjs-exports": "off",
|
|
547
550
|
"antfu/no-ts-export-equal": "off",
|
|
@@ -588,12 +591,13 @@ function markdown(options = {}) {
|
|
|
588
591
|
}
|
|
589
592
|
|
|
590
593
|
// src/configs/node.ts
|
|
591
|
-
function node() {
|
|
594
|
+
async function node() {
|
|
595
|
+
const pluginNode = await interopDefault(import("eslint-plugin-n"));
|
|
592
596
|
return [
|
|
593
597
|
{
|
|
594
598
|
name: "eslint:node",
|
|
595
599
|
plugins: {
|
|
596
|
-
n:
|
|
600
|
+
n: pluginNode
|
|
597
601
|
},
|
|
598
602
|
rules: {
|
|
599
603
|
"n/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -610,11 +614,11 @@ function node() {
|
|
|
610
614
|
}
|
|
611
615
|
|
|
612
616
|
// src/configs/sort.ts
|
|
613
|
-
function sortPackageJson() {
|
|
617
|
+
async function sortPackageJson() {
|
|
614
618
|
return [
|
|
615
619
|
{
|
|
616
|
-
files: ["**/package.json"],
|
|
617
620
|
name: "eslint:sort-package-json",
|
|
621
|
+
files: ["**/package.json"],
|
|
618
622
|
rules: {
|
|
619
623
|
"jsonc/sort-array-values": [
|
|
620
624
|
"error",
|
|
@@ -694,11 +698,11 @@ function sortPackageJson() {
|
|
|
694
698
|
}
|
|
695
699
|
];
|
|
696
700
|
}
|
|
697
|
-
function sortTsconfig() {
|
|
701
|
+
async function sortTsconfig() {
|
|
698
702
|
return [
|
|
699
703
|
{
|
|
700
|
-
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
701
704
|
name: "eslint:sort-tsconfig",
|
|
705
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
702
706
|
rules: {
|
|
703
707
|
"jsonc/sort-keys": [
|
|
704
708
|
"error",
|
|
@@ -822,44 +826,49 @@ function sortTsconfig() {
|
|
|
822
826
|
|
|
823
827
|
// src/configs/typescript.ts
|
|
824
828
|
import process2 from "process";
|
|
825
|
-
|
|
829
|
+
var typeAwareRules = {
|
|
830
|
+
"dot-notation": "off",
|
|
831
|
+
"no-implied-eval": "off",
|
|
832
|
+
"no-throw-literal": "off",
|
|
833
|
+
"@typescript-eslint/await-thenable": "error",
|
|
834
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
835
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
836
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
837
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
838
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
839
|
+
"@typescript-eslint/no-throw-literal": "error",
|
|
840
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
841
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
842
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
843
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
844
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
845
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
846
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
847
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
|
848
|
+
"@typescript-eslint/unbound-method": "error"
|
|
849
|
+
};
|
|
850
|
+
async function typescript(options) {
|
|
826
851
|
const {
|
|
827
852
|
componentExts = [],
|
|
828
853
|
parserOptions = {},
|
|
829
854
|
tsconfigPath
|
|
830
855
|
} = options ?? {};
|
|
831
|
-
const
|
|
832
|
-
"
|
|
833
|
-
"
|
|
834
|
-
"
|
|
835
|
-
|
|
836
|
-
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
837
|
-
"@typescript-eslint/no-floating-promises": "error",
|
|
838
|
-
"@typescript-eslint/no-for-in-array": "error",
|
|
839
|
-
"@typescript-eslint/no-implied-eval": "error",
|
|
840
|
-
"@typescript-eslint/no-misused-promises": "error",
|
|
841
|
-
"@typescript-eslint/no-throw-literal": "error",
|
|
842
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
843
|
-
"@typescript-eslint/no-unsafe-argument": "error",
|
|
844
|
-
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
845
|
-
"@typescript-eslint/no-unsafe-call": "error",
|
|
846
|
-
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
847
|
-
"@typescript-eslint/no-unsafe-return": "error",
|
|
848
|
-
"@typescript-eslint/restrict-plus-operands": "error",
|
|
849
|
-
"@typescript-eslint/restrict-template-expressions": "error",
|
|
850
|
-
"@typescript-eslint/unbound-method": "error"
|
|
851
|
-
};
|
|
856
|
+
const [pluginTs, parserTs, pluginAntfu] = await Promise.all([
|
|
857
|
+
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
858
|
+
interopDefault(import("@typescript-eslint/parser")),
|
|
859
|
+
interopDefault(import("eslint-plugin-antfu"))
|
|
860
|
+
]);
|
|
852
861
|
return [
|
|
853
862
|
{
|
|
854
863
|
// Install the plugins without globs, so they can be configured separately.
|
|
855
864
|
name: "eslint:typescript:setup",
|
|
856
865
|
plugins: {
|
|
857
|
-
"antfu":
|
|
858
|
-
"
|
|
859
|
-
"@typescript-eslint": default17
|
|
866
|
+
"antfu": pluginAntfu,
|
|
867
|
+
"@typescript-eslint": pluginTs
|
|
860
868
|
}
|
|
861
869
|
},
|
|
862
870
|
{
|
|
871
|
+
name: "eslint:typescript:rules",
|
|
863
872
|
files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
864
873
|
languageOptions: {
|
|
865
874
|
parser: parserTs,
|
|
@@ -873,10 +882,9 @@ function typescript(options) {
|
|
|
873
882
|
...parserOptions
|
|
874
883
|
}
|
|
875
884
|
},
|
|
876
|
-
name: "eslint:typescript:rules",
|
|
877
885
|
rules: {
|
|
878
|
-
...
|
|
879
|
-
...
|
|
886
|
+
...pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
887
|
+
...pluginTs.configs.strict.rules,
|
|
880
888
|
"antfu/generic-spacing": "error",
|
|
881
889
|
"antfu/named-tuple-spacing": "error",
|
|
882
890
|
"antfu/no-cjs-exports": "error",
|
|
@@ -926,8 +934,8 @@ function typescript(options) {
|
|
|
926
934
|
}
|
|
927
935
|
},
|
|
928
936
|
{
|
|
929
|
-
files: ["**/*.d.ts"],
|
|
930
937
|
name: "eslint:typescript:dts-overrides",
|
|
938
|
+
files: ["**/*.d.ts"],
|
|
931
939
|
rules: {
|
|
932
940
|
"eslint-comments/no-unlimited-disable": "off",
|
|
933
941
|
"import/no-duplicates": "off",
|
|
@@ -936,8 +944,8 @@ function typescript(options) {
|
|
|
936
944
|
}
|
|
937
945
|
},
|
|
938
946
|
{
|
|
939
|
-
files: ["**/*.{test,spec}.ts?(x)"],
|
|
940
947
|
name: "eslint:typescript:tests-overrides",
|
|
948
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
941
949
|
rules: {
|
|
942
950
|
"no-unused-expressions": "off"
|
|
943
951
|
}
|
|
@@ -954,12 +962,13 @@ function typescript(options) {
|
|
|
954
962
|
}
|
|
955
963
|
|
|
956
964
|
// src/configs/unicorn.ts
|
|
957
|
-
function unicorn() {
|
|
965
|
+
async function unicorn() {
|
|
966
|
+
const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
|
|
958
967
|
return [
|
|
959
968
|
{
|
|
960
969
|
name: "eslint:unicorn",
|
|
961
970
|
plugins: {
|
|
962
|
-
unicorn:
|
|
971
|
+
unicorn: pluginUnicorn
|
|
963
972
|
},
|
|
964
973
|
rules: {
|
|
965
974
|
// Pass error message when throwing errors
|
|
@@ -994,34 +1003,41 @@ function unicorn() {
|
|
|
994
1003
|
}
|
|
995
1004
|
|
|
996
1005
|
// src/configs/vue.ts
|
|
997
|
-
function vue(options = {}) {
|
|
1006
|
+
async function vue(options = {}) {
|
|
1007
|
+
const [pluginVue, parserVue] = await Promise.all([
|
|
1008
|
+
// @ts-expect-error missing types
|
|
1009
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
1010
|
+
interopDefault(import("vue-eslint-parser"))
|
|
1011
|
+
]);
|
|
998
1012
|
return [
|
|
999
1013
|
{
|
|
1000
1014
|
name: "eslint:vue:setup",
|
|
1001
1015
|
plugins: {
|
|
1002
|
-
vue:
|
|
1016
|
+
vue: pluginVue
|
|
1003
1017
|
}
|
|
1004
1018
|
},
|
|
1005
1019
|
{
|
|
1020
|
+
name: "eslint:vue:rules",
|
|
1006
1021
|
files: [GLOB_VUE],
|
|
1007
1022
|
languageOptions: {
|
|
1008
|
-
parser:
|
|
1023
|
+
parser: parserVue,
|
|
1009
1024
|
parserOptions: {
|
|
1010
1025
|
ecmaFeatures: {
|
|
1011
1026
|
jsx: true
|
|
1012
1027
|
},
|
|
1013
1028
|
extraFileExtensions: [".vue"],
|
|
1014
|
-
parser: options.typescript ?
|
|
1029
|
+
parser: options.typescript ? await interopDefault(
|
|
1030
|
+
import("@typescript-eslint/parser")
|
|
1031
|
+
) : null,
|
|
1015
1032
|
sourceType: "module"
|
|
1016
1033
|
}
|
|
1017
1034
|
},
|
|
1018
|
-
|
|
1019
|
-
processor: default18.processors[".vue"],
|
|
1035
|
+
processor: pluginVue.processors[".vue"],
|
|
1020
1036
|
rules: {
|
|
1021
|
-
...
|
|
1022
|
-
...
|
|
1023
|
-
...
|
|
1024
|
-
...
|
|
1037
|
+
...pluginVue.configs.base.rules,
|
|
1038
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1039
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1040
|
+
...pluginVue.configs["vue3-recommended"].rules,
|
|
1025
1041
|
"node/prefer-global/process": "off",
|
|
1026
1042
|
"vue/block-order": [
|
|
1027
1043
|
"error",
|
|
@@ -1127,7 +1143,11 @@ function vue(options = {}) {
|
|
|
1127
1143
|
}
|
|
1128
1144
|
|
|
1129
1145
|
// src/configs/yml.ts
|
|
1130
|
-
function yml() {
|
|
1146
|
+
async function yml() {
|
|
1147
|
+
const [pluginYml, parserYml] = await Promise.all([
|
|
1148
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
1149
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1150
|
+
]);
|
|
1131
1151
|
return [
|
|
1132
1152
|
{
|
|
1133
1153
|
name: "eslint:yaml:setup",
|
|
@@ -1136,11 +1156,11 @@ function yml() {
|
|
|
1136
1156
|
}
|
|
1137
1157
|
},
|
|
1138
1158
|
{
|
|
1159
|
+
name: "eslint:yaml:rules",
|
|
1139
1160
|
files: [GLOB_YAML],
|
|
1140
1161
|
languageOptions: {
|
|
1141
|
-
parser:
|
|
1162
|
+
parser: parserYml
|
|
1142
1163
|
},
|
|
1143
|
-
name: "eslint:yaml:rules",
|
|
1144
1164
|
rules: {
|
|
1145
1165
|
...pluginYml.configs.standard.rules,
|
|
1146
1166
|
...pluginYml.configs.prettier.rules,
|
|
@@ -1158,24 +1178,29 @@ function yml() {
|
|
|
1158
1178
|
}
|
|
1159
1179
|
|
|
1160
1180
|
// src/configs/test.ts
|
|
1161
|
-
function test() {
|
|
1181
|
+
async function test() {
|
|
1182
|
+
const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
|
|
1183
|
+
interopDefault(import("eslint-plugin-vitest")),
|
|
1184
|
+
// @ts-expect-error missing types
|
|
1185
|
+
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1186
|
+
]);
|
|
1162
1187
|
return [
|
|
1163
1188
|
{
|
|
1164
1189
|
name: "eslint:test:setup",
|
|
1165
1190
|
plugins: {
|
|
1166
1191
|
test: {
|
|
1167
|
-
...
|
|
1192
|
+
...pluginVitest,
|
|
1168
1193
|
rules: {
|
|
1169
|
-
...
|
|
1194
|
+
...pluginVitest.rules,
|
|
1170
1195
|
// extend `test/no-only-tests` rule
|
|
1171
|
-
...
|
|
1196
|
+
...pluginNoOnlyTests.rules
|
|
1172
1197
|
}
|
|
1173
1198
|
}
|
|
1174
1199
|
}
|
|
1175
1200
|
},
|
|
1176
1201
|
{
|
|
1177
|
-
files: GLOB_TESTS,
|
|
1178
1202
|
name: "eslint:test:rules",
|
|
1203
|
+
files: GLOB_TESTS,
|
|
1179
1204
|
rules: {
|
|
1180
1205
|
"test/consistent-test-it": [
|
|
1181
1206
|
"error",
|
|
@@ -1191,28 +1216,37 @@ function test() {
|
|
|
1191
1216
|
}
|
|
1192
1217
|
|
|
1193
1218
|
// src/configs/perfectionist.ts
|
|
1194
|
-
function perfectionist() {
|
|
1219
|
+
async function perfectionist() {
|
|
1220
|
+
const pluginPerfectionist = await interopDefault(
|
|
1221
|
+
// @ts-expect-error missing types
|
|
1222
|
+
import("eslint-plugin-perfectionist")
|
|
1223
|
+
);
|
|
1195
1224
|
return [
|
|
1196
1225
|
{
|
|
1197
1226
|
name: "eslint:perfectionist",
|
|
1198
1227
|
plugins: {
|
|
1199
|
-
perfectionist:
|
|
1228
|
+
perfectionist: pluginPerfectionist
|
|
1200
1229
|
}
|
|
1201
1230
|
}
|
|
1202
1231
|
];
|
|
1203
1232
|
}
|
|
1204
1233
|
|
|
1205
1234
|
// src/configs/prettier.ts
|
|
1206
|
-
function prettier(options) {
|
|
1235
|
+
async function prettier(options) {
|
|
1236
|
+
const [pluginPrettier, configPrettier] = await Promise.all([
|
|
1237
|
+
interopDefault(import("eslint-plugin-prettier")),
|
|
1238
|
+
// @ts-expect-error missing types
|
|
1239
|
+
interopDefault(import("eslint-config-prettier"))
|
|
1240
|
+
]);
|
|
1207
1241
|
return [
|
|
1208
1242
|
{
|
|
1209
1243
|
name: "eslint:prettier",
|
|
1210
1244
|
plugins: {
|
|
1211
|
-
prettier:
|
|
1245
|
+
prettier: pluginPrettier
|
|
1212
1246
|
},
|
|
1213
1247
|
rules: {
|
|
1214
|
-
...
|
|
1215
|
-
...
|
|
1248
|
+
...configPrettier.rules,
|
|
1249
|
+
...pluginPrettier.configs.recommended.rules,
|
|
1216
1250
|
"prettier/prettier": [
|
|
1217
1251
|
"warn",
|
|
1218
1252
|
{
|
|
@@ -1225,64 +1259,102 @@ function prettier(options) {
|
|
|
1225
1259
|
];
|
|
1226
1260
|
}
|
|
1227
1261
|
|
|
1228
|
-
// src/utils.ts
|
|
1229
|
-
function combine(...configs) {
|
|
1230
|
-
return configs.flat();
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
1262
|
// src/configs/react.ts
|
|
1234
|
-
function next() {
|
|
1263
|
+
async function next() {
|
|
1264
|
+
const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));
|
|
1235
1265
|
return [
|
|
1236
1266
|
{
|
|
1267
|
+
name: "eslint:next:setup",
|
|
1237
1268
|
plugins: {
|
|
1238
|
-
"@next/next":
|
|
1269
|
+
"@next/next": pluginNext
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
name: "eslint:next:rules",
|
|
1274
|
+
files: [GLOB_TSX, GLOB_JSX],
|
|
1275
|
+
languageOptions: {
|
|
1276
|
+
parserOptions: {
|
|
1277
|
+
sourceType: "module",
|
|
1278
|
+
ecmaFeatures: {
|
|
1279
|
+
jsx: true
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
},
|
|
1283
|
+
settings: {
|
|
1284
|
+
react: {
|
|
1285
|
+
version: "detect"
|
|
1286
|
+
}
|
|
1239
1287
|
},
|
|
1240
1288
|
rules: {
|
|
1241
|
-
...
|
|
1242
|
-
...
|
|
1289
|
+
...pluginNext.configs.recommended.rules,
|
|
1290
|
+
...pluginNext.configs["core-web-vitals"].rules
|
|
1243
1291
|
}
|
|
1244
1292
|
}
|
|
1245
1293
|
];
|
|
1246
1294
|
}
|
|
1247
|
-
function react(options = {}) {
|
|
1295
|
+
async function react(options = {}) {
|
|
1248
1296
|
const { next: enableNext = false } = options;
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1297
|
+
const [pluginReact, pluginReactHooks] = await Promise.all([
|
|
1298
|
+
// @ts-expect-error missing types
|
|
1299
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1300
|
+
// @ts-expect-error missing types
|
|
1301
|
+
interopDefault(import("eslint-plugin-react-hooks"))
|
|
1302
|
+
]);
|
|
1303
|
+
const _react = [
|
|
1304
|
+
{
|
|
1305
|
+
name: "eslint:react:setup",
|
|
1306
|
+
plugins: {
|
|
1307
|
+
"react": pluginReact,
|
|
1308
|
+
"react-hooks": pluginReactHooks
|
|
1258
1309
|
}
|
|
1259
1310
|
},
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1311
|
+
{
|
|
1312
|
+
name: "eslint:react:rules",
|
|
1313
|
+
files: [GLOB_TSX, GLOB_JSX],
|
|
1314
|
+
languageOptions: {
|
|
1315
|
+
parserOptions: {
|
|
1316
|
+
sourceType: "module",
|
|
1317
|
+
ecmaFeatures: {
|
|
1318
|
+
jsx: true
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
settings: {
|
|
1323
|
+
react: {
|
|
1324
|
+
version: "detect"
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
rules: {
|
|
1328
|
+
...pluginReact.configs.recommended.rules,
|
|
1329
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
1330
|
+
"jsx-quotes": ["error", "prefer-double"],
|
|
1331
|
+
"react/react-in-jsx-scope": "off",
|
|
1332
|
+
"react/jsx-indent": [1, 2],
|
|
1333
|
+
"react/jsx-indent-props": [1, 2],
|
|
1334
|
+
"react/jsx-closing-bracket-location": [
|
|
1335
|
+
1,
|
|
1336
|
+
{ selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
|
|
1337
|
+
]
|
|
1338
|
+
}
|
|
1271
1339
|
}
|
|
1272
|
-
|
|
1340
|
+
];
|
|
1273
1341
|
return combine(_react, enableNext ? next() : []);
|
|
1274
1342
|
}
|
|
1275
1343
|
|
|
1276
1344
|
// src/configs/tailwindcss.ts
|
|
1277
|
-
function tailwindcss() {
|
|
1345
|
+
async function tailwindcss() {
|
|
1346
|
+
const pluginTailwindcss = await interopDefault(
|
|
1347
|
+
// @ts-expect-error missing types
|
|
1348
|
+
import("eslint-plugin-tailwindcss")
|
|
1349
|
+
);
|
|
1278
1350
|
return [
|
|
1279
1351
|
{
|
|
1280
1352
|
name: "eslint:tailwindcss",
|
|
1281
1353
|
plugins: {
|
|
1282
|
-
tailwindcss:
|
|
1354
|
+
tailwindcss: pluginTailwindcss
|
|
1283
1355
|
},
|
|
1284
1356
|
rules: {
|
|
1285
|
-
...
|
|
1357
|
+
...pluginTailwindcss.configs.recommended.rules
|
|
1286
1358
|
}
|
|
1287
1359
|
}
|
|
1288
1360
|
];
|
|
@@ -1388,40 +1460,16 @@ export {
|
|
|
1388
1460
|
combine,
|
|
1389
1461
|
comments,
|
|
1390
1462
|
config,
|
|
1391
|
-
default13 as configPrettier,
|
|
1392
1463
|
src_default as default,
|
|
1393
1464
|
ignores,
|
|
1394
1465
|
imports,
|
|
1466
|
+
interopDefault,
|
|
1395
1467
|
javascript,
|
|
1396
1468
|
jsdoc,
|
|
1397
1469
|
jsonc,
|
|
1398
1470
|
markdown,
|
|
1399
1471
|
node,
|
|
1400
|
-
default21 as parserJsonc,
|
|
1401
|
-
parserTs,
|
|
1402
|
-
default19 as parserVue,
|
|
1403
|
-
default20 as parserYml,
|
|
1404
1472
|
perfectionist,
|
|
1405
|
-
default2 as pluginAntfu,
|
|
1406
|
-
default3 as pluginComments,
|
|
1407
|
-
pluginImport,
|
|
1408
|
-
default4 as pluginJsdoc,
|
|
1409
|
-
pluginJsonc,
|
|
1410
|
-
default5 as pluginMarkdown,
|
|
1411
|
-
default16 as pluginNext,
|
|
1412
|
-
default9 as pluginNoOnlyTests,
|
|
1413
|
-
default6 as pluginNode,
|
|
1414
|
-
default11 as pluginPerfectionist,
|
|
1415
|
-
default12 as pluginPrettier,
|
|
1416
|
-
default14 as pluginReact,
|
|
1417
|
-
default15 as pluginReactHooks,
|
|
1418
|
-
default22 as pluginTailwindcss,
|
|
1419
|
-
default17 as pluginTs,
|
|
1420
|
-
default7 as pluginUnicorn,
|
|
1421
|
-
default8 as pluginUnusedImports,
|
|
1422
|
-
default10 as pluginVitest,
|
|
1423
|
-
default18 as pluginVue,
|
|
1424
|
-
pluginYml,
|
|
1425
1473
|
prettier,
|
|
1426
1474
|
sortPackageJson,
|
|
1427
1475
|
sortTsconfig,
|