Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.44 KB

no-store-async.md

File metadata and controls

56 lines (36 loc) · 1.44 KB
pageClass sidebarDepth title description
rule-details
0
svelte/no-store-async
disallow using async/await inside svelte stores

svelte/no-store-async

disallow using async/await inside svelte stores

  • ⚙️ This rule is included in "plugin:svelte/recommended".

📖 Rule Details

This rule reports all uses of async/await inside svelte stores. Because it causes issues with the auto-unsubscribing features.

/* eslint svelte/no-store-async: "error" */

import { writable, readable, derived } from "svelte/store"

/* ✓ GOOD */
const w1 = writable(false, () => {})
const r1 = readable(false, () => {})
const d1 = derived(a1, ($a1) => {})

/* ✗ BAD */
const w2 = writable(false, async () => {})
const r2 = readable(false, async () => {})
const d2 = derived(a1, async ($a1) => {})

🔧 Options

Nothing.

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-svelte v3.1.0

🔍 Implementation