-
Notifications
You must be signed in to change notification settings - Fork 306
/
.eslintrc.js
163 lines (159 loc) · 4.45 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: [
"plugin:react/recommended",
"plugin:@next/next/recommended",
"prettier",
],
plugins: ["prettier", "react", "unused-imports", "import"],
parserOptions: {
tsconfigRootDir: "./",
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
ignorePatterns: ["**/gen/**", "scripts/**"],
settings: {
react: {
version: "detect",
},
"import/resolver": {
typescript: {},
},
},
rules: {
"no-console": ["error", { allow: ["time", "timeEnd", "timeStamp"] }],
"no-new-wrappers": "error",
"no-invalid-this": "error",
"no-promise-executor-return": "error",
"no-restricted-imports": [
"error",
{
paths: [
{
name: "node:assert",
message: "Use 'assert' instead",
},
],
patterns: [
{
group: ["@/gen/cayley/impl/*"],
message: "Use '@/wasm/cayley' instead",
},
],
},
],
"no-fallthrough": [
"error",
{
commentPattern: "break[\\s\\w]*omitted",
},
],
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"react/display-name": "off",
"react/prop-types": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"@next/next/no-img-element": "off",
"prettier/prettier": "error",
},
overrides: [
{
// Typescript-only rules.
files: ["**/*.ts", "**/*.tsx"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint", "no-relative-import-paths"],
rules: {
"@typescript-eslint/ban-types": [
"error",
{
extendDefaults: true,
types: {
"{}": false,
},
},
],
"no-relative-import-paths/no-relative-import-paths": [
"error",
{ rootDir: "src", prefix: "@" },
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variableLike",
format: ["camelCase", "UPPER_CASE"],
leadingUnderscore: "allowSingleOrDouble",
},
{
selector: "variable",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allowSingleOrDouble",
},
{
selector: "function",
format: ["camelCase", "PascalCase"],
},
{
selector: "variable",
modifiers: ["destructured"],
format: null,
},
{
selector: "parameter",
modifiers: ["destructured"],
format: null,
},
],
"@typescript-eslint/unbound-method": [
"error",
{
ignoreStatic: true,
},
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "off",
"return-await": "off",
"@typescript-eslint/return-await": "error",
// TODO (akarpenko): re-enable those:
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-return": "off",
},
},
],
};