disallow
this
inasyncData/fetch
- ⚙️ This rule is included in
"plugin:nuxt/base"
.
This rule is for preventing using this
in asyncData/fetch
NOTE:
No this in fetch
is only for Nuxt.js < 2.12.0, Nuxt.js v2.12 has introduced newfetch
API which supportsthis
.
Examples of incorrect code for this rule:
export default {
...foo,
async asyncData() {
if (this.$route.path === 'foo') {
}
}
}
Examples of correct code for this rule:
export default {
...foo,
async asyncData() {
// no this
}
}