Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Latest commit

 

History

History
44 lines (28 loc) · 781 Bytes

no-this-in-fetch-data.md

File metadata and controls

44 lines (28 loc) · 781 Bytes

nuxt/no-this-in-fetch-data

disallow this in asyncData/fetch

  • ⚙️ This rule is included in "plugin:nuxt/base".

Rule Details

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 new fetch API which supports this.

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
  }
}

🔍 Implementation