-
Notifications
You must be signed in to change notification settings - Fork 394
Expand file tree
/
Copy path.eslintrc.js
More file actions
152 lines (146 loc) · 4.17 KB
/
.eslintrc.js
File metadata and controls
152 lines (146 loc) · 4.17 KB
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
"use strict";
module.exports = {
root: true,
extends: [
"eslint:recommended",
// https://github.com/typescript-eslint/typescript-eslint/blob/v6/packages/eslint-plugin/src/configs/recommended.ts
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"prettier"
],
parser: "@typescript-eslint/parser",
parserOptions: {
requireConfigFile: false,
ecmaVersion: 2019,
ecmaFeatures: {
jsx: true,
modules: true,
legacyDecorators: true
}
},
env: {
browser: true,
commonjs: true,
es6: true
},
ignorePatterns: ["*.scss.d.ts", "/lib/ThirdParty"],
plugins: ["react", "react-hooks", "@typescript-eslint"],
globals: {
process: true
},
settings: {
react: {
version: "detect"
}
},
rules: {
// TODO: re-enable the disabled @typescript-eslint rules.
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-empty-object-type": [
"error",
{ allowInterfaces: "with-single-extends" }
],
"@typescript-eslint/unified-signatures": "error",
"react-hooks/exhaustive-deps": "error",
"react/jsx-boolean-value": ["error", "never", { always: [] }],
"react/no-arrow-function-lifecycle": "error",
"react/no-invalid-html-attribute": "error",
"react/jsx-no-useless-fragment": "error",
"react/jsx-no-constructed-context-values": "error",
"react/jsx-fragments": ["error", "syntax"],
"react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
"react/jsx-pascal-case": [
"error",
{
allowAllCaps: true,
ignore: []
}
],
"react/no-danger": "warn",
"react/no-did-update-set-state": "error",
"react/no-will-update-set-state": "error",
"react/self-closing-comp": "error",
"react/jsx-no-undef": ["error", { allowGlobals: true }],
/* Ignore styled-components css property */
"react/no-unknown-property": ["error", { ignore: ["css"] }],
"no-restricted-imports": [
"error",
{
name: "lodash",
message: "Please use 'lodash-es' instead."
}
],
/*Possible Errors */
"no-console": "off",
"no-inner-declarations": [1, "functions"],
/* Best Practices */
eqeqeq: ["error"],
"no-alert": ["error"],
"no-caller": ["error"],
"no-div-regex": ["error"],
"no-empty": ["error", { allowEmptyCatch: true }],
"no-eval": ["error"],
"no-extend-native": ["error"],
"no-fallthrough": 0,
"no-implied-eval": ["error"],
"no-iterator": ["error"],
"no-labels": ["error"],
"no-lone-blocks": ["error"],
"no-loop-func": ["error"],
"no-new-func": ["error"],
"no-new-wrappers": ["error"],
"no-new": ["error"],
"no-octal-escape": ["error"],
"no-proto": ["error"],
"no-return-assign": ["error"],
"no-script-url": ["error"],
"no-sequences": ["error"],
radix: "error",
/* Strict Mode */
strict: [0, "global"],
/* Variables */
"no-label-var": 1,
"@typescript-eslint/no-unused-vars": [
"warn",
{
args: "all",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
ignoreRestSiblings: true
}
],
camelcase: [
0,
{
properties: "always"
}
],
"no-array-constructor": "error",
"no-new-object": 1,
"no-unneeded-ternary": 1 /* ECMAScript 6 */,
"prefer-const": "error"
},
overrides: [
{
files: ["**/*.ts", "**/*.tsx"],
rules: {
/* The no-useless-constructor needs to be disabled for
the @typescript-eslint-rule. */
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error",
// @TODO: revise these rules
"@typescript-eslint/consistent-type-assertions": "error",
"react-hooks/exhaustive-deps": "error",
// FIXME: typescript-eslint 8 gave 1400+ react/prop-types warnings.
"react/prop-types": "off"
}
}
]
};