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

#291: move comments between imports above import list #292

Closed
wants to merge 1 commit into from

Conversation

bethcutler
Copy link
Contributor

Fix for #291

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 17, 2022
@JavierSegoviaCordoba
Copy link
Contributor

Is this not a weird behavior? Imagine I am commenting on an import (for example //this is import is temporarily here and this dependency should be removed), the comment will be moved on top and the reference is lost.

@bethcutler
Copy link
Contributor Author

I addressed this a bit in the #291 issue. The new behavior is better than the current behavior (these comments would just cause the formatter to crash, so effectively aren't "allowed" right now). Another option would be to pin the comment to the import just below the comment, but if the formatter removes that import because it is unnecessary, should the comment disappear? Now the comment may be "attached" to a completely unrelated import. I feel like this is the safest change we can make, and our users can easily adapt to it.

@nreid260
Copy link
Contributor

Plus, if the comment is an import, that import will get sorted back into place once uncommented.

@cgrushko
Copy link
Contributor

Let's first conclude the discussion in #291

@facebook-github-bot
Copy link
Contributor

@strulovich has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants