Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 1.39 KB

require-stores-init.md

File metadata and controls

54 lines (35 loc) · 1.39 KB
pageClass sidebarDepth title description
rule-details
0
svelte/require-stores-init
require initial value in store

svelte/require-stores-init

require initial value in store

  • This rule has not been released yet.

📖 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.

🔍 Implementation