-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.js
125 lines (121 loc) · 4.91 KB
/
.eslintrc.js
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
const commaDangle = {
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "never",
};
module.exports = {
extends: ["eslint:recommended", "plugin:eslint-comments/recommended", "plugin:import/recommended", "prettier"],
root: true,
env: {
node: true,
es2021: true,
},
rules: {
"comma-dangle": ["error", commaDangle],
"eslint-comments/no-unused-disable": "error",
// Expensive rules disabled below
"import/default": "off",
"import/namespace": "off",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
},
overrides: [
{
files: ["**/*.ts", "**/*.tsx"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: "./**/tsconfig.json",
},
rules: {
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": [
"error",
{
...commaDangle,
enums: "always-multiline",
generics: "always-multiline",
tuples: "never", // Removed due to conflict with prettier
},
],
"@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-explicit-any": "off",
// The below are a project for when we pursue complete type safety
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
},
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
settings: {
"import/resolver": {
typescript: {
project: "./**/tsconfig.json",
},
},
},
},
{
files: ["jest.test-setup.js", "**/*.test.ts"],
extends: ["plugin:jest/recommended", "plugin:jest/style"],
rules: {
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
"jest/expect-expect": ["warn", { assertFunctionNames: ["expect", "expectTypeOf"] }],
},
},
{
files: ["**/*.tsx"],
extends: ["plugin:react/recommended", "plugin:react/jsx-runtime", "plugin:jsx-a11y/recommended"],
plugins: ["simple-import-sort"],
settings: {
react: {
version: "detect",
},
},
rules: {
"simple-import-sort/imports": [
"error",
{
groups: [
// Matches any import statement that are 'react'
["^react$"],
// Matches any import statement that starts with '@' followed by any word character
["^@?\\w"],
// Matches any import statement that starts with a dot, but not when it is followed by a forward slash (i.e., not a relative import), and not when it is followed by nothing (i.e., not an absolute import). Also matches import statements that start with two dots, followed by either nothing or a forward slash (i.e., a relative parent import).
["^\\.(?!/?$)", "^\\.\\./?$"],
// Side effect imports.
["^\\u0000"],
],
},
],
},
},
],
};