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

fix(rome_js_analyze): suppress false positive when returning call expressions of a hook for useHookAtTopLevel #4538

Merged
merged 4 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ was defined [#4479](https://github.com/rome/tools/issues/4479)
### Editors
### 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.

### Parser
### VSCode
### JavaScript APIs
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();
};

```