Fix recognising mandatory prefix built-in imports#389
Merged
vladislavarsenev merged 2 commits intotrivago:mainfrom Jan 6, 2026
Merged
Fix recognising mandatory prefix built-in imports#389vladislavarsenev merged 2 commits intotrivago:mainfrom
vladislavarsenev merged 2 commits intotrivago:mainfrom
Conversation
Some build-in Node modules, like node:test, have to be imported as node:test, not just test. The old version did not consider these to be built-in. The new implementation also ought to be faster, being a single Set look-up.
Collaborator
|
Hi @TomFryersMidsummer. Thanks for your PR and effort. Can you please provide in what case plugin doesn't consider node:* module as builtin? We have test that covers this case tests/BuiltinModules/snapshots/ppsi.spec.mjs.snap here, and it seems to work fine. |
Contributor
Author
|
With this configuration: ...
importOrder:
- "<BUILTIN_MODULES>"
- "<THIRD_PARTY_MODULES>"
- "^[./]"
importOrderSeparation: true
plugins:
- "@trivago/prettier-plugin-sort-imports"Prettier was formatting this: import { describe, it } from "node:test";
import assert from "node:assert/strict";
import request from "supertest";
import { Router } from "express";
import { auth } from "../../src/auth/auth.ts";
import { createServer } from "http";
import { keyRequirementsMet } from "../../src/auth/keyStrategy.js";
import { mockDatabase } from "../../src/utils/database.ts";
...into this: import { createServer } from "http";
import assert from "node:assert/strict";
import { Router } from "express";
import { describe, it } from "node:test";
import request from "supertest";
import { auth } from "../../src/auth/auth.ts";
import { keyRequirementsMet } from "../../src/auth/keyStrategy.js";
import { mockDatabase } from "../../src/utils/database.ts";
...
|
Collaborator
I see. Sorry that read description not carefully enough. Your implementation is cleaner indeed and fixes the problem you described earlier. I'll merge it and release soon. Thank you for your effort🙂 |
vladislavarsenev
approved these changes
Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some build-in Node modules, like
node:test, have to be imported asnode:test, not justtest. The old version did not consider these to be built-in.The new implementation also ought to be faster, being a single
Setlook-up.