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
Fix behavior around comments embedded in imports #71
Conversation
β¦attach to the following import!)
@IanVS Happy to report this is green in CI! Now just needs to go β in our hearts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great work here! I haven't reviewed the whole thing yet, because I think there's a chance we might be able to simplify some of it based on improvements made to babel itself.
@IanVS Green again with new babel! |
While I was able to remove my patch/hack/workaround, I wasn't able to significantly simplify the rest of the implementation because babel doesn't concern itself with "moving nodes". So we still had the problem that comments were associated with multiple Import statements (trailing one, and leading another), and the whole point of our plugin is to move the leaders/trailer nodes around. Babel would then naively render the comment the first time it sees it, which would often lead to unexpected (from the user-perspective) comment positioning. So we have to detach all the comments, and reattach them to only the right attachment points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed all the easy stuff (mostly the tests, which are excellent, by the way). I have some questions, mostly about trailing comments on lines after the import declaration. I'll review the code itself tomorrow, which will probably give me a better understanding of why things are working the way they are.
expect(leadingComments(adjustedNodes[1])).toEqual([]); | ||
expect(trailingComments(adjustedNodes[1])).toEqual([]); | ||
expect(adjustedNodes).toHaveLength(4); | ||
// Comment c1 is explicitly detached so it stays with the top-of-file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't comment c1 move? In your note in the readme, it says"
If you leave a gap after a comment at the top of your file, we will avoid moving it around if the imports below it shift.
So I would assume since there's no gap, that c1 and c2 would both move with the import from "c".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I see how I confused things particularly with my variable names and the term βgapβ.
I didnβt mean βgapβ as in blank line β I have to consider each comment independently (or I need even more richness in my data model/scan-passes). β So gap is βif this comment and the import-node were the only things that existed, would there be a gap?β
So βleading gapβ really was βis this specific 1-line comment ending more than 1 line before the import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the variables and comments, in particular because the change from #71 (comment) also further twisted the meaning of one of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this makes sense, thanks. It seems like a pretty rare thing to happen, and has an easy solution if someone wants both to stay at the top (add a blank line underneath).
expect(leadingComments(adjustedNodes[1])).toEqual([]); | ||
expect(trailingComments(adjustedNodes[1])).toEqual([]); | ||
// "final 1" is attached as a trailing-comment for import from "a" | ||
// but "final 2" is detached so it stays with the bottom-of-imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavior seems a bit odd to me. The test description is that comments after all the imports should not be moved, and I think I agree with that. The only kind of "trailing" comment that feels like it should move with an import is one that is on the same line. Comments that start on the line below an import feel like they shouldn't be associated with that import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could accept that argument.
If you want to change that behavior, itβs just removing the β+ 1β on the trailingGap
comparison (plus updating Readme and test-cases)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm implementing this change now, and then updating the comments/snapshots to match!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Done β ]
@@ -33,7 +34,6 @@ export function givesAFoo3Obj(): AliasFoo3 { | |||
/** | |||
* @flow | |||
*/ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we wouldn't remove this newline. I wonder if we can somehow use the loc
of all comments at the top of a file that aren't attached to an import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't deleted exactly, it's the comment below that was injected as a "second" top-of-file comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not actually being removed so much as a comment is being shuffled to be directly trailing this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I can live with this. π
@@ -164,7 +170,7 @@ import thirdParty from "third-party"; | |||
import { | |||
random // inner comment | |||
} from './random'; | |||
// leading comment | |||
// trailing comment for import-random (export statement is code that will be sorted to below imports, and so doesn't have precedence over the import-comment-attachment rules!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a side-effect of how things are working, or a behavior that you think is correct?
Personally, it seems to me like the only kind of trailing comments we should keep with an import are the ones that start on the same line as the end of the import declaration. Anything else feels unexpected, since I never put a comment on a line after something that it's associated with. But maybe some people do that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The situation here is that export
is not considered part of the nodes weβre allowed to modify, but we do have logic to support pulling trailing comments around elsewhere, so the comment is preferentially bound.
Iβll tweak things to disable trailing comments except-on-same-line, and then you can review the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue is gone with the latest commit! fca0377
import { bar } from "a"; | ||
import { foo } from "c"; | ||
/* foo */ import { foo } from "c"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
β¦s (just in case)
Fixes: - trailing attachments should be used much more rarely / leading comment on code shouldn't treated as trailing comment on an import - various unexpected newline injections - unnecessary test3, is duplicate of test2 - some test cases now behave correctly, but had comments added implying things about gaps being unexpectedly deleted (when they're definitely present)
This reverts commit 2d54d8e.
β Ready for next review! |
I think this is no longer needed, now that we ignore trailing imports on a following line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome work! I think you've managed to handle all the tricky comment cases in a way that makes good sense. I pushed up a couple of commits to add a couple of small test cases, reword the README slightly, and clean up some more of the trailing comment logic. Feel free to push back on any of it, or merge if you're satisfied.
expect(leadingComments(adjustedNodes[1])).toEqual([]); | ||
expect(trailingComments(adjustedNodes[1])).toEqual([]); | ||
expect(adjustedNodes).toHaveLength(4); | ||
// Comment c1 is explicitly detached so it stays with the top-of-file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this makes sense, thanks. It seems like a pretty rare thing to happen, and has an easy solution if someone wants both to stay at the top (add a blank line underneath).
@@ -33,7 +34,6 @@ export function givesAFoo3Obj(): AliasFoo3 { | |||
/** | |||
* @flow | |||
*/ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I can live with this. π
src/utils/get-comment-registry.ts
Outdated
// This comment should be kept close to the ImportDeclaration it follows | ||
commentEntry.processingPriority += | ||
DeferredCommentClaimPriorityAdjustment.trailingNonSameLine; | ||
deferredCommentClaims.push(commentEntry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what case would this else
be hit? I added a throw new Error()
here, and it's not hit in any tests. I think it's covered by the if and else if above. Trailing comments can only be on the same line or below. I'll make the change and push it up, but wanted to point it out in case I'm missing something.
src/utils/get-comment-registry.ts
Outdated
/** Constructed Output Nodes */ | ||
outputNodes: ImportDeclaration[]; | ||
}) => { | ||
if ((outputNodes.length === 0 || !firstImport, !lastImport)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen this syntax before in an if statement, and I'm not sure I understand it. But, from playing around, it seems that only the last expression in the sequence is considered. So, if I have:
function test(x, y) {
if (x, y) {
console.log('true');
} else {
console.log('false');
}
}
Then the only way to get true
is to pass a truthy y
, and it doesn't matter what x
is.
Can you maybe explain what the goal of this check is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brain-π¨ β that was just supposed to be ||
instead of javascriptβs crazy & unnecessary comma operator ,
(that should be banned β eslint-rule?).
Youβre right thereβs not a test-case.
The way I wrote the code that calls this function, I construct the lastImport
from the same array that I construct the firstImport
β so unless youβre calling this helper in new code, itβs not possible to get one of the imports to be non-null while the other is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at my commits, I think we don't need lastImport
at all anymore, so I simplified it down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at all your commits and have no objections with them! I definitely had stuff in there that was "left-overs" from previous implementation/approaches, or just no longer relevant debugging. Thanks for cleaning all that up!
β¦#156) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`^3.7.2` -> `^4.0.0`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) #### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "after 12am and before 5am every weekday,every weekend" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/browser-js-library-template).
β¦#109) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`^3.7.2` -> `^4.0.0`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) #### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "after 12am and before 5am every weekday,every weekend" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/browser-js-website-template).
β¦#122) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`^3.7.2` -> `^4.0.0`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) #### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "after 12am and before 5am every weekday,every weekend" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/js-bottomsheet).
β¦#79) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`3.7.2` -> `4.0.0`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.0/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) #### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "after 12am and before 5am on saturday" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/node-ts-library-template).
β¦#71) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`3.7.2` -> `4.0.2`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.2) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.2`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.2) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v4.0.1...v4.0.2) #### What's Changed - Account for missing filepath by [@​IanVS](https://togithub.com/IanVS) in [IanVS/prettier-plugin-sort-imports#104 **Full Changelog**: IanVS/prettier-plugin-sort-imports@v4.0.1...v4.0.2 ### [`v4.0.1`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.1) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v4.0.0...v4.0.1) #### What's Changed - Fix cli in Install section by [@​torn4dom4n](https://togithub.com/torn4dom4n) in [IanVS/prettier-plugin-sort-imports#99 - Fix dollar sign ($) issue in Vue SFC by [@​istiak-tridip](https://togithub.com/istiak-tridip) in [IanVS/prettier-plugin-sort-imports#101 #### New Contributors - [@​torn4dom4n](https://togithub.com/torn4dom4n) made their first contribution in [IanVS/prettier-plugin-sort-imports#99 - [@​istiak-tridip](https://togithub.com/istiak-tridip) made their first contribution in [IanVS/prettier-plugin-sort-imports#101 **Full Changelog**: IanVS/prettier-plugin-sort-imports@v4.0.0...v4.0.1 ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) #### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "after 12am and before 5am on saturday" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/node-js-library-template).
β¦#36) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`3.7.2` -> `4.0.2`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.2) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.2`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.2) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v4.0.1...v4.0.2) #### What's Changed - Account for missing filepath by [@​IanVS](https://togithub.com/IanVS) in [IanVS/prettier-plugin-sort-imports#104 **Full Changelog**: IanVS/prettier-plugin-sort-imports@v4.0.1...v4.0.2 ### [`v4.0.1`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.1) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v4.0.0...v4.0.1) #### What's Changed - Fix cli in Install section by [@​torn4dom4n](https://togithub.com/torn4dom4n) in [IanVS/prettier-plugin-sort-imports#99 - Fix dollar sign ($) issue in Vue SFC by [@​istiak-tridip](https://togithub.com/istiak-tridip) in [IanVS/prettier-plugin-sort-imports#101 #### New Contributors - [@​torn4dom4n](https://togithub.com/torn4dom4n) made their first contribution in [IanVS/prettier-plugin-sort-imports#99 - [@​istiak-tridip](https://togithub.com/istiak-tridip) made their first contribution in [IanVS/prettier-plugin-sort-imports#101 **Full Changelog**: IanVS/prettier-plugin-sort-imports@v4.0.0...v4.0.1 ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) ##### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "before 4am on Monday" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/bookmark-tags).
β¦#161) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@ianvs/prettier-plugin-sort-imports](https://togithub.com/ianvs/prettier-plugin-sort-imports) | [`3.7.2` -> `4.0.2`](https://renovatebot.com/diffs/npm/@ianvs%2fprettier-plugin-sort-imports/3.7.2/4.0.2) | [![age](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/compatibility-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@ianvs%2fprettier-plugin-sort-imports/4.0.2/confidence-slim/3.7.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>ianvs/prettier-plugin-sort-imports</summary> ### [`v4.0.2`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.2) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v4.0.1...v4.0.2) #### What's Changed - Account for missing filepath by [@​IanVS](https://togithub.com/IanVS) in [IanVS/prettier-plugin-sort-imports#104 **Full Changelog**: IanVS/prettier-plugin-sort-imports@v4.0.1...v4.0.2 ### [`v4.0.1`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.1) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v4.0.0...v4.0.1) #### What's Changed - Fix cli in Install section by [@​torn4dom4n](https://togithub.com/torn4dom4n) in [IanVS/prettier-plugin-sort-imports#99 - Fix dollar sign ($) issue in Vue SFC by [@​istiak-tridip](https://togithub.com/istiak-tridip) in [IanVS/prettier-plugin-sort-imports#101 #### New Contributors - [@​torn4dom4n](https://togithub.com/torn4dom4n) made their first contribution in [IanVS/prettier-plugin-sort-imports#99 - [@​istiak-tridip](https://togithub.com/istiak-tridip) made their first contribution in [IanVS/prettier-plugin-sort-imports#101 **Full Changelog**: IanVS/prettier-plugin-sort-imports@v4.0.0...v4.0.1 ### [`v4.0.0`](https://togithub.com/IanVS/prettier-plugin-sort-imports/releases/tag/v4.0.0) [Compare Source](https://togithub.com/ianvs/prettier-plugin-sort-imports/compare/v3.7.2...v4.0.0) #### What's Changed This new release focuses on simplifying the plugin options, shipping more useful defaults, handling comments around import statements more reliably, and improving Vue and TypeScript compatibility. We also are targeting Node 16 syntax with our build, though older versions may continue to work (untested). See the full [migration guide](https://togithub.com/IanVS/prettier-plugin-sort-imports/blob/next/docs/MIGRATION.md#migrating-from-v3xx-to-v4xx) for details of the breaking changes. ##### β¬οΈ Breaking Changes - Build for Node 16+ ([IanVS/prettier-plugin-sort-imports#59) - Remove `importOrderBuiltinModulesToTop` (always true) ([IanVS/prettier-plugin-sort-imports#60) - Remove `importOrderSeparation` option ([IanVS/prettier-plugin-sort-imports#62) - Remove `importOrderCaseInsensitive` option ([IanVS/prettier-plugin-sort-imports#63) - Remove `importOrderGroupNamespaceSpecifiers` option ([IanVS/prettier-plugin-sort-imports#64) - Remove `importOrderSortSpecifiers` option ([IanVS/prettier-plugin-sort-imports#65) - Remove `importOrderMergeDuplicateImports` option (always on) ([IanVS/prettier-plugin-sort-imports#66) - Replace `importOrderCombineTypeAndValueImports` with `importOrderTypeScriptVersion` ([IanVS/prettier-plugin-sort-imports#67) - Improve default sort order ([IanVS/prettier-plugin-sort-imports#83) ##### π Bug Fixes - Fix behavior around comments embedded in imports ([IanVS/prettier-plugin-sort-imports#71) - Preserve trailing comments on specifiers ([IanVS/prettier-plugin-sort-imports#80) - Preserve comments and blank lines at top-of-file (in [IanVS/prettier-plugin-sort-imports#82) - Prevent comment gap when re-arranging first import ([IanVS/prettier-plugin-sort-imports#85) - Fix: Top-of-file Comments get duplicated when moving runtime code ([IanVS/prettier-plugin-sort-imports#88) - Vue: Sort both script and setup script ([IanVS/prettier-plugin-sort-imports#90) - Vue and TypeScript: Use correct parser plugins ([IanVS/prettier-plugin-sort-imports#91) ##### β‘οΈ Features - Add `<BUILTIN_MODULES>` Special Word ([IanVS/prettier-plugin-sort-imports#86) - Allow Explicit Separator after Top-of-file-comments ([IanVS/prettier-plugin-sort-imports#92) - Support babel-ts parser ([IanVS/prettier-plugin-sort-imports#97) ##### π οΈ Repo Maintenance - Update dependencies, jest -> vitest ([IanVS/prettier-plugin-sort-imports#59) - Check formatting in CI ([IanVS/prettier-plugin-sort-imports#61) - Update to latest versions of Github Actions ([IanVS/prettier-plugin-sort-imports#73) - Add some more tests for comments ([IanVS/prettier-plugin-sort-imports#77) ##### 𧳠Dependencies - Drop javascript-natural-sort dependency ([IanVS/prettier-plugin-sort-imports#28) - Drop lodash.clone dependency ([IanVS/prettier-plugin-sort-imports#74) - Upgrade Babel to 7.21 ([IanVS/prettier-plugin-sort-imports#72) **Full Changelog**: IanVS/prettier-plugin-sort-imports@v3.7.2...v4.0.0 </details> --- ### Configuration π **Schedule**: Branch creation - "before 4am on Monday" in timezone Asia/Kolkata, Automerge - At any time (no schedule defined). π¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. β» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. π **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/timelessco/next-ts-app).
Fixes #9
Fixes #54
While attempting to work on #9 I found a lot of gnarly edge cases \o/.
Turns out our previous comment-adjuster didn't work for most cases (indeed it thought it was mutating nodes when it was actually generating clean nodes that it was then throwing away π€¦π»ββοΈ, and what "correct" behavior we were seeing before was incredibly brittle and lucky).
I've now added a section to the README that talks about how it handles comments, but generally speaking here's a quick tl;dr:
ImportDeclaration
or some flavor ofImportSpecifier
are properly sorted with their parent-node now!ImportDeclaration
orImportSpecifier
. This means that we can now have a leading comment directly before an import, and it will follow that import. But it also meant that a ton of our test-cases had "top-of-file" comments that were interpreted as being attached to the first import, so I patched those test-cases so there's a new-line.I think the new rules are internally consistent, but I await your feedback!
Please help me with the wording in the README and/or feel free to rewrite it, or use the bullets here to improve the phrasing. I thought about hot-linking to exact examples (snapshots?), but I wasn't sure if that was a good idea. We could use <details> components to embed them directly in the readme?