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

type-literal-delimiter: Prefer ';' instead of ',', and lint for trailing delimiter #2787

Merged
merged 3 commits into from
May 20, 2017

Conversation

andy-hanson
Copy link
Contributor

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

PR checklist

Overview of change:

Switches the preference to ; instead of ,.
Checks for a trailing delimiter in multiline type literals, and for no trailing delimiter in single-line type literals.

Blocked waiting on #2789.

CHANGELOG.md entry:

[rule-change] type-literal-delimiter: Prefer ; instead of ,, and lint for trailing delimiter

@nchen63 nchen63 merged commit ce4dbfe into palantir:master May 20, 2017
@nchen63
Copy link
Contributor

nchen63 commented May 20, 2017

Wait, semicolons seem unexpected here:

function f(arg: { a: number; b: string })

Yet, I get @adidahiya's comment on

type t = {
  a: number,
  b: string
}

also being inconsistent with interface. Is it worth it to make a more complicated rule and be inconsistent? I think I'd rather see all commas instead of the 1st example.

@andy-hanson andy-hanson deleted the type-literal-delimiter-semi branch May 20, 2017 22:52
@adidahiya
Copy link
Contributor

yeah I noticed that weirdness too @nchen63... I think we should add more configuration to the rule before enabling it in the built-in configs (I noticed you removed it from tslint:latest in the v5.3 release PR 👍)

how about we make single-line type literal checking opt-in for this rule? there could be a rule option called "check-single-line" that enforces the specified delimiter type?

@nchen63
Copy link
Contributor

nchen63 commented May 22, 2017

I think I'm going to make a fork that doesn't use this rule so we can think about it some more and publish based on the fork

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.

3 participants