-
Notifications
You must be signed in to change notification settings - Fork 577
/
.eslintrc.js
159 lines (152 loc) · 4.62 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
const OFF = "off"
const WARN = "warn"
const ERR = "error"
module.exports = {
root: true,
plugins: [
"@typescript-eslint",
"jest",
"no-relative-import-paths",
"react-hooks",
"testing-library",
"unused-imports",
"no-autofix",
"artsy",
],
extends: [
"eslint:recommended",
"plugin:testing-library/react",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/jsx-runtime",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"prettier", // "prettier" needs to be last!
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 6,
sourceType: "module",
},
settings: {
react: {
version: "detect",
},
},
rules: {
/**
* Errors
*/
"artsy/no-uselazyloadquery-inside-suspense": ERR,
"import/order": [
ERR,
{
alphabetize: { order: "asc" },
groups: ["builtin", "external", "internal", "index", "sibling", "parent", "object", "type"],
warnOnUnassignedImports: true,
},
],
"import/no-duplicates": ERR,
"react/jsx-curly-brace-presence": ERR,
"react/jsx-no-leaked-render": [ERR, { validStrategies: ["coerce", "ternary"] }],
"react-hooks/rules-of-hooks": ERR,
"unused-imports/no-unused-imports": OFF, // look below
"no-autofix/unused-imports/no-unused-imports": ERR,
/**
* Rules for tests see https://github.com/testing-library/eslint-plugin-testing-library#supported-rules for details
* on default enabled rules or to remove rules.
*/
"testing-library/no-global-regexp-flag-in-query": OFF,
/**
* Warnings
*/
"@typescript-eslint/no-unused-vars": [
WARN,
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"no-relative-import-paths/no-relative-import-paths": [
WARN,
{ allowSameFolder: true, rootDir: "src" },
],
/**
* Disabled
*/
"@typescript-eslint/await-thenable": OFF,
"@typescript-eslint/ban-ts-comment": OFF,
"@typescript-eslint/ban-types": OFF,
"@typescript-eslint/explicit-module-boundary-types": OFF,
"@typescript-eslint/no-implied-eval": OFF,
"@typescript-eslint/no-empty-function": OFF,
"@typescript-eslint/no-explicit-any": OFF,
"@typescript-eslint/no-floating-promises": OFF,
"@typescript-eslint/no-for-in-array": OFF,
"@typescript-eslint/no-misused-promises": OFF,
"@typescript-eslint/no-non-null-asserted-optional-chain": OFF,
"@typescript-eslint/no-non-null-assertion": ERR,
"@typescript-eslint/no-unnecessary-type-assertion": OFF,
"@typescript-eslint/no-unsafe-argument": OFF,
"@typescript-eslint/no-unsafe-assignment": OFF,
"@typescript-eslint/no-unsafe-call": OFF,
"@typescript-eslint/no-unsafe-member-access": OFF,
"@typescript-eslint/no-unsafe-return": OFF,
"@typescript-eslint/no-var-requires": OFF,
"@typescript-eslint/require-await": OFF,
"@typescript-eslint/restrict-plus-operands": OFF,
"@typescript-eslint/restrict-template-expressions": OFF,
"@typescript-eslint/strict-boolean-expressions": OFF,
"@typescript-eslint/unbound-method": OFF,
"import/default": OFF,
"import/namespace": OFF,
"import/no-named-as-default-member": OFF,
"import/no-named-as-default": OFF,
"import/no-unresolved": OFF,
"no-control-regex": OFF,
"no-empty-pattern": OFF,
"no-extra-boolean-cast": OFF,
"no-redeclare": OFF,
"no-undef": OFF,
"no-useless-catch": OFF,
"no-useless-escape": OFF,
"react/display-name": OFF,
"react/jsx-uses-react": OFF,
"react/no-children-prop": OFF,
"react/no-unescaped-entities": OFF,
"react/react-in-jsx-scope": OFF,
"react/prop-types": OFF,
"react-native/no-inline-styles": OFF,
"react-hooks/exhaustive-deps": OFF, // we don't care about this rule, since it's often wrong. it's helpful, but often wrong.
"no-restricted-imports": [
"error",
{
paths: [
{
name: "relay-runtime",
importNames: ["graphql"],
message: "Please import `graphql` from `react-relay`.",
},
],
},
],
},
overrides: [
{
files: ["*.tests.ts", "*.tests.tsx"],
rules: {
"@typescript-eslint/no-non-null-assertion": OFF,
},
},
{
files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
extends: ["plugin:testing-library/react"],
},
],
}