UNPKG

eslint-plugin-de-morgan

Version:

ESLint plugin for transforming negated boolean expressions via De Morgan’s laws

37 lines (36 loc) 1.29 kB
import { UnaryExpression } from 'estree' import { Rule } from 'eslint' interface GetStatementSafeFixOptions { /** * The negated expression ESLint node being fixed. */ node: Rule.NodeParentExtension & UnaryExpression /** * The ESLint rule context. */ context: Rule.RuleContext /** * The replacement text produced by the transform. */ fix: string } /** * Makes the fix text safe to use when the fixed node starts an expression * statement. A replacement beginning with `function`, `class`, or `{` would be * parsed as a declaration or block instead of an expression, so it is wrapped * in parentheses. A replacement beginning with `(`, `[`, a template literal, or * an arithmetic sign can merge with an unterminated previous line through * automatic semicolon insertion and silently change the program, so in that * case the fix is withheld and the function returns null. Fixes for nodes that * do not start an expression statement are returned unchanged. * * @param options - The statement safety options. * @returns The fix text, wrapped in parentheses when required, or null if the * fix cannot be applied safely. */ export declare function getStatementSafeFix({ context, node, fix, }: GetStatementSafeFixOptions): string | null export {}