Skip to content

Commit

Permalink
feat(linter): move react/rules_of_hooks to nursery
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed May 13, 2024
1 parent 44b16ef commit 6edcae8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/react/rules_of_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ declare_oxc_lint!(
/// <https://reactjs.org/docs/hooks-rules.html>
///
RulesOfHooks,
correctness
nursery
);

impl Rule for RulesOfHooks {
Expand Down Expand Up @@ -846,7 +846,7 @@ fn test() {
// This *must* be invalid.
"
function useHook() {
if (a) return;
if (a) return;
useState();
}
",
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/snapshots/rules_of_hooks.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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]
3if (a) return;
3if (a) return;
4useState();
· ──────────
5 │ }
Expand Down

0 comments on commit 6edcae8

Please sign in to comment.