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 21503dfCopy full SHA for 21503df
test/syntax.test.js
@@ -561,5 +561,26 @@ new MyRuleTester().run("/syntax", {
561
},
562
],
563
564
+ {
565
+ name: "With imports",
566
+ only: true,
567
+ code: js`
568
+ import { useState, useEffect } from 'react';
569
+
570
+ function CountAccumulator({ count }) {
571
+ const [total, setTotal] = useState(count);
572
573
+ useEffect(() => {
574
+ setTotal((prev) => prev + count);
575
+ }, [count]);
576
+ }
577
+ `,
578
+ errors: [
579
580
+ messageId: messageIds.avoidDerivedState,
581
+ data: { state: "total" },
582
+ },
583
+ ],
584
585
586
});
0 commit comments