import-js/eslint-plugin-import

[import/no-duplicates] Extra comma added when fixer is run

Open

#2,757 opened on Apr 9, 2023

View on GitHub
 (0 comments) (2 reactions) (0 assignees)JavaScript (1,540 forks)batch import
bughelp wanted

Repository metrics

Stars
 (4,946 stars)
PR merge metrics
 (Avg merge 138d 22h) (3 merged PRs in 30d)

Description

Input:

import { Foo } from "someImport";
import {
  BarLongNameToEnsureLineBreak,
  BazManLongNameToEnsureLineBreak,
} from "someImport";
import { Qux } from "someImport";

const foo: Foo = "foo";
const bar: BarLongNameToEnsureLineBreak = "bar";
const baz: BazManLongNameToEnsureLineBreak = "baz";
const qux: Qux = "qux";

output:

import { Foo ,
  BarLongNameToEnsureLineBreak,
  BazManLongNameToEnsureLineBreak,
, Qux } from "someImport";

const foo: Foo = "foo";
const bar: BarLongNameToEnsureLineBreak = "bar";
const baz: BazManLongNameToEnsureLineBreak = "baz";
const qux: Qux = "qux";

Note the commas at the end of line 3 and start of line 4.

Possibly related to #2601, tho in that case it appears that the opposite problem is occurring: no comma when there should be

Contributor guide