Skip to content

Commit 89f6bee

Browse files
committed
test: add test case for prefer-use-state-lazy-initialization rule
1 parent 704541d commit 89f6bee

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/plugins/eslint-plugin-react-hooks-extra/src/rules/prefer-use-state-lazy-initialization.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,22 @@ ruleTester.run(RULE_NAME, rule, {
265265
code: tsx`
266266
import { useState, use } from 'react';
267267
268+
function Shell({data}) {
269+
const [root, setRoot] = useState(use(data));
270+
updateRoot = setRoot;
271+
return root;
272+
}
273+
`,
274+
settings: {
275+
"react-x": {
276+
version: "19.0.0",
277+
},
278+
},
279+
},
280+
{
281+
code: tsx`
282+
import { useState, use } from 'react';
283+
268284
const promise = Promise.resolve();
269285
270286
function App() {

0 commit comments

Comments
 (0)