eslint-plugin
eslint-plugin copied to clipboard
Rule: `prefer-serializable-value-in-store`
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
cc @alatielle