Skip to content

Commit a63ed72

Browse files
authored
refactor: Use node: protocol for built-in Node.js modules (#18434)
1 parent 04e7c6e commit a63ed72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+126
-117
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
"use strict";
1818

19-
const path = require("path");
19+
const path = require("node:path");
2020

2121
const INTERNAL_FILES = {
2222
CLI_ENGINE_PATTERN: "lib/cli-engine/**/*",

Makefile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
const checker = require("npm-license"),
1414
ReleaseOps = require("eslint-release"),
15-
fs = require("fs"),
15+
fs = require("node:fs"),
1616
glob = require("glob"),
1717
marked = require("marked"),
1818
matter = require("gray-matter"),
19-
os = require("os"),
20-
path = require("path"),
19+
os = require("node:os"),
20+
path = require("node:path"),
2121
semver = require("semver"),
2222
ejs = require("ejs"),
2323
loadPerf = require("load-perf"),
@@ -885,7 +885,7 @@ target.checkRuleFiles = function() {
885885
};
886886

887887
target.checkRuleExamples = function() {
888-
const { execFileSync } = require("child_process");
888+
const { execFileSync } = require("node:child_process");
889889

890890
// We don't need the stack trace of execFileSync if the command fails.
891891
try {

bin/eslint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function readStdin() {
6464
function getErrorMessage(error) {
6565

6666
// Lazy loading because this is used only if an error happened.
67-
const util = require("util");
67+
const util = require("node:util");
6868

6969
// Foolproof -- third-party module might throw non-object.
7070
if (typeof error !== "object" || error === null) {

docs/.eleventy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const pluginTOC = require("eleventy-plugin-nesting-toc");
77
const markdownItAnchor = require("markdown-it-anchor");
88
const markdownItContainer = require("markdown-it-container");
99
const Image = require("@11ty/eleventy-img");
10-
const path = require("path");
10+
const path = require("node:path");
1111
const { slug } = require("github-slugger");
1212
const yaml = require("js-yaml");
1313
const { highlighter, lineNumberPlugin } = require("./src/_plugins/md-syntax-highlighter");

docs/src/_data/site.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// Requirements
1010
//-----------------------------------------------------------------------------
1111

12-
const path = require("path");
13-
const fs = require("fs");
12+
const path = require("node:path");
13+
const fs = require("node:fs");
1414
const yaml = require("js-yaml");
1515

1616
//-----------------------------------------------------------------------------

docs/tools/validate-links.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
const path = require("path");
3+
const path = require("node:path");
44
const TapRender = require("@munter/tap-render");
55
const spot = require("tap-spot");
66
const hyperlink = require("hyperlink");

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// Requirements
2626
//-----------------------------------------------------------------------------
2727

28-
const path = require("path");
28+
const path = require("node:path");
2929
const internalPlugin = require("eslint-plugin-internal-rules");
3030
const eslintPluginRulesRecommendedConfig = require("eslint-plugin-eslint-plugin/configs/rules-recommended");
3131
const eslintPluginTestsRecommendedConfig = require("eslint-plugin-eslint-plugin/configs/tests-recommended");

lib/cli-engine/cli-engine.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// Requirements
1616
//------------------------------------------------------------------------------
1717

18-
const fs = require("fs");
19-
const path = require("path");
18+
const fs = require("node:fs");
19+
const path = require("node:path");
2020
const defaultOptions = require("../../conf/default-cli-options");
2121
const pkg = require("../../package.json");
2222

lib/cli-engine/file-enumerator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
// Requirements
3535
//------------------------------------------------------------------------------
3636

37-
const fs = require("fs");
38-
const path = require("path");
37+
const fs = require("node:fs");
38+
const path = require("node:path");
3939
const getGlobParent = require("glob-parent");
4040
const isGlob = require("is-glob");
4141
const escapeRegExp = require("escape-string-regexp");

lib/cli-engine/lint-result-cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// Requirements
99
//-----------------------------------------------------------------------------
1010

11-
const assert = require("assert");
12-
const fs = require("fs");
11+
const assert = require("node:assert");
12+
const fs = require("node:fs");
1313
const fileEntryCache = require("file-entry-cache");
1414
const stringify = require("json-stable-stringify-without-jsonify");
1515
const pkg = require("../../package.json");

0 commit comments

Comments
 (0)