From 35a0f895dcc95592a4b1e566dff807a73e35f53d Mon Sep 17 00:00:00 2001 From: keita hino Date: Fri, 23 Feb 2024 16:55:28 +0900 Subject: [PATCH] fix(linter): Handle cases where createElement is an Identifier in is_create_element_call (#2474) I fixed a false negative issue in the `is_create_element_call` function where createElement was an Identifier. https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/utils/react.rs#L13-L19 In the case of [eslint-plugin-react's button-has-type rule](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md), the following triggers the expected errors: ```ts // error React.createElement("button") // error createElement("button") ``` However, with Oxlint, it behaves differently: ```ts // error React.createElement("button") // false negative createElement("button") ``` --- crates/oxc_linter/src/rules/react/button_has_type.rs | 2 ++ crates/oxc_linter/src/snapshots/button_has_type.snap | 7 +++++++ crates/oxc_linter/src/utils/react.rs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/crates/oxc_linter/src/rules/react/button_has_type.rs b/crates/oxc_linter/src/rules/react/button_has_type.rs index 1ad7d7102..637700eef 100644 --- a/crates/oxc_linter/src/rules/react/button_has_type.rs +++ b/crates/oxc_linter/src/rules/react/button_has_type.rs @@ -223,6 +223,7 @@ fn test() { (r"