Andrey Ravkov
Andrey Ravkov

Reputation: 1484

eslint [vue/no-unused-vars] error in vue template

Maybe this will be useful to somebody.

i have vue template with html in it

<template slot="HEAD_Status" slot-scope="data">
    <!-- some html without using of data -->
</template>

And Eslint generate [vue/no-unused-vars] 'data' is defined but never used.

I tried to use eslint-disable-line without any success (looks like because it's in vue file) :(

Upvotes: 2

Views: 2315

Answers (1)

Andrey Ravkov
Andrey Ravkov

Reputation: 1484

i edit my template:

<template slot="HEAD_Status" slot-scope="{}"></template>

e.g. replace data to {} in slot-scope.

Looks like another solution, we can move html from vue template to html file:

<template src="./someTemaplte.html></template>

And in someTemaplte.html insert our html:

<template slot="HEAD_Status" slot-scope="data"></template>

P.S. i didn't try the solution with a move to html file.

Upvotes: 1

Related Questions