Skip to content

Latest commit

 

History

History
55 lines (38 loc) · 985 Bytes

no-duplicate-store-ids.md

File metadata and controls

55 lines (38 loc) · 985 Bytes

Disallow duplicate store ids (pinia/no-duplicate-store-ids)

💼⚠️ This rule is enabled in the ✅ recommended config. This rule warns in the 🌐 all config.

Rule Details

❌ Examples of incorrect code for this rule:

// a.js
export const useBarStore = defineStore('bar', () => {
  const bar = ref(0)

  return { bar }
})

// b.js
export const useAnotherBarStore = defineStore('bar', () => {
  const foo = ref(0)

  return { foo }
})
export const useBarStore = defineStore('bar', () => {
  const bar = ref(0)

  return { bar }
})

export const useAnotherBarStore = defineStore('bar', () => {
  const foo = ref(0)

  return { foo }
})

✅ Examples of correct code for this rule:

export const useBarStore = defineStore('bar', () => {
  const bar = ref(0)

  return { bar }
})

export const useAnotherCounterStore = defineStore('foo', () => {
  const foo = ref(0)

  return { foo }
})