Eslint no-unused-vars error shows for used interface in Vue Eslint no-unused-vars error shows for used interface in Vue vue.js vue.js

Eslint no-unused-vars error shows for used interface in Vue


Solution:

EsLint default no-unused-vars has an bug, that reproduces like you explain. According to my source [1] it should be fixed by using @typescript-eslint/no-unused-vars like so:

overrides: [   // Fix no-used-vars when importing ts types in .vue files   {     files: ["*.vue"],     rules: {        'no-unused-vars': 'off',        '@typescript-eslint/no-unused-vars': 'error'     }  }]

Source [2] is another question on same topic. There, my solution [1] is one option among others. In [2] and [3] it is said you need the @typescript-eslint/eslint-plugin and @typescript-eslint/parser installed like so:

npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin

Source:

[1] https://github.com/vuejs/eslint-config-typescript/issues/14

[2] ESLint - Configuring "no-unused-vars" for TypeScript

[3] https://khalilstemmler.com/blogs/typescript/eslint-for-typescript/