DEV Community

Sardorbek Imomaliev
Sardorbek Imomaliev

Posted on

10 3

TIL: ESLint | Fix "'props' is assigned a value but never used @typescript-eslint/no-unused-vars"

Story

This is a continuation of script setup syntax usage. eslint thinks that variables like props, emits etc. are not used, but actually they are.

Question

How to fix ESLint error 'props' is assigned a value but never used @typescript-eslint/no-unused-vars?

Answer

Add vue/script-setup-uses-vars rule to eslint.

ESLint no-unused-vars rule does not detect variables in <script setup> used in <template>. This rule will find variables in <script setup> used in <template> and mark them as used.

module.exports = {
  // Use the rule set.
  extends: ['plugin:vue/base'],
  rules: {
    // Enable vue/script-setup-uses-vars rule
+     'vue/script-setup-uses-vars': 'error',
  }
}
Enter fullscreen mode Exit fullscreen mode

Links

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay