Skip to content
Snippets Groups Projects
  • Jed Fox's avatar
    54fa4bcc
    Enable 'curly' rule (#1015) · 54fa4bcc
    Jed Fox authored
    Multi-line `if`/`for` statements in JS can be confusing since there
    aren’t braces to indicate which code is enclosed in the statement. I set
    the configuration to `multi-line` to enforce usage of braces for
    multi-line statement bodies, but still allow things like `if (foo)
    return;`. I additionally added the `consistent` option to require braces
    for all elements of an if/else chain if one element has it. As you can
    see, this set of options pretty closely matches the existing code style.
    
    I was going to comment in #1008 about this stylistic change but realized
    that it’s (IMO) a little impolite to ask for code style changes unless
    they can be automatically enforced.
    
    Note that `if (foo) { \n return; \n }` is still valid and won’t be
    collapsed. I tried to automatically collapse all such cases but it was a
    lot of files and I didn’t want to pick out the useful from the useless
    differences.
    Enable 'curly' rule (#1015)
    Jed Fox authored
    Multi-line `if`/`for` statements in JS can be confusing since there
    aren’t braces to indicate which code is enclosed in the statement. I set
    the configuration to `multi-line` to enforce usage of braces for
    multi-line statement bodies, but still allow things like `if (foo)
    return;`. I additionally added the `consistent` option to require braces
    for all elements of an if/else chain if one element has it. As you can
    see, this set of options pretty closely matches the existing code style.
    
    I was going to comment in #1008 about this stylistic change but realized
    that it’s (IMO) a little impolite to ask for code style changes unless
    they can be automatically enforced.
    
    Note that `if (foo) { \n return; \n }` is still valid and won’t be
    collapsed. I tried to automatically collapse all such cases but it was a
    lot of files and I didn’t want to pick out the useful from the useless
    differences.