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

Support TypeScript 5.0 and update dependencies #232

Open
wants to merge 5 commits into
base: v5
Choose a base branch
from

Conversation

odiak
Copy link
Contributor

@odiak odiak commented May 19, 2023

  • Update some dependencies and support TypeScript 5.0
  • Fix code to work with latest @babel/generator (describing below)
    • @babel/generator changed 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'

@odiak
Copy link
Contributor Author

odiak commented May 19, 2023

Oops, CI on Node.js 12 failed because latest Jest only supports Node 14+.

@odiak
Copy link
Contributor Author

odiak commented May 19, 2023

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

@byara byara changed the base branch from main to v5 November 17, 2023 10:03
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

Successfully merging this pull request may close these issues.

None yet

1 participant