在公司另一个项目开发完成需要提交代码时,在提交前会通过eslint进行格式校验,但是会一直报错说这个插件没有找到
ESLint couldn't find the plugin "eslint-plugin-vue".
(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "E:\desktop".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in "..\package.json".
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
报错说在我的桌面没有找到这个插件,而且我自己在desktop目录下也没有找到,但是问题就出在这里,我的项目放在desktop目录下,它通过了绝对路径去寻找这个文件,而且少了项目名,我的这个文件应该是在 E:\desktop\项目名 下,
修改项目中.eslintrc.js的配置
module.exports = {
root: true
}
指示当前配置文件是项目的根配置,这样ESLint 会以此文件所在目录作为项目的根目录,不再从上级目录查找配置文件。