# san/this-in-template
disallow usage of
this
in template
- ⚙️ This rule is included in
"plugin:san/recommended"
.
# 📖 Rule Details
This rule aims at preventing usage of this
in San templates.
<template>
<!-- ✓ GOOD -->
<a href="{{url}}">
{{ text }}
</a>
<!-- ✗ BAD -->
<a href="{{this.data.get('url')}}">
{{ this.data.get('text') }}
</a>
</template>
# 🔧 Options
{
"san/this-in-template": ["error", "always" | "never"]
}
"always"
... Always usethis
while accessing properties from San."never"
(default) ... Never usethis
keyword in expressions.
# "always"
<template>
<!-- ✓ GOOD -->
<a href="{{this.data.get('url')}}">
{{ this.data.get('text') }}
</a>
<!-- ✗ BAD -->
<a href="{{url}}">
{{ text }}
</a>
</template>