We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76c8a43 commit ad70014Copy full SHA for ad70014
test/syntax.test.js
@@ -561,5 +561,25 @@ new MyRuleTester().run("/syntax", {
561
},
562
],
563
564
+ {
565
+ name: "With imports",
566
+ code: js`
567
+ import { useState, useEffect } from 'react';
568
+
569
+ function CountAccumulator({ count }) {
570
+ const [total, setTotal] = useState(count);
571
572
+ useEffect(() => {
573
+ setTotal((prev) => prev + count);
574
+ }, [count]);
575
+ }
576
+ `,
577
+ errors: [
578
579
+ messageId: messageIds.avoidDerivedState,
580
+ data: { state: "total" },
581
+ },
582
+ ],
583
584
585
});
0 commit comments