feat(linter): move react/rules_of_hooks to nursery

This commit is contained in:
Boshen 2024-05-13 18:30:41 +08:00
parent 44b16ef79d
commit 6edcae86cd
No known key found for this signature in database
GPG key ID: 9C7A8C8AB22BEBD1
2 changed files with 3 additions and 3 deletions

View file

@ -102,7 +102,7 @@ declare_oxc_lint!(
/// <https://reactjs.org/docs/hooks-rules.html>
///
RulesOfHooks,
correctness
nursery
);
impl Rule for RulesOfHooks {
@ -846,7 +846,7 @@ fn test() {
// This *must* be invalid.
"
function useHook() {
if (a) return;
if (a) return;
useState();
}
",

View file

@ -4,7 +4,7 @@ expression: rules_of_hooks
---
× eslint-plugin-react-hooks(rules-of-hooks): React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render.
╭─[rules_of_hooks.tsx:4:15]
3 │ if (a) return;
3 │ if (a) return;
4 │ useState();
· ──────────
5 │ }