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

Latest commit

 

History

History
38 lines (24 loc) · 701 Bytes

no-globals-in-created.md

File metadata and controls

38 lines (24 loc) · 701 Bytes

nuxt/no-globals-in-created

disallow window/document in created/beforeCreate

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

Rule Details

This rule is for preventing using window/document in created/beforeCreate, since created/beforeCreate may be executed in server side in SSR.

Examples of incorrect code for this rule:

export default {
  created() {
    window.foo = 'bar'
  }
}

Examples of correct code for this rule:

export default {
  created() {
    const foo = 'bar'
  }
}

🔍 Implementation