-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.mts
100 lines (99 loc) · 2.65 KB
/
eslint.config.mts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import pluginJs from "@eslint/js";
import tsParser from "@typescript-eslint/parser";
import eslintPluginImportX from "eslint-plugin-import-x";
import globals from "globals";
import tseslint from "typescript-eslint";
import vitest from "eslint-plugin-vitest";
export default tseslint.config(
{
ignores: ["eslint.config.mts", "dist", ".yarn", "website/build"],
},
{
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
},
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: { jsx: true },
},
},
settings: {},
},
pluginJs.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
eslintPluginImportX.flatConfigs.recommended,
eslintPluginImportX.flatConfigs.typescript,
{
rules: {
"@typescript-eslint/array-type": ["error", { default: "generic" }],
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/only-throw-error": "off",
"@typescript-eslint/restrict-template-expressions": [
"error",
{ allowNumber: true },
],
"import-x/order": [
"error",
{
alphabetize: {
order: "asc",
orderImportKind: "asc",
caseInsensitive: true,
},
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
],
pathGroups: [
{
pattern: "*.{css,scss}",
patternOptions: { matchBase: true },
group: "object",
position: "after",
},
{
pattern: "~/**",
group: "internal",
},
{
pattern: "react",
group: "builtin",
position: "before",
},
{
pattern: "react-dom",
group: "builtin",
position: "before",
},
],
warnOnUnassignedImports: true,
},
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ fixStyle: "separate-type-imports" },
],
},
},
{
files: ["**/*.test.{js,mjs,cjs,ts,jsx,tsx}"],
...vitest.configs.recommended,
rules: {
...vitest.configs.recommended.rules,
"vitest/valid-title": ["error", { allowArguments: true }],
},
},
);