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

Enable Style/TrailingCommaInArguments: { EnforcedStyleForMultiline: comma } #28

Merged
merged 3 commits into from
May 30, 2017

Conversation

Narazaka
Copy link
Contributor

# Good
foo(
  1,
  2,
)
  • Rubyはリテラル、引数ともにケツカンマを許しています
  • 複数行ケツカンマはgit等の差分を綺麗にします(実態はadd:1なのにadd:2/delete:1になるのを防ぐ)
  • リテラルがケツカンマ推奨なので引数もケツカンマ推奨にするほうが一貫性があります
  • 世界はケツカンマを許すほうへ動いています(JavaScriptは昔リテラル引数ともケツカンマを許さなかった(IEなど)が、現在はリテラルで許すようになり、さらにES2017では引数でも許す提案がなされているなど)

ゆえに引数もケツカンマ推奨にしたいと思います。

Narazaka and others added 3 commits May 30, 2017 16:55
Ruby allows trailing comma for function argument.
Trailing comma of function argument seems abnormal, but the world is evolving toward that as ES2017 has this proposal.

JSON's spec does not allow trailing comma, but it is written long ago.
JavaScript allows Trailing comma in literal since IE9.
It is better to detect correct lines of difference.

```
# Bad
2 insertions(+), 1 deletion(-)
# Good
1 insertions(+)
```

Unify trailing commas as following rule.

* Single line always avoid trailing comma
* Multiple line always add trailing comma
@onk onk merged commit c568222 into onk:master May 30, 2017
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.

2 participants