eslint-plugin-de-morgan
Version:
ESLint plugin for transforming negated boolean expressions via De Morgan’s laws
22 lines (21 loc) • 716 B
TypeScript
import { Node } from 'estree'
import { Rule } from 'eslint'
type ParentedNode = {
parent?: Node
} & Node
/**
* Determines whether a given expression is used in a boolean context.
*
* Boolean contexts include conditions in control flow statements (`if`,
* `while`, `for`), logical expressions (`&&`, `||`), explicit boolean coercions
* (`!!`, `Boolean(expr)`), and comparison operations (`===`, `!==`, `<`, `>`).
*
* @param node - The AST node to check.
* @param [_context] - The ESLint rule context (technical argument).
* @returns True if the expression is used in a boolean context.
*/
export declare function hasBooleanContext(
node: ParentedNode,
_context: Rule.RuleContext,
): boolean
export {}