Skip to content

Commit

Permalink
tools: restrict internal code from using public url module
Browse files Browse the repository at this point in the history
PR-URL: nodejs#49590
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
LiviaMedeiros authored and alexfernandez committed Nov 1, 2023
1 parent fd24549 commit c3ee079
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ rules:
message: Use `const { structuredClone } = require('internal/structured_clone');` instead of the global.
- name: SubtleCrypto
message: Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.
no-restricted-modules:
- error
- name: url
message: Require `internal/url` instead of `url`.
# Custom rules in tools/eslint-rules
node-core/avoid-prototype-pollution: error
node-core/lowercase-name-for-primitive: error
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/switches/is_main_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ rawMethods.resetStdioForTesting = function() {
// Needed by the module loader and generally needed everywhere.
require('fs');
require('util');
require('url');
require('url'); // eslint-disable-line no-restricted-modules

require('internal/modules/cjs/loader');
require('internal/modules/esm/utils');
Expand Down

0 comments on commit c3ee079

Please sign in to comment.