# san/no-unused-vars

disallow unused variable definitions of s-for directives or scope attributes

  • ⚙️ This rule is included in all of "plugin:san/essential", "plugin:san/strongly-recommended" and "plugin:san/recommended".

# 📖 Rule Details

This rule report variable definitions of s-for directives or scope attributes if those are not used.

<template> <!-- ✓ GOOD --> <div s-for="i in 5"> <div>{{ i }}</li> </div> <div s-for="i in 5"> <div class="{{i}}"></li> </div> <!-- ✗ BAD --> <div s-for="i in 5"> <div>item</div> </div> <div s-for="i in 5"> <div class="i"></li> </div> </template>
Now loading...

# 🔧 Options

{
    "san/no-unused-vars": ["error", {
        "ignorePattern": "^_"
    }]
}
  • ignorePattern ... disables reporting when your definitions of s-for directives or scope attributes match your ignorePattern Regular expression. default null, will ignore nothing

# 🚀 Suggestion

  • When your ignorePattern set to ^_, we could provide a suggestion which add a prefix_ to your variable and no more eslint error

# 🔍 Implementation

Last Updated: 10/26/2021, 7:23:11 AM