Currently, I'm working with Vue along with Vue CLI and Typescript.
I have imported an interface from a Vuex file and utilized it for type annotation in mapState
.
However, I am encountering an error flagged by eslint.
'State' is defined but never used. eslint(no-unused-vars)
Here's the code snippet:
import { Component, Vue } from 'vue-property-decorator';
import { mapState } from 'vuex';
import { State } from '@/store/index';
@Component({
computed: mapState<State>({
cards: (state: State) => state.user.cards,
})
})
export default class Home extends Vue {}
.eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended',
'@vue/typescript'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'quotes': ['error', 'single'],
'semi': ['warn', 'always']
},
parserOptions: {
parser: '@typescript-eslint/parser'
}
};
How can I resolve this eslint error?