From 6edcae86cda8922ea8f9e5eae91290018e1b1637 Mon Sep 17 00:00:00 2001 From: Boshen Date: Mon, 13 May 2024 18:30:41 +0800 Subject: [PATCH] feat(linter): move react/rules_of_hooks to nursery --- crates/oxc_linter/src/rules/react/rules_of_hooks.rs | 4 ++-- crates/oxc_linter/src/snapshots/rules_of_hooks.snap | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_linter/src/rules/react/rules_of_hooks.rs b/crates/oxc_linter/src/rules/react/rules_of_hooks.rs index e7f23620c..0e5c33111 100644 --- a/crates/oxc_linter/src/rules/react/rules_of_hooks.rs +++ b/crates/oxc_linter/src/rules/react/rules_of_hooks.rs @@ -102,7 +102,7 @@ declare_oxc_lint!( /// /// 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(); } ", diff --git a/crates/oxc_linter/src/snapshots/rules_of_hooks.snap b/crates/oxc_linter/src/snapshots/rules_of_hooks.snap index 25b1466f9..f7baebf1d 100644 --- a/crates/oxc_linter/src/snapshots/rules_of_hooks.snap +++ b/crates/oxc_linter/src/snapshots/rules_of_hooks.snap @@ -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 │ }