eslint-plugin-unicorn icon indicating copy to clipboard operation
eslint-plugin-unicorn copied to clipboard

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

Open axetroy opened this issue 5 months ago • 1 comments

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/d3e4b805da31c6ed7275e2e2e770b6b0fbcf11c2/rules/utils/boolean.js#L26-L37

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 avatar Sep 11 '24 06:09 axetroy