13
13
14
14
# eslint-webpack-plugin
15
15
16
- > A ESLint plugin for webpack
16
+ This plugin uses [ ` eslint ` ] ( https://eslint.org/ ) to find and fix problems in your JavaScript code
17
17
18
- ## About plugin
18
+ ## Getting Started
19
19
20
- The plugin was born with the purpose of solving some problems of the [ eslint-loader] ( https://github.com/webpack-contrib/eslint-loader ) .
21
-
22
- | | eslint-webpack-plugin | eslint-loader |
23
- | -------------------------------- | :-------------------: | :----------------------: |
24
- | Easy configuration | :heavy_check_mark : | :heavy_multiplication_x : |
25
- | Generate unique an output report | :heavy_check_mark : | :heavy_multiplication_x : |
26
- | Using cache directly from eslint | :heavy_check_mark : | :heavy_multiplication_x : |
27
- | Lint only changed files | :heavy_check_mark : | :heavy_multiplication_x : |
28
-
29
- ## Migrate from ` eslint-loader `
30
-
31
- The loader ` eslint-loader ` will be deprecated soon, please use this plugin instead.
32
-
33
- Before:
34
-
35
- ``` js
36
- module .exports = {
37
- // ...
38
- module: {
39
- rules: [
40
- {
41
- test: / \. js$ / ,
42
- exclude: / node_modules/ ,
43
- loader: ' eslint-loader' ,
44
- options: {
45
- // eslint options (if necessary)
46
- },
47
- },
48
- ],
49
- },
50
- // ...
51
- };
52
- ```
53
-
54
- After:
55
-
56
- ``` js
57
- const ESLintPlugin = require (' eslint-webpack-plugin' );
58
-
59
- module .exports = {
60
- // ...
61
- plugins: [new ESLintPlugin (options)],
62
- // ...
63
- };
64
- ```
65
-
66
- ## Install
20
+ To begin, you'll need to install ` eslint-webpack-plugin ` :
67
21
68
22
``` bash
69
23
npm install eslint-webpack-plugin --save-dev
@@ -75,9 +29,7 @@ npm install eslint-webpack-plugin --save-dev
75
29
npm install eslint --save-dev
76
30
```
77
31
78
- ## Usage
79
-
80
- In your webpack configuration:
32
+ Then add the plugin to your webpack config. For example:
81
33
82
34
``` js
83
35
const ESLintPlugin = require (' eslint-webpack-plugin' );
0 commit comments