dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

feat: sort deno “node:/npm:” imports/exports first

Open denizdogan opened this issue 2 years ago • 2 comments

Makes it so that imports/exports that begin with node: or npm: are first in each set of declarations.

I would really like something like this to be way more fleshed out, with more fine-grained configuration options, but I'd like to see if there's any interest first. If not, I might make a separate dprint plugin with this stuff.

Some notes:

  • The Npm_ and Node_ names are meant to represent npm: and node:
  • The "inner text" of Node_ and Npm_ is just sorted alphabetically, i.e. not by path depth
  • I know these specifiers are Deno-specific, but it most likely will not hurt any non-Deno projects
  • Hope you don't mind I added a default VSCode test task

denizdogan avatar May 13 '23 22:05 denizdogan

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 13 '23 22:05 CLAassistant

Thanks, looks good, but instead of making this npm and node specific, perhaps we should make this "schemed"? So if a specifier starts with all letters then a colon it would be considered "schemed" and sort before "absolute", which could maybe be renamed to "bare". That way it's not Deno specific.

Yes, that makes sense. I'll revisit this soon. Thanks for the feedback!

denizdogan avatar Jun 05 '23 15:06 denizdogan