Skip to content

Commit

Permalink
prefer-node-protocol: Don't suggest node: prefix for punycode
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Dec 15, 2022
1 parent 23d0326 commit c4778bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/prefer-node-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const create = () => ({
typeof value !== 'string'
|| value.startsWith('node:')
|| !isBuiltinModule(value)
|| value == 'punycode'
) {
return;
}
Expand Down
2 changes: 2 additions & 0 deletions test/prefer-node-protocol.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test.snapshot({
'import fs from "./fs";',
'import fs from "unknown-builtin-module";',
'import fs from "node:fs";',
'import punycode from "punycode";',
outdent`
async function foo() {
const fs = await import(fs);
Expand Down Expand Up @@ -74,6 +75,7 @@ test.snapshot({
'const fs = require();',
'const fs = require(...["fs"]);',
'const fs = require("unicorn");',
'const fs = require("punycode");',
],
invalid: [
'const {promises} = require("fs")',
Expand Down

0 comments on commit c4778bd

Please sign in to comment.