After eslint adds typescript check, there will be an error when the attribute variable in the class definition is Array.
this is my eslintrc.js
module.exports = { root: true, env: { node: true }, 'extends': ['plugin:vue/essential', '@vue/standard'], rules: {}, parserOptions: { parser: '@typescript-eslint/parser', project: "./tsconfig.json" }, plugins: ['@typescript-eslint'] };
To apply the ESLint no-unused-vars rule to a block of JavaScript code, we can wrap the code block that we want to apply the rule to with /* eslint-disable no-unused-vars */ and /* eslint-enable no-unused-vars */ respectively. to wrap the code that we want the rule to apply with the comments.
Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.
If you are using ESLint and you need to disable the next line, use this code: eslint-disable-next-line.
The solution is to disable the native no-unused-vars
so that only the TS one is enabled. The former is likely to be enabled if you extend a config in ESLint. Add the rules below to your ESLint config.
"rules": { "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With