# 安装开发格式修复依赖
node i -D eslint
# eslint初始化
直接复制./node_modules/.bin/eslint --init来初始化
或者,切记:在层层进入到bin目录时候,应当./eslint --init来初始化,这里的./不能省掉
如下选择standard格式生成yml文件
? How would you like to configure ESLint? Use a popular style guide
? Which style guide do you want to follow? Standard
? What format do you want your config file to be in? YAML
# 在package.json中添加lint功能
"scripts": {
"test": "jest",
"lint": "eslint .",
"fix": "eslint --fix ."
}
# 修复调试
npm run lint 错误查找
npm run fix 基本格式修复