-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc
168 lines (168 loc) · 3.59 KB
/
.eslintrc
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
{
"extends": [
"react-app",
"airbnb",
"plugin:jsx-a11y/recommended",
"prettier",
"prettier/react"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"jsx-a11y",
"fp",
"@typescript-eslint",
"prettier",
"import"
],
"rules": {
// Disable default rule for TS rule
"no-use-before-define": "off",
"no-unused-vars": "off",
"no-shadow": "off",
"no-redeclare": "off",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^props$",
"ignoreRestSiblings": true
}
],
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/no-redeclare": "error",
// Allow JSX within .js files
"react/jsx-filename-extension": [
1,
{
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
],
// Allow props spreading in React
"react/jsx-props-no-spreading": 0,
"react/prop-types": 0,
"react/require-default-props": 0,
// Allow named exports only files
"import/prefer-default-export": 0,
"object-curly-spacing": [
"error",
"always",
{
"arraysInObjects": true,
"objectsInObjects": true
}
],
// More verbose prettier suggestions
"prettier/prettier": [
"warn"
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
// Warnings to enforce functional programming styles - e.g. no unintended mutations
"fp/no-delete": "warn",
"fp/no-mutating-assign": "warn",
"fp/no-mutating-methods": [
"warn",
{
"allowedObjects": [
"_"
]
}
],
"fp/no-mutation": [
"warn",
{
"commonjs": true,
"allowThis": true,
"exceptions": [
{
"property": "propTypes"
},
{
"property": "defaultProps"
},
{
"property": "current"
}
]
}
],
"no-console": [
"warn",
{
"allow": [
"warn",
"error"
]
}
],
"lines-between-class-members": "off",
"max-classes-per-file": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.test.{ts,tsx}",
"**/*.spec.{ts,tsx}"
]
}
]
},
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": [
"node_modules",
"./src"
],
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
},
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".tsx"
]
},
"typescript": {
// always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
"alwaysTryTypes": true
}
},
"ignorePatterns": [
"**/src/serviceWorker.ts"
],
"overrides": [
// Don't warn about reassignment in spec files so that we can use before blocks to assign to scoped variables.
{
"files": "**/*.{spec,test}.{ts,tsx}",
"rules": {
"fp/no-mutation": "off"
}
},
// no-undef rule is useless in ts: https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md
{
"files": ["*.{ts,tsx}"],
"rules": {
"no-undef": "off"
}
}
]
}