项目质量监测(二)04-Lint工具之ESLint——vscode中安装ESLint插件 & 配置文件setting.json-保存代码进行校验
在IDE中的配置
- 以下是vscode中插件配置:
setting.json——配置文件:
"eslint.alwaysShowStatus": true,
"eslint.autoFixOnSave": true,
"editor.formatOnSave": true,
"eslint.validate": [
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "javascript",
"autoFix": true
}
],
"eslint.options": {
"plugins": ["html"]
},
保存代码时,快速修复-配置:
打开 "editor.formatOnSave": true
并且要打开eslint.validate
如上面的配置,或者在UI界面里面设置。
保存代码,自动校验
查看——>命令面板——>setting.json
- 在Webstorm中的配置:
使用Configure Preferences
相比于vscode就智能很多。