Skip to content

Commit a482e72

Browse files
committed
docs(style): fixed #1020
1 parent 3e1e135 commit a482e72

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/style.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,17 +471,17 @@ export default StyleGuide;
471471

472472
ESLint 是一个语法规则和代码风格的检查工具,可以用来保证写出语法正确、风格统一的代码。
473473

474-
首先,安装 ESLint。
474+
首先,在项目的根目录安装 ESLint。
475475

476476
```bash
477-
$ npm i -g eslint
477+
$ npm install --save-dev eslint
478478
```
479479

480480
然后,安装 Airbnb 语法规则,以及 import、a11y、react 插件。
481481

482482
```bash
483-
$ npm i -g eslint-config-airbnb
484-
$ npm i -g eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
483+
$ npm install --save-dev eslint-config-airbnb
484+
$ npm install --save-dev eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react
485485
```
486486

487487
最后,在项目的根目录下新建一个`.eslintrc`文件,配置 ESLint。
@@ -501,7 +501,7 @@ var unused = 'I have no purpose!';
501501

502502
function greet() {
503503
var message = 'Hello, World!';
504-
alert(message);
504+
console.log(message);
505505
}
506506

507507
greet();
@@ -510,7 +510,7 @@ greet();
510510
使用 ESLint 检查这个文件,就会报出错误。
511511

512512
```bash
513-
$ eslint index.js
513+
$ npx eslint index.js
514514
index.js
515515
1:1 error Unexpected var, use let or const instead no-var
516516
1:5 error unused is defined but never used no-unused-vars

0 commit comments

Comments
 (0)