代码规范工具配置各种错误集合
# 安装依赖提示could not determine executable to run
$ husky install
'husky' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
1
2
3
4
5
2
3
4
5
安装了 husky@^7.0.4 就好了,版本太高太低都不好。
# eslint配置了规则没有生效
检查eslint报错:
- 按F1
- 输入eslint
- 选择show output channel
prettier同理,检查报错,首先将报错解决完,如果还是没有效果,就降级,如同husky一样,降级版本,我将eslint降级到^5.16.0后就生效了。
# 安装了插件eslint-plugin-vue,但是提示Cannot find module 'eslint-plugin-vue'
降低eslint版本就好了,^5.16.0就可以
# stylelint插件没有给代码标红
这个是由于stylelint插件不支持13及以上版本的stylelint,这里牵扯到很复杂的版本问题,我就没有折腾了,我使用的是"stylelint": "^12.0.1"、"stylelint-order": "4.0.0"。这两个版本搭配起来可以实现手动修复。
npx stylelint ./test.vue --fix
1
上次更新: 2023/12/16, 09:22:46