DEV Community

Sardorbek Imomaliev
Sardorbek Imomaliev

Posted on

 

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

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.