From 079081aced415460dc54fa9ce701e8baed57644a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Oliva?= Date: Sun, 26 Mar 2023 00:00:41 +0100 Subject: [PATCH] Add `observable(() => ...)` into reactivity whitelist --- src/rules/reactivity.ts | 1 + test/rules/reactivity.test.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/rules/reactivity.ts b/src/rules/reactivity.ts index 50665c3..e20911c 100644 --- a/src/rules/reactivity.ts +++ b/src/rules/reactivity.ts @@ -895,6 +895,7 @@ export default createRule({ "untrack", "mapArray", "indexArray", + "observable", ], callee.name ) || diff --git a/test/rules/reactivity.test.ts b/test/rules/reactivity.test.ts index 7dd1e26..3fa55cc 100644 --- a/test/rules/reactivity.test.ts +++ b/test/rules/reactivity.test.ts @@ -293,6 +293,11 @@ export const cases = run("reactivity", rule, { const staticValue = () => props.value; const value = staticValue(); }`, + // observable + `function Component(props) { + const count$ = observable(() => props.count); + return
; + }`, ], invalid: [ // Untracked signals