Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

curly: Add "as-needed" option #2842

Merged
merged 3 commits into from May 31, 2017
Merged

Conversation

andy-hanson
Copy link
Contributor

@andy-hanson andy-hanson commented May 29, 2017

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

Adds the never option, which forbids unnecessary curly braces.

CHANGELOG.md entry:

[new-rule-option] curly: "as-needed" option

@@ -0,0 +1,24 @@
if (so) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one edge case that needs to be handled. You can't remove the curly braces in the following example

if (foo) {
    if (bar)
        foo(bar);
} else
    bar();

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this option name is similar to trailing-comma and space-before-function-paren, etc. but I think naming it "as-needed" instead of "never" would be less confusing & closer to the true intention of its implementation

@adidahiya adidahiya changed the title curly: Add "never" option curly: Add "as-needed" option May 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants