1- ## eslint-vue简介
1+ # eslint-vue
22
3- 此插件用于vue语法校验。 [ eslint-vue插件安装地址 ] ( https://ext.dcloud.net.cn/plugin?id=2005 )
3+ This plugin is used for Vue syntax verification. [ eslint-vue install ] ( https://ext.dcloud.net.cn/plugin?id=2005 )
44
5- 和eslint-js搭配使用, [ eslint-js插件安装地址 ] ( https://ext.dcloud.net.cn/plugin?id=2037 )
5+ It needs to be used with eslint-js, [ eslint-js plug-in installation address ] ( https://ext.dcloud.net.cn/plugin?id=2037 )
66
7- ## 错误提示
7+ ## Error message
88
9- 如下图所示,编写完代码,保存文件,当检查到错误时,会出现红色波浪线
9+ As shown in the figure below, when an error is detected, a red wavy line will appear.
1010
11- <img src =" /static/snapshots/tutorial/eslint-error.png " />
11+ <img src =" /static/snapshots/tutorial/plugins/ eslint-vue- error.png " class = " hd-img " />
1212
13- ## 插件配置
13+ ## Plugin configuration
1414
15- 点击菜单【工具】【插件配置】【 eslint-vue】,即可看到eslint-vue相关配置。
15+ Click the menu [ Tools ] [ Settings -> Plugin ] [ eslint-vue] , you can see the eslint-vue related configuration.
1616
17- <img src =" /static/snapshots/tutorial/eslint-js .png " />
17+ <img src =" /static/snapshots/tutorial/plugins/settings_eslint_en .png " class = " hd-img " />
1818
1919** 实时校验、自动修复**
2020
25253 . 若满足上述条件,当编写完代码,保存时,若代码中存在错误,自动修复;
26264 . 实时校验功能,默认未开启,需要手动开启此功能
2727
28- ## 配置文件
28+ ## eslint-vue config file
2929
30- eslint-vue的配置文件为 .eslintrc.js。
30+ The configuration file of eslint-vue is ` .eslintrc.js ` .
3131
32- 点击菜单工具 -> 设置 -> 插件配置 -> eslint-vue -> .eslintrc.js,即可打开 .eslintrc.js文件。
32+ Click on the menu Tools -> Settings -> Plugins -> eslint-vue -> .eslintrc.js to open the ` .eslintrc.js ` file.
3333
34- 选项对应说明如下 :
34+ The configuration file is as follows :
3535
3636```
3737 module.exports = {
3838 "extends": "plugin:vue/essential",
3939 "parserOptions": {},
40- "rules": {} //规则
40+ "rules": {}
4141 };
4242```
4343
44- 更多配置说明可以参考 [ options] ( http://eslint.org/docs/user-guide/configuring )
44+ More configuration instructions can refer to [ options] ( http://eslint.org/docs/user-guide/configuring )
4545
4646
47- ## 如何增加规则 ?
47+ ## how to add rules ?
4848
49- [ 官方规则列表 ] ( https://github.com/vuejs/eslint-plugin-vue#gear-configs )
49+ [ rules list ] ( https://github.com/vuejs/eslint-plugin-vue#gear-configs )
5050
51- 规则设置 :
52- - "off" 或 0 - 关闭规则
53- - "warn" 或 1 - 开启规则 ,使用警告级别的错误:warn (不会导致程序退出)
54- - "error" 或 2 - 开启规则 ,使用错误级别的错误:error (当被触发的时候,程序会退出)
51+ Rule setting :
52+ - "off" or 0 - close rules
53+ - "warn" or 1 - open rules ,使用警告级别的错误:warn (不会导致程序退出)
54+ - "error" or 2 - open rules ,使用错误级别的错误:error (当被触发的时候,程序会退出)
5555
56- 修改 .eslintrc.js文件,添加规则,比如:
56+ Modify the .eslintrc.js file and add rules, such as:
5757
5858``` js
5959{
@@ -122,7 +122,7 @@ eslint-vue的配置文件为.eslintrc.js。
122122```
123123
124124
125- ## 示例 :uni-app项目
125+ ## Example :uni-app project
126126
127127特别说明:
128128- vue文件,校验vue语法,需要安装` eslint-vue ` 插件,[ 插件地址] ( https://ext.dcloud.net.cn/plugin?id=2005 )
@@ -135,7 +135,7 @@ eslint-vue的配置文件为.eslintrc.js。
135135<img src =" /static/snapshots/tutorial/eslint-uniapp-example.gif " style =" zoom : 90% ; border : 1px solid #eee ;" />
136136
137137
138- ## 示例:cli项目
138+ ## Example:vue-cli project
139139
140140vue-cli项目,如果使用项目下的配置规则,需要安装相关库、并在项目根目录创建` .eslintrc.js ` 文件
141141
0 commit comments