Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let's change the utils isBooleanNode(node) to isInControlFlow(node) #2449

Open
axetroy opened this issue Sep 11, 2024 · 0 comments
Open

Let's change the utils isBooleanNode(node) to isInControlFlow(node) #2449

axetroy opened this issue Sep 11, 2024 · 0 comments
Labels

Comments

@axetroy
Copy link
Contributor

axetroy commented Sep 11, 2024

/**
Check if the value of node is a `boolean`.
@param {Node} node
@returns {boolean}
*/
function isBooleanNode(node) {
if (
isLogicNot(node)
|| isLogicNotArgument(node)
|| isBooleanCall(node)
|| isBooleanCallArgument(node)

Currently, this function is too complicated, judging both the node itself and the node's parent.

It is easy to false positives (#1840). Let's split this into two functions

  • isBooleanExpression(node) - Implemented
  • isInControlFlow(node) - create a new function
@axetroy axetroy added the bug label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant