-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
148 lines (143 loc) · 4.48 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
module.exports = {
env: {
node: true,
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
globals: {
TradingView: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.lint.json",
ecmaFeatures: {
tsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["react", "@typescript-eslint", "prettier"],
overrides: [
{
files: ["*.ts", "*.tsx"],
// As mentioned in the comments, you should extend TypeScript plugins here,
// instead of extending them outside the `overrides`.
// If you don't want to extend any rules, you don't need an `extends` attribute.
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
parserOptions: {
project: ["./tsconfig.json"], // Specify it only for TypeScript files
},
rules: {
"react/prop-types": 0,
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn"],
"no-case-declarations": 0,
"react/require-default-props": "off",
"prefer-destructuring": "off",
"prettier/prettier": "warn",
"react/jsx-props-no-spreading": "off",
"react/react-in-jsx-scope": "off",
ignoreRestSiblings: "off",
"no-param-reassign": [
"error",
{
props: false,
},
],
"space-before-function-paren": [
"error",
{
anonymous: "always",
named: "never",
asyncArrow: "always",
},
],
"object-curly-spacing": ["error", "always"],
// Make async code easier to maintain by highlighting common errors
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/promise-function-async": [
"error",
{
checkArrowFunctions: false,
},
],
"no-return-await": "off",
"@typescript-eslint/return-await": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "warn",
"@typescript-eslint/no-explicit-any": [
"error",
{
ignoreRestArgs: true,
},
],
"@typescript-eslint/require-array-sort-compare": [
"error",
{
ignoreStringArrays: true,
},
],
// New rules that should help enforce a consistent code style
"@typescript-eslint/array-type": "error",
"@typescript-eslint/brace-style": "error",
"@typescript-eslint/comma-spacing": "error",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/lines-between-class-members": [
"error",
"always",
{
exceptAfterOverload: true,
exceptAfterSingleLine: true,
},
],
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/member-ordering": [
"error",
{
default: [
"static-field",
"public-field",
"protected-field",
"private-field",
"field",
"constructor",
"static-method",
"public-method",
"protected-method",
"private-method",
"method",
"signature",
],
},
],
"@typescript-eslint/space-infix-ops": "error",
"@typescript-eslint/type-annotation-spacing": "error",
// Turn off conflicting rules
"brace-style": "off",
"comma-spacing": "off",
"lines-between-class-members": "off",
"space-infix-ops": "off",
"react/display-name": "off",
// TEMP: ENABLE THIS WHEN WE WANT TO GET BETTER TYPESCRIPT CODE:
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-promises": "warn",
},
},
],
};