IanVS / prettier-plugin-sort-imports

An opinionated but flexible prettier plugin to sort import statements
Apache License 2.0
951 stars 21 forks source link

Failing tests for comments on runtime code within imports #89

Open IanVS opened 1 year ago

IanVS commented 1 year ago

We have trouble moving comments on runtime code within the imports, because we treat those as comments on the imports instead.

This is just a couple of failing tests, in case we have time to come back and work on this.

zim89 commented 9 months ago

не совсем понял о чем собственно речь. а можно немного более подробней описать суть проблемы?

IanVS commented 9 months ago

@zim89 the test attempts to demonstrate it: https://github.com/IanVS/prettier-plugin-sort-imports/pull/89/files#diff-571840db8845eb31e2c09ff57b971d3c56bd7f8297e5255ffca432211eeb205dR3-R4

This is only a problem when there are comments on runtime code that comes before or between import statements. Normally import statements are always at the top of a file, so this is not an issue that many (any?) users hit.

The tests fail, because the comments are not kept with the lines that they are documenting.