Skip to content
This repository was archived by the owner on Dec 4, 2022. It is now read-only.
This repository was archived by the owner on Dec 4, 2022. It is now read-only.

always require trailing-commas, documentation mismatch #12

@Koslun

Description

@Koslun

I'm submitting a ... (check one with "x")

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request

Current behavior

The description demands the use of trailing commas:

Always prefer trailing commas in array and object literals, destructuring assignments, function typings, named imports/exports and function parameters.

But all trailing commas are disallowed

"trailing-comma": [
  true,
  {
    "multiline": "never",
    "singleline": "never",
    "esSpecCompliant": true
  }
]

Tslint rule: https://palantir.github.io/tslint/rules/trailing-comma/
Similar Eslint rule: https://eslint.org/docs/rules/comma-dangle

Expected/desired behavior

Change rule to always enforce trailing comma. So instead would expect something like this:

"trailing-comma": [
  true,
  {
    "multiline": "always",
    "singleline": "never",
    "esSpecCompliant": true
  }
]

Minimal reproduction of the problem with instructions

Made an array and object to validate that they could not have trailing commas.

What is the motivation / use case for changing the behavior?

Description does not match behavior. And as described for the equivalent Eslint rule, this rule:

improves the clarity of diffs when an item is added or removed from an object or array

So would rather change the behavior to match the description than the other way round.

Environment

  • Angular version: 5.0.3
  • Browser:
  • Chrome (desktop) version XX
  • Chrome (Android) version XX
  • Chrome (iOS) version XX
  • Firefox version XX
  • Safari (desktop) version XX
  • Safari (iOS) version XX
  • IE version XX
  • Edge version XX
  • For Tooling issues:
  • Node version: 8
  • Platform: Windows
  • Others:

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions