This repository has been archived by the owner on Feb 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.eslintrc.js
139 lines (128 loc) · 4.35 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
/** @type {import('eslint').CLIEngine.Options} */
module.exports = {
reportUnusedDisableDirectives: true,
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
},
env: {
es6: true,
browser: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint",
],
plugins: ["@typescript-eslint", "react-hooks", "sort-imports-es6-autofix"],
rules: {
"sort-imports-es6-autofix/sort-imports-es6": [
2,
{
ignoreCase: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
},
],
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/ban-types": [
"error",
{
types: {
FC: {
message: "Use React.FC instead",
fixWith: "React.FC",
},
"React.FunctionComponent": {
message: "Use React.FC instead",
fixWith: "React.FC",
},
Array: null,
Object: "Use {} instead",
String: {
message: "Use string instead",
fixWith: "string",
},
},
},
],
},
settings: {
react: {
version: "detect",
},
node: {
tryExtensions: [".ts", ".tsx", ".js", ".jsx", ".json", ".node"],
},
},
overrides: [
{
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
createDefaultProgram: true,
},
files: ["**/*.ts", "**/*.tsx"],
rules: {
"react/self-closing-comp": 2,
"no-case-declarations": 2,
"react/no-unescaped-entities": 2,
"no-undef": "off",
// typescript
"node/no-unsupported-features/es-syntax": 0,
"no-dupe-class-members": 0,
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [2, { args: "none" }],
"no-array-constructor": 0,
"@typescript-eslint/no-array-constructor": 2,
"@typescript-eslint/adjacent-overload-signatures": 2,
"@typescript-eslint/no-namespace": [
2,
{ allowDeclarations: true },
],
"@typescript-eslint/prefer-namespace-keyword": 2,
"@typescript-eslint/no-require-imports": 2,
"@typescript-eslint/no-var-requires": 2,
"@typescript-eslint/consistent-type-assertions": 2,
"@typescript-eslint/no-unnecessary-type-assertion": 2,
"@typescript-eslint/restrict-plus-operands": 2,
"@typescript-eslint/unbound-method": [
"error",
{
ignoreStatic: true,
},
],
"@typescript-eslint/no-extra-non-null-assertion": ["error"],
"@typescript-eslint/no-floating-promises": ["error"],
// react-hooks
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/jsx-key": 2,
// react typescript
"@typescript-eslint/explicit-function-return-type": "off",
// es2018
"prefer-object-spread": "error",
"no-console": ["error", { allow: ["error", "warn", "info"] }],
// for React.forwardRef
"react/display-name": "off",
},
},
{
files: ["**/*.test.tsx", "**/*.test.ts", "**/__tests__/*.js"],
env: {
jest: true,
},
rules: {
"no-invalid-this": 0,
},
},
{
files: ["*.js", "*.config.js", "config.js", "./scripts/*.js"],
env: {
node: true,
},
},
],
};