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

Semicolon rule incorrectly fixes trailing commas #1856

Closed
greglo opened this issue Dec 12, 2016 · 1 comment
Closed

Semicolon rule incorrectly fixes trailing commas #1856

greglo opened this issue Dec 12, 2016 · 1 comment

Comments

@greglo
Copy link

greglo commented Dec 12, 2016

Bug Report

  • TSLint version: 4.0.2
  • TypeScript version: 2.0.3
  • Running TSLint via: CLI

TypeScript code being linted with --fix

interface ITest {
    trailingComma: string,
}

Actual behavior

A semicolon is appended instead of replacing the comma

interface ITest {
    trailingComma: string,;
}

Expected behavior

The comma is replaced with a semicolon

interface ITest {
    trailingComma: string;
}

See failing test case: greglo@66e7022

greglo added a commit to greglo/tslint that referenced this issue Dec 12, 2016
@rjmunro
Copy link

rjmunro commented Dec 23, 2016

Also, if every time you run the fix again, you get another ;:

So:

interface ITest {
    trailingComma: string,;;
}

Then:

interface ITest {
    trailingComma: string,;;;
}

etc.

I would expect fixes to be idempotent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants