Synchronous derived
stores should not trigger require-stores-init
#1073
Labels
enhancement
New feature or request
Overview
I've been using the
3.0.0-next
version in our Svelte project, and I'm really liking the new recommended set of rules! However, I've had to disablerequire-stores-init
, because it triggered on nearly every single usage ofderived
.Proposal
I think
require-stores-init
makes a lot of sense forwritable
andreadable
stores - it's goal seems to be to prevent an implicitlyundefined
store values. However, I think synchronousderived
stores should not trigger therequire-stores-init
lint. If aderived
store is synchronous, there is no risk that its value can be implicitly undefined, because it will run its callback synchronously when it gets its first subscriber.If you agree with this change, I'm happy to contribute a PR!
Alternatives
Alternatively, I could imagine a configuration option that allows you to selectively enable or disable
require-stores-init
for each store type. However, I think enforcing this rule on asynchronousderived
stores is valuable, so I prefer my proposal above.The text was updated successfully, but these errors were encountered: