effector/eslint-plugin

Rule: `prefer-serializable-value-in-store`

igorkamyshev opened this issue · 1 comments

This code

const $data = createStore(new Date())
const setData = createEvent<Date>()

const scope1 = fork()

await allSettled(setData, { scope: scope1, params: new Date('2020-01-01') })

const json = JSON.stringify(serialize(scope))

const scope2 = fork()

hydrate(scope2, { values: JSON.parse(json) })

will produce error because Date will be serialized to ISO-format, but won't be deserialized back.

We can warn user about it