-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.yaml
269 lines (247 loc) · 4.67 KB
/
.eslintrc.yaml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
parser: babel-eslint
parserOptions:
ecmaFeatures:
# jsx: true
sourceType: module
settings:
import/resolver:
webpack:
config: ./webpack.config.js
env:
# browser: true
es6: true
node: true
mocha: true
plugins:
- prettier
- flowtype
- header
- flowtype-errors
- mocha
# - jest
- filenames
- import
extends:
- eslint:recommended
- prettier
- prettier/flowtype
- plugin:flowtype/recommended
- plugin:mocha/recommended
# Can't seem to configure this plugin myself....
# - plugin:jest/recommended
globals:
expect: readonly
sinonSandbox: readonly
# Rules for only some file locations/paths (globs)
overrides:
- files:
- src/**/*.js
excludedFiles:
- test/*.js
- ./**/*.spec.js
rules:
# Mocha prefers function() style to set `this`: http://mochajs.org/#arrow-functions
prefer-arrow-callback:
- off
mocha/prefer-arrow-callback:
- error
# Header at top of files
header/header:
- error
- block
- pattern: ^\*\n
\* \@flow\n
(\*\n
\* (.*\n)* )?$
# Flow Type Rules
flowtype/require-variable-type:
- warn
flowtype/require-return-type:
- warn
- always
- excludeMatching:
- "spec.js"
flowtype/require-parameter-type:
- warn
flowtype/no-weak-types:
- warn
flowtype-errors/show-errors:
- error
flowtype-errors/show-warnings:
- warn
# Jest Plugin (Don't use Jest though so need to disable specific rules)
# Doesn't seem to work...
jest/valid-expect:
- off
## File Naming Conventions
- files:
- src/controllers/*.js
rules:
filenames/match-regex:
- error
- .*\.controller(\.spec)?$
- files:
- src/dataservices/*.js
rules:
filenames/match-regex:
- error
- .*\.service(\.spec)?$
- files:
- src/helpers/*.js
rules:
filenames/match-regex:
- error
- .*\.helper(\.spec)?$
# Custom Rules Below
rules:
# Documentation Rules
valid-jsdoc: error
require-jsdoc:
- warn
- require:
FunctionDeclaration: true
MethodDefinition: true
ClassDeclaration: true
# Naming conventions
id-length:
- warn
- min: 3
exceptions:
- id
- i
- it
- _
- fs
new-cap:
- error
camelcase:
- warn
# File Conventions
max-len:
- warn
- code: 110
ignoreUrls: true
max-lines:
- warn
- max: 500
skipComments: true
eol-last:
- error
- always
linebreak-style:
- error
- unix
# Import Rules
import/no-unresolved:
- error
import/no-absolute-path:
- error
import/no-dynamic-require:
- error
import/no-self-import:
- error
import/no-cycle:
- error
import/export:
- error
import/no-named-as-default:
- warn
import/no-named-as-default-member:
- warn
import/no-mutable-exports:
- warn
import/first:
- warn
import/no-duplicates:
- warn
import/newline-after-import:
- error
import/prefer-default-export:
- warn
# Basic Rules
no-var: error
prefer-const: error
no-shadow: error
no-duplicate-imports: error
class-methods-use-this: warn
require-await: warn
no-console:
- warn
no-alert:
- error
no-empty-function:
- warn
eqeqeq:
- error
- always
no-lonely-if: error
indent:
- error
- 2
- ignoredNodes:
- TemplateLiteral
quotes:
- error
- single
prefer-template:
- error
semi:
- error
- always
# Spacing
no-trailing-spaces: error
space-infix-ops: error
space-before-blocks: error
spaced-comment:
- error
- always
space-in-parens:
- error
- never
space-before-function-paren:
- error
- never
keyword-spacing:
- error
- before: true
after: true
# Array/Comma Spacing
comma-spacing:
- error
- after: true
array-bracket-newline:
- error
- multiline: true
minItems: 3
array-element-newline:
- error
- multiline: true
minItems: 3
comma-dangle:
- error
- arrays: only-multiline
objects: only-multiline
imports: never
exports: never
functions: ignore
# Object Spacing
key-spacing:
- error
- afterColon: true
object-curly-spacing:
- error
- always
object-curly-newline:
- error
- consistent: true
# Arrow Function Conventions
arrow-body-style:
- error
- always
arrow-parens:
- error
- always
arrow-spacing: error
# prefer-arrow-callback:
# - error
# - allowNamedFunctions: true