Background
When eslint
is selected when creating a project, an error will be reported when there are defined but unused components or defined but unused variables.
Note: I use vue3.0
.
Cause analysis
That is, the eslint
default rule leads to unnecessary error reporting.
Solution:
Modify rules
If eslint
is enabled and component
is added, an error is reported:
The “EchartsDemo” component has been registered but not used vue/no-unused-components
Solution: add the following under eslintconfig of package.JSON
or .Eslintrc.JS
(if this file exists):
"rules": {
"vue/no-unused-components": "off", // Turn off error reporting when there are components defined but not used
"no-unused-vars": "off" // turn off error reporting when there are defined but unused variables
}
Note: if both files are modified, eslintrc.JS
files have higher priority.
How do I close eslint
?
Scheme 1: do not use eslint
, of course, you can not select eslint
when creating a project, but generally encounter this problem, which is obviously the introduction of eslint
.. Scheme 2: close eslint
, and add a line of configuration in Vue.Config.JS
: lintonsave: false
.
Read More:
- Vue Error: component has been registered but not used [Two Methods to Solve]
- [Solved] component import error is declared in the statement of components
- [Solved] Vue eslint Error: Component name “*****“ should always be multi-word
- [Solved] Vue Error: error ‘xxx‘ is defined but never used no-unused-vars
- [Solved] Vue Error: error: ‘to‘ is defined but never used (no-unused-vars)
- [Solved] error ‘test‘ is assigned a value but never used no-unused-vars
- [Solved] error Component name “xxx“ should always be multi-word vue/multi-word-comp
- [Solved] Vue Project Error: Arrow function should not return assignment
- [Solved] vue Project Error: react lazy eslint error Parsing error: Unexpected token import
- [Solved] Vue 3 Script Setup ESLint Error: ‘defineProps‘ is not defined
- [Solved] Syntax Error: Error: No ESLint configuration found & TypeError: eslint.CLIEngine is not a constructor
- [Solved] ✖ 2 problem (1 error, 0 warnings) 2 error and 0 warnings potentially fixable with the`–fix`
- How to Solve VUE Error: Mixed spaces and tabs
- [Solved] Vuepress Package Error: document is not defined
- xxx is assigned a value but never used [How to Solve]
- [Solved] Errors: 1 http://eslint.org/docs/rules/quotes…elementUI Import Error
- VUE Error: Mixed spaces and tabs [How to Solve]
- Vue mutui identify (Image Verification Code)
- [Solved] Vue Error: Error in nextTick: “RangeError: Maximum call stack size exceeded“
- [Solved] Vue3 Error: error Delete `··` prettier/prettier