prettier-plugin-sort-imports
prettier-plugin-sort-imports copied to clipboard
Support TypeScript 5.0 and update dependencies
- Update some dependencies and support TypeScript 5.0
- Fix code to work with latest
@babel/generator(describing below)@babel/generatorchanged way how to print comments- But some cases weren't fixed
Fixed cases
Sometimes new lines after comment (before first import) were broken.
unformatted:
// comment
import y from 'y'
import x from 'x'
formatted (before fix):
// comment
import x from 'x'
import y from 'y'
formatted (after fix):
// comment
import x from 'x'
import y from 'y'
Unfixed cases
With new @babel/generator, new lines between comments are maintained.
Because I think this behavior is natural, I didn't fix and updated test snapshots.
unformatted:
// comment1
/**
* hello
*/
// comment2
import x from 'x'
formatted (previously expected):
// comment1
/**
* hello
*/
// comment2
import x from 'x'
formatted (newly expected):
// comment1
/**
* hello
*/
// comment2
import x from 'x'
Oops, CI on Node.js 12 failed because latest Jest only supports Node 14+.
I also published forked version of the package. It contains changes of this pull request. Feel free to use it. https://www.npmjs.com/package/@odiak/prettier-plugin-sort-imports