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

tslint: Enable trailing-comma #2407

Closed
wants to merge 1 commit into from
Closed

tslint: Enable trailing-comma #2407

wants to merge 1 commit into from

Commits on Jul 19, 2018

  1. tslint: Enable trailing-comma

    I like when people use a trailing comma in comma-separated definitions.
    Turns out there is a tslint rule for it!  And it also has an autofixer,
    so I ran tslint --fix to generate this patch.  I sampled a few files and
    the results seems good.
    
    For example, I would prefer this:
    
    const foo = [
      A,
      B,
      C,
    ];
    
    rather than:
    
    const foo = [
      A,
      B,
      C
    ];
    
    The main reason is that it simplifies diffs where you add a new item.
    You don't need to change the line containing "C".
    
    With the "multiline" setting, things like this are not affected:
    
    const foo = [ A, B, C ];
    
    If you want to add "D", you'll need to change the line anyway, so the
    comma would not help here.
    
    Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
    Simon Marchi committed Jul 19, 2018
    Configuration menu
    Copy the full SHA
    7bbdf48 View commit details
    Browse the repository at this point in the history