mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
parent
1925ddc59b
commit
be9863a415
2 changed files with 13 additions and 1 deletions
|
|
@ -943,7 +943,11 @@ fn test() {
|
|||
|
||||
const useSWRFn = immutable ? useSWRImutable : useSWR;
|
||||
return useSWRFn(options ? () => ['cloud', options.query.id, options.variables] : null, options ? () => fetcher(options) : null, configWithSuspense);
|
||||
};"
|
||||
};",
|
||||
// https://github.com/oxc-project/oxc/issues/6651
|
||||
r"const MyComponent = makeComponent(() => { useHook(); });",
|
||||
r"const MyComponent2 = makeComponent(function () { useHook(); });",
|
||||
r"const MyComponent4 = makeComponent(function InnerComponent() { useHook(); });"
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
|
|
@ -1577,6 +1581,8 @@ fn test() {
|
|||
// });
|
||||
// }
|
||||
// " ,
|
||||
// https://github.com/oxc-project/oxc/issues/6651
|
||||
r"const MyComponent3 = makeComponent(function foo () { useHook(); });",
|
||||
];
|
||||
|
||||
Tester::new(RulesOfHooks::NAME, RulesOfHooks::CATEGORY, pass, fail).test_and_snapshot();
|
||||
|
|
|
|||
|
|
@ -674,3 +674,9 @@ source: crates/oxc_linter/src/tester.rs
|
|||
· ───────────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-react-hooks(rules-of-hooks): React Hook "useHook" is called in function "foo" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".
|
||||
╭─[rules_of_hooks.tsx:1:45]
|
||||
1 │ const MyComponent3 = makeComponent(function foo () { useHook(); });
|
||||
· ───
|
||||
╰────
|
||||
|
|
|
|||
Loading…
Reference in a new issue