forked from OneUptime/oneuptime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
214 lines (208 loc) · 6.53 KB
/
eslint.config.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// @ts-check
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import globals from "globals";
import unusedImports from "eslint-plugin-unused-imports";
import react from "eslint-plugin-react";
export default tseslint.config(
{
ignores: [
"**/node_modules/",
"**/dist/",
"**/build/",
"**/assets/",
"**/out/",
"**/coverage/",
"**/lib/",
"**/esm/",
"**/cjs/",
"**/playwright-report/",
"**/playwright-coverage/",
"**/playwright-screenshots/",
"**/playwright-videos",
"**/webpack.config.js", // TODO: Remove this ignore
"**/service-worker.js", // TODO: Remove this ignore
"**/Static/", // TODO: Remove this ignore
"**/*.js" // TODO: Remove this ignore
],
},
eslint.configs.recommended,
...tseslint.configs.recommended, // TODO: make this strict and not recommended
eslintPluginPrettierRecommended,
{
plugins: {
"unused-imports": unusedImports,
react: react,
},
rules: {
"react/prop-types": "off", // TODO: Remove this rule
"no-control-regex": "off", // TODO: Remove this rule
"@typescript-eslint/no-explicit-any": "off", // TODO: Remove this rule
"@typescript-eslint/no-var-requires": "off", // TODO: Remove this rule
"@typescript-eslint/no-duplicate-enum-values": "off", // TODO: Remove this rule
"no-constant-binary-expression": "off", // TODO: Remove this rule
"@typescript-eslint/ban-ts-comment": "off", // TODO: Remove this rule
"multiline-comment-style": "off", // TODO: Remove this rule
"@typescript-eslint/no-floating-promises": "off", // TODO: Remove this rule
"no-fallthrough": "error",
"no-unreachable": "error",
"no-cond-assign": "error",
"valid-typeof": "error",
"no-func-assign": "error",
curly: "error",
"no-extra-semi": "error",
"no-else-return": "error",
"no-div-regex": "error",
"no-octal": "error",
"no-extra-bind": "error",
"unicode-bom": "error",
"no-extra-boolean-cast": "error",
"wrap-regex": "error",
"wrap-iife": "error",
"yield-star-spacing": "error",
"no-implicit-coercion": "error",
"no-extra-label": "error",
"no-lonely-if": "error",
"no-floating-decimal": "error",
eqeqeq: "error",
"dot-notation": "off", // Off because it messes up with typescript compiler.
"@typescript-eslint/dot-notation": "off", //temp off.
"linebreak-style": ["error", "unix"],
"@typescript-eslint/no-empty-interface": [
"error",
{
allowSingleExtends: true,
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-member-accessibility": ["error"],
"no-console": "error",
"no-undef": "error",
"no-empty": "error",
"prefer-arrow-callback": "error",
"constructor-super": "error",
"no-case-declarations": "error",
"no-mixed-spaces-and-tabs": "error",
"no-useless-escape": "error",
"prettier/prettier": "error",
"react/jsx-no-undef": "error",
"react/jsx-no-bind": [
"error",
{
allowArrowFunctions: true,
allowBind: false,
ignoreRefs: false,
},
],
"react/no-children-prop": "error",
"react/no-deprecated": "error",
"react/boolean-prop-naming": "error",
"react/no-is-mounted": "error",
"react/no-find-dom-node": "error",
"one-var-declaration-per-line": "error",
"arrow-parens": "error",
"arrow-body-style": ["error", "always"],
"@typescript-eslint/typedef": [
"error",
{
arrowParameter: true,
variableDeclaration: true,
},
],
"@typescript-eslint/strict-boolean-expressions": "off", //Need to enable this very soon
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"react/no-did-update-set-state": "error",
"react/no-unknown-property": "error",
"react/no-unused-prop-types": "error",
"react/jsx-no-duplicate-props": "error",
"react/no-unused-state": "error",
"react/jsx-uses-vars": "error",
"react/react-in-jsx-scope": "error",
"react/no-string-refs": "error",
"jsx-a11y/href-no-hash": [0],
"react/no-unescaped-entities": "error",
"react/display-name": "error",
"react/jsx-pascal-case": "error",
"array-callback-return": "error",
"no-loop-func": "error",
"no-duplicate-imports": "error",
"no-promise-executor-return": "error",
"capitalized-comments": "off", // this is turned off because come commented code should not be capitalized.
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"prefer-const": [
"error",
{
destructuring: "any",
ignoreReadBeforeAssign: false,
},
],
"no-var": "error",
"object-curly-spacing": ["error", "always"],
"no-unneeded-ternary": "error",
"@typescript-eslint/ban-types": [
"error",
{
types: {
String: true,
Boolean: true,
Number: true,
Symbol: false,
"{}": true,
Object: true,
object: true,
Function: true,
},
extendDefaults: true,
},
],
},
settings: {
react: {
version: "18.1.0",
},
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
JSX: true,
require: true,
process: true,
module: true,
__dirname: true,
exports: true,
},
parserOptions: {
project: ["./tsconfig.json"], // Specify it only for TypeScript files
// or `project: true` in typescript-eslint version >= 5.52.0
},
},
},
);