Skip to content
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

Plugin causes // prettier-ignore lines to be disregarded (formatting the code) #93

Open
fbartho opened this issue May 18, 2023 · 0 comments
Assignees

Comments

@fbartho
Copy link
Collaborator

fbartho commented May 18, 2023

  // prettier-ignore
  import {b, a} from 'a'
  // prettier-ignore
  import {c, d} from 'b'
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  // prettier-ignore
x  import { b, a } from 'a';
  // prettier-ignore
x  import { c, d } from 'b';

Notice how the { } have spaces inside them?

I think the bug is related to getCodeFromAst and how it should avoid touching these imports, but simultaneously this node is important to restore comments at the top of file. So we have to omit it from nodesToDelete, but somehow also make sure that other imports don't get sorted above it.

If we just avoid "deleting" the original node, it will fall to the bottom of imports with the rest of the "unparsed runtime code".

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

No branches or pull requests

2 participants