Typescript: how to fix error: is defined but never used no-unused-vars?


Sample error:

D:\TypeScript\Vue\my-project\src\App.vue
  147:34  error  'oldQuestion' is defined but never used  no-unused-vars

x 1 problem (1 error, 0 warnings)

Add: "no-unused-vars": "off" to file package.json

Example:

...
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended",
      "@vue/typescript"
    ],
    "parserOptions": {
      "parser": "@typescript-eslint/parser"
    },
    "rules": {
      "no-unused-vars": "off"
    }
  },
...

Restart dev server

Leave a Reply