New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments above directives get duplicated #229
Labels
Comments
fbartho
pushed a commit
to IanVS/prettier-plugin-sort-imports
that referenced
this issue
May 14, 2023
Testing that we don't suffer from trivago/prettier-plugin-sort-imports#229 or trivago/prettier-plugin-sort-imports#103 (though I had to add an empty line to make the last one work correctly).
1 task
Still happening in v4.2.0. |
Can we set orders as |
I digged about this, and set parser
Then errors are gone. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your Environment
Describe the bug
If there's a comment above a directive, the comment gets duplicated when it gets formatted. For example, this:
Becomes this when formatted:
This is a general bug affecting any comments, but if the comments at the top of the file are essential/functional, like JSX pragmas shown above, this seems like a showstopper. In my case, I'm trying to transition to server components in Next.js, but those aren't compatible with emotion, so I had to turn off the global setting in
tsconfig.json
and instead use the local pragma like this.To Reproduce
Expected behavior
These comments should remain where they are, just like they do if there is no directive.
Screenshots, code sample, etc
(That is from saving with Cmd-S in VSCode.)
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
Also reproduced with:
The text was updated successfully, but these errors were encountered: