Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 1.33 KB

require-stores-init.md

File metadata and controls

57 lines (37 loc) · 1.33 KB
pageClass sidebarDepth title description since
rule-details
0
svelte/require-stores-init
require initial value in store
v2.5.0

svelte/require-stores-init

require initial value in store

📖 Rule Details

This rule is aimed to enforce initial values when initializing the Svelte stores.

/* eslint svelte/require-stores-init: "error" */

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

/* ✓ GOOD */
export const w1 = writable(false)
export const r1 = readable({})
export const d1 = derived([a, b], () => {}, false)

/* ✗ BAD */
export const w2 = writable()
export const r2 = readable()
export const d2 = derived([a, b], () => {})

🔧 Options

Nothing.

❤️ Compatibility

This rule was taken from @tivac/eslint-plugin-svelte.
This rule is compatible with @tivac/svelte/stores-initial-value rule.

🚀 Version

This rule was introduced in eslint-plugin-svelte v2.5.0

🔍 Implementation