import-sort icon indicating copy to clipboard operation
import-sort copied to clipboard

Bug: Duplicated commented imports

Open dawsbot opened this issue 4 years ago • 1 comments

Running prettier on a file with a comment as the last import duplicates that comment

image

the axios import is multiplied each time I run prettier

This applies to not just imports, it occurs for any comment which immediately follows your imports without a blank line in-between


Run prettier once

image

Run prettier three times

image

The commented out imports also multiply

Repro Steps

  1. Create a .tsx file where the last import is commented out
  2. npx prettier --write FILE_NAME on a file where the imports end in a commented out import

More Information

I came to this error by using https://github.com/ggascoigne/prettier-plugin-import-sort/issues/13 in my prettier config, and after opening an issue there, they directed me here.

dawsbot avatar Jun 19 '20 16:06 dawsbot

Hi @renke , any thoughts on this?

dawsbot avatar Aug 28 '20 20:08 dawsbot