Skip to content

Files

Latest commit

 

History

History
43 lines (27 loc) · 1.09 KB

require-stores-init.md

File metadata and controls

43 lines (27 loc) · 1.09 KB

Pattern: Missing initial value in store

Issue: -

Description

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