安装
npm install eslint
如何初始化
初始化
eslint
运行 ./node_modules/.bin/eslint --init
接下来会弹出选项
how would you like to configure Eslint | 您希望如何配置eslint
选择 use popular style guidewhich style guide do you want to follow | 您要遵循哪种风格指南
可以选择 airbnb , 相对严格do you use React ? | 你是否使用 react?
不需要的话就填n接下来就是安装依赖
VScode 安装 eslint 插件
插件商店搜索 Eslint 插件, 重启编辑器, 如果代码中有出现报红, 说明已经配置成功
如何开启vscode 自动修复
打开vscode 配置项, 搜索autofix
, 勾选auto Fix On Save
![]()