An ESLint plugin that enforces logical consistency by transforming negated boolean expressions using De Morgan's laws.
ESLint Plugin De Morgan is an ESLint plugin that automatically transforms negated boolean expressions using De Morgan's laws. It rewrites expressions like `!(A && B)` into `!A || !B` and `!(A || B)` into `!A && !B` to improve logical clarity and consistency in code.
JavaScript and TypeScript developers who want to enforce consistent boolean logic transformations and improve code readability in their projects.
It provides automated, mathematically grounded transformations that reduce logical errors and enhance code clarity, integrating seamlessly into existing ESLint workflows with auto-fix capabilities.
🧵 ESLint plugin for transforming negated boolean expressions via De Morgan’s laws
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides auto-fix capabilities via ESLint's --fix option, automatically rewriting negated expressions like !(a && b) into !a || !b without manual intervention.
Grounded in De Morgan's laws from Boolean algebra, ensuring transformations are logically correct and consistent, as emphasized in the README's philosophy.
Offers ready-made configs for both flat and legacy ESLint configurations, simplifying setup with minimal configuration effort.
Includes detailed examples in the README, such as transforming complex expressions like !(a || !b || c >= 10), making it easy to understand the transformations.
Only includes two rules (no-negated-conjunction and no-negated-disjunction), missing broader boolean logic optimizations or edge cases like nested negations with mixed operators.
May enforce transformations that override team preferences for negation placement, potentially reducing readability in contexts where negated expressions are clearer.
Requires ESLint to be installed and configured, adding overhead for projects not already using ESLint or opting for alternative linting tools.