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

Functionality to move NodeJS builtin modules to the top #71

Open
karlhorky opened this issue Aug 19, 2021 · 6 comments
Open

Functionality to move NodeJS builtin modules to the top #71

karlhorky opened this issue Aug 19, 2021 · 6 comments
Labels
feature request A new feature request hacktoberfest help wanted Extra attention is needed v3

Comments

@karlhorky
Copy link

Hi there, thanks for this package, really cool! Will consider recommending it to our bootcamp students at @upleveled.

One suggestion that came to mind would be to make it the default sort order to sort imports using the new node: scheme / prefix to the top. What do you think?

@ayusharma ayusharma changed the title Default to sorting node: scheme / prefix to top? Functionality to have NodeJS inbuilt modules to the top Aug 26, 2021
@ayusharma
Copy link
Collaborator

Hi @karlhorky. Thank you so much for the message.

We can implement this feature in the next upcoming release. If someone would like to contribute and implement this, that would be great. Please keep the following things in mind.

  • You can implement an API in the options, for this functionality. e.g. sortInbuiltNodeJSMoulesAtTop.
  • Create a PR to v3.x as the base branch.
  • You can detect node js inbuilt modules using require("module").builtinModules.

Feel free to drop a message if something is not clear.

@ayusharma ayusharma added feature request A new feature request help wanted Extra attention is needed v3 labels Aug 26, 2021
@karlhorky
Copy link
Author

Nice, thanks for the reply!

Would suggest using the following replacements for the naming:

  • builtin instead of inbuilt
  • ToTop instead of AtTop
  • Node instead of NodeJS

eg. sortNodeBuiltinModulesToTop

@kevinwolfcr
Copy link

Any update on this? If not, I could take a look.

@nickhudkins
Copy link

Howdy! I've picked this up and a PR will be incoming momentarily.

nickhudkins pushed a commit to nickhudkins/prettier-plugin-sort-imports that referenced this issue Apr 28, 2022
@IanVS
Copy link

IanVS commented Jul 25, 2022

In case anyone here is still looking for this, until this project adds support, you could use my fork, which is published on npm and supports this feature: https://github.com/IanVS/prettier-plugin-sort-imports#importorderbuiltinmodulestotop

@karlhorky karlhorky changed the title Functionality to have NodeJS inbuilt modules to the top Functionality to move NodeJS builtin modules to the top Jul 25, 2022
@mon-jai
Copy link

mon-jai commented Feb 9, 2023

Maybe it could be a importOrder classifier like <THIRD_PARTY_MODULES>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new feature request hacktoberfest help wanted Extra attention is needed v3
Projects
None yet
Development

No branches or pull requests

6 participants