@@ -30,11 +30,11 @@ module.exports = {
30
30
options: {
31
31
// eslint options (if necessary)
32
32
}
33
- },
34
- ],
35
- },
33
+ }
34
+ ]
35
+ }
36
36
// ...
37
- }
37
+ };
38
38
```
39
39
40
40
When using with transpiling loaders (like ` babel-loader ` ), make sure they are in correct order
@@ -48,15 +48,12 @@ module.exports = {
48
48
{
49
49
test: / \. js$ / ,
50
50
exclude: / node_modules/ ,
51
- use: [
52
- " babel-loader" ,
53
- " eslint-loader" ,
54
- ],
55
- },
56
- ],
57
- },
51
+ use: [" babel-loader" , " eslint-loader" ]
52
+ }
53
+ ]
54
+ }
58
55
// ...
59
- }
56
+ };
60
57
```
61
58
62
59
To be safe, you can use ` enforce: "pre" ` section to check source files, not modified
@@ -71,17 +68,17 @@ module.exports = {
71
68
enforce: " pre" ,
72
69
test: / \. js$ / ,
73
70
exclude: / node_modules/ ,
74
- loader: " eslint-loader" ,
71
+ loader: " eslint-loader"
75
72
},
76
73
{
77
74
test: / \. js$ / ,
78
75
exclude: / node_modules/ ,
79
- loader: " babel-loader" ,
80
- },
81
- ],
82
- },
76
+ loader: " babel-loader"
77
+ }
78
+ ]
79
+ }
83
80
// ...
84
- }
81
+ };
85
82
```
86
83
87
84
### Options
@@ -141,19 +138,19 @@ module.exports = {
141
138
142
139
// you should return a string
143
140
// DO NOT USE console.*() directly !
144
- return " OUTPUT"
141
+ return " OUTPUT" ;
145
142
}
146
143
}
147
- },
148
- ],
149
- },
150
- }
144
+ }
145
+ ]
146
+ }
147
+ };
151
148
```
152
149
153
150
#### ` eslintPath ` (default: "eslint")
154
151
155
152
Path to ` eslint ` instance that will be used for linting.
156
- If the ` eslintPath ` is a folder like a official eslint, or specify a ` formatter ` option. now you dont have to install ` eslint ` .
153
+ If the ` eslintPath ` is a folder like a official eslint, or specify a ` formatter ` option. now you dont have to install ` eslint ` .
157
154
158
155
``` js
159
156
module .exports = {
@@ -165,12 +162,12 @@ module.exports = {
165
162
exclude: / node_modules/ ,
166
163
loader: " eslint-loader" ,
167
164
options: {
168
- eslintPath: path .join (__dirname , " reusable-eslint" ),
165
+ eslintPath: path .join (__dirname , " reusable-eslint" )
169
166
}
170
- },
171
- ],
172
- },
167
+ }
168
+ ]
173
169
}
170
+ };
174
171
```
175
172
176
173
#### Errors and Warning
@@ -193,12 +190,12 @@ module.exports = {
193
190
exclude: / node_modules/ ,
194
191
loader: " eslint-loader" ,
195
192
options: {
196
- emitError: true ,
193
+ emitError: true
197
194
}
198
- },
199
- ],
200
- },
201
- }
195
+ }
196
+ ]
197
+ }
198
+ };
202
199
```
203
200
204
201
##### ` emitWarning ` (default: ` false ` )
@@ -219,12 +216,12 @@ module.exports = {
219
216
exclude: / node_modules/ ,
220
217
loader: " eslint-loader" ,
221
218
options: {
222
- quiet: true ,
219
+ quiet: true
223
220
}
224
- },
225
- ],
226
- },
227
- }
221
+ }
222
+ ]
223
+ }
224
+ };
228
225
```
229
226
230
227
##### ` failOnWarning ` (default: ` false ` )
@@ -241,12 +238,12 @@ module.exports = {
241
238
exclude: / node_modules/ ,
242
239
loader: " eslint-loader" ,
243
240
options: {
244
- failOnWarning: true ,
241
+ failOnWarning: true
245
242
}
246
- },
247
- ],
248
- },
249
- }
243
+ }
244
+ ]
245
+ }
246
+ };
250
247
```
251
248
252
249
##### ` failOnError ` (default: ` false ` )
@@ -263,15 +260,16 @@ module.exports = {
263
260
exclude: / node_modules/ ,
264
261
loader: " eslint-loader" ,
265
262
options: {
266
- failOnError: true ,
263
+ failOnError: true
267
264
}
268
- },
269
- ],
270
- },
271
- }
265
+ }
266
+ ]
267
+ }
268
+ };
272
269
```
273
270
274
271
##### ` outputReport ` (default: ` false ` )
272
+
275
273
Write the output of the errors to a file, for example a checkstyle xml file for use for reporting on Jenkins CI
276
274
277
275
The ` filePath ` is relative to the webpack config: output.path
@@ -288,17 +286,16 @@ module.exports = {
288
286
loader: " eslint-loader" ,
289
287
options: {
290
288
outputReport: {
291
- filePath: ' checkstyle.xml' ,
292
- formatter: require (' eslint/lib/formatters/checkstyle' )
289
+ filePath: " checkstyle.xml" ,
290
+ formatter: require (" eslint/lib/formatters/checkstyle" )
293
291
}
294
292
}
295
- },
296
- ],
297
- },
298
- }
293
+ }
294
+ ]
295
+ }
296
+ };
299
297
```
300
298
301
-
302
299
## Gotchas
303
300
304
301
### NoErrorsPlugin
0 commit comments