1、解析:
在定义的组件或者变量没有调用的时候,eslint因其严格的规则会检测这种情况不合法,所以,我们在这个过于严格的规则上下狠手——关闭它!
2、更改两个文件:
一个是package.json,一个是vue.config.js
1、package.json
在"eslintConfig"函数下的“rule"函数添加:"no-unused-components": "off"
"no-unused-components": "off"
2、vue.config.js
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
更改为:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false
})
如有错误,请大佬指正!