Skip to content

Conversation

@aryelu
Copy link
Owner

@aryelu aryelu commented Dec 10, 2025

Description

Introduces a new ESLint rule, no-complex-conditionals, to improve code readability by limiting the number of logical operators (&&, ||, ??) within conditional statements (e.g., if, while, for, do-while, ternary).

The rule aims to prevent overly complex conditions that are difficult to parse and maintain, encouraging developers to extract intricate logic into separate variables or functions. It is configurable via maxOperators, with a default limit of 2.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

A new test file, tests/no-complex-conditionals.test.ts, was created following a TDD approach. It includes comprehensive valid and invalid cases to verify the rule's behavior with default and custom maxOperators configurations across different conditional statement types.

To reproduce, run:

pnpm test tests/no-complex-conditionals.test.ts

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Open in Cursor Open in Web

Co-authored-by: the0nexus <the0nexus@gmail.com>
@cursor
Copy link

cursor bot commented Dec 10, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@aryelu aryelu marked this pull request as ready for review December 10, 2025 19:39
Co-authored-by: the0nexus <the0nexus@gmail.com>
@aryelu aryelu merged commit 8539ba2 into main Dec 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants