Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapping configuration for comparison operators #678

Open
One-Nose opened this issue Feb 11, 2024 · 1 comment
Open

Add wrapping configuration for comparison operators #678

One-Nose opened this issue Feb 11, 2024 · 1 comment
Labels
enhancement New feature or request wrapping Incorrect or undesirable wrapping

Comments

@One-Nose
Copy link

Describe the Feature

There is no way to configure wrapping for comparison operators, to allow prettier long if conditions. I have this code:

if (this.actionsByPriority.indexOf(action) < this.actionsByPriority.indexOf(availableAction) {}

Desired output

if (
    this.actionsByPriority.indexOf(action) <
    this.actionsByPriority.indexOf(availableAction)
) {}
@AlexHaxe AlexHaxe added enhancement New feature or request wrapping Incorrect or undesirable wrapping labels Feb 11, 2024
@AlexHaxe
Copy link
Member

can't say I find your desired output easier to read, especially if you had multiple compare operations in a single if condition.

what would look prettier is to extract those terms into variables before comparing, but that is beyond the scope of a formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wrapping Incorrect or undesirable wrapping
Projects
None yet
Development

No branches or pull requests

2 participants