-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
feat(organize_imports): support bun:
, #
, absolute imports
#503
Conversation
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
831e78a
to
93f38b4
Compare
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 work, thanks!
I think the documentation was slightly off here. Recognizing built-in modules and grouping them with explicit Node imports seems the right thing to do.
Given the philosophy of “grouping imports by distance” I do think it’s a bit odd to put absolute paths before URLs though. I think I would put them just before the relative imports, or the sharp imports, personally. But maybe it even depends on the use case? I don’t use absolute paths myself so I can’t have too strong an opinion 😅
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.
Thank you for looking after this. Here's some preliminary feedback:
- the PR does refactor and add features, I believe the PR title should enhance the feature instead
- it would be preferable to pull out the refactor from this PR in another PR
- if the previous suggestion can't be done, I would update the PR description and explain the nature of the refactor. "Some code cleanup" isn't sufficient IMHO
- absolute imports should go before relative imports and after libraries, considering that we sort them by "distance from the user"
- Changelog line is missing
93f38b4
to
8d1a6d2
Compare
8d1a6d2
to
3f2226c
Compare
3f2226c
to
b8e877f
Compare
bun:
, #
, absolute importsbun:
, #
, absolute 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.
Amazing, great addition! Thank you @Conaclos !
94f71a9
to
97d29c5
Compare
Summary
Fix #449.
I added the following categories:
bun:
. Bunjs has recently gained a lot of traction. I think it could be great to handlebun:
imports.I placed
bun:
imports just beforenode:
. In this way we have a lexicographic order betweenbun
,node
, andnpm
./path
.I placed it just after the bare specifiers (library imports).
#import
They are placed just after the libraries and just before the relative imports because they generally redirect to a relative path or a library.
I updated the related website page.
I noticed that we recognize implicitly exported node built-in modules as node modules. This contradicts what the documentation says:
built-in Node.js modules that are explicitly imported using the
node:protocol;
. @arendjr what the expected behavior?Test Plan
Updated tests.