Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
fix(rome_js_analyze): suppress false positive when returning call exp…
Browse files Browse the repository at this point in the history
…ressions of a hook for useHookAtTopLevel (#4538)

* fix: false positive for useHookAtTopLevel

* docs: update changelog
  • Loading branch information
nissy-dev authored May 31, 2023
1 parent 55e1613 commit 665bb9d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ was defined [#4479](https://github.com/rome/tools/issues/4479)

### Formatter

### Linter

#### Other changes

- Fix false positive diagnostics ([#4483](https://github.com/rome/tools/issues/4483)) that [`useHookAtTopLevel`](https://docs.rome.tools/lint/rules/usehookattoplevel/) caused to returning call expressions of a hook.
- Revert [#4359](https://github.com/rome/tools/issues/4359)


### Parser

#### Other changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn enclosing_function_if_call_is_at_top_level(call: &JsCallExpression) -> Option
| JsSyntaxKind::JS_BLOCK_STATEMENT
| JsSyntaxKind::JS_VARIABLE_STATEMENT
| JsSyntaxKind::JS_EXPRESSION_STATEMENT
| JsSyntaxKind::JS_RETURN_STATEMENT
| JsSyntaxKind::JS_CALL_EXPRESSION
| JsSyntaxKind::JS_INITIALIZER_CLAUSE
| JsSyntaxKind::JS_VARIABLE_DECLARATOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ export function Component4() {
export default function Component5() {
useEffect();
};

const Component6 = () => {
return useState();
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default function Component5() {
useEffect();
};

const Component6 = () => {
return useState();
};

```


0 comments on commit 665bb9d

Please sign in to comment.