Skip to content

Commit 2c93b6c

Browse files
committed
test(no-pass-data-to-parent): cleanup function with MemberExpression
#43
1 parent 72ecd19 commit 2c93b6c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/no-pass-data-to-parent.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ new MyRuleTester().run("no-pass-data-to-parent", rule, {
165165
};
166166
`,
167167
},
168+
{
169+
// https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect/issues/43
170+
name: "Effect inside custom hook returns MemberExpression cleanup",
171+
code: js`
172+
function useActorLogger(actorRef) {
173+
useEffect(() => {
174+
return actorRef.system.inspect((next) => {
175+
if (next.type === '@xstate.snapshot') {
176+
console.log('ACTOR SNAPSHOT', next.snapshot);
177+
}
178+
}).unsubscribe;
179+
}, [actorRef]);
180+
}
181+
`,
182+
},
168183
],
169184
invalid: [
170185
{

0 commit comments

Comments
 (0)