@@ -34,7 +34,7 @@ $ npm install eslint-loader --save-dev
34
34
35
35
### 基本配置
36
36
37
- #### 配置webpack
37
+ #### 配置 webpack
38
38
39
39
``` javascript
40
40
module: {
@@ -96,15 +96,15 @@ module: {
96
96
}
97
97
```
98
98
99
- Eslint的规则配置具体可戳 [ 这里] ( http://eslint.org/docs/rules/ )
99
+ Eslint 的规则配置具体可戳 [ 这里] ( http://eslint.org/docs/rules/ )
100
100
101
- 通常,0代表不使用这个规则,1代表 ` warnning ` 的程度,2代表 ` error ` 的程度。
101
+ 通常,0 代表不使用这个规则,1 代表 ` warnning ` 的程度,2 代表 ` error ` 的程度。
102
102
103
103
有一篇博客写的挺细的:[ 详解 ESLint 规则,规范你的代码] ( http://guowenfh.github.io/2016/08/07/ESLint-Rules/ )
104
104
105
105
### 插件
106
106
107
- 如果我们使用ES6/ES7或者JSX的语法,并用babel进行解析的话 ,可以安装[ babel-eslint] ( https://github.com/babel/babel-eslint )
107
+ 如果我们使用 ES6/ES7 或者 JSX 的语法,并用 babel 进行解析的话 ,可以安装 [ babel-eslint] ( https://github.com/babel/babel-eslint )
108
108
109
109
``` bash
110
110
$ npm install babel-eslint --save-dev
@@ -121,14 +121,14 @@ $ npm install babel-eslint --save-dev
121
121
}
122
122
```
123
123
124
- 在使用React的时候,如果Eslint里配置了 ` no-unused-vars ` 的规则,那么在检查代码的时候会报错,提示import的组件没有被调用 (实际上使用了):
124
+ 在使用 React 的时候,如果 Eslint 里配置了 ` no-unused-vars ` 的规则,那么在检查代码的时候会报错,提示 import 的组件没有被调用 (实际上使用了):
125
125
126
126
``` bash
127
127
React is defined but never used no-ununsed-vars
128
128
Component is defined but never used
129
129
```
130
130
131
- 查到Github上有人提出 [ issue] ( https://github.com/eslint/eslint/issues/4821 ) ,解决方案是使用` eslint-plugin-react ` ,因此来安装配置` eslint-plugin ` :
131
+ 查到 GitHub 上有人提出 [ issue] ( https://github.com/eslint/eslint/issues/4821 ) ,解决方案是使用` eslint-plugin-react ` ,因此来安装配置` eslint-plugin ` :
132
132
133
133
- [ eslint-plugin-react] ( https://github.com/yannickcr/eslint-plugin-react )
134
134
@@ -160,7 +160,7 @@ $ npm install eslint-plugin-react --save-dev
160
160
161
161
- [ eslint-plugin-import] ( https://github.com/benmosher/eslint-plugin-import )
162
162
163
- > 检查import是否合法的插件
163
+ > 检查 import 是否合法的插件
164
164
165
165
``` bash
166
166
$ npm install eslint-plugin-import --save-dev
@@ -175,8 +175,8 @@ $ npm install eslint-plugin-import --save-dev
175
175
],
176
176
"rules" : {
177
177
// 检查引用的路径是否有误
178
- // 通过{"commonjs": true, "amd": true }来支持commonjs和amd方式的require
179
- "import/no-unresolved" : [2 , {"commonjs" : true , "amd" : true }]
178
+ // 通过 {"commonjs": true, "amd": true } 来支持 commonjs 和 amd 方式的 require
179
+ "import/no-unresolved" : [2 , {"commonjs" : true , "amd" : true }],
180
180
"import/namespace" : 2 ,
181
181
"import/default" : 2 ,
182
182
"import/export" : 2
0 commit comments