We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2f2ffd commit 95fc972Copy full SHA for 95fc972
scripts/lint/utils.cjs
@@ -8,6 +8,7 @@
8
"use strict";
9
10
const path = require("node:path");
11
+const { fileURLToPath } = require("node:url");
12
13
/**
14
* ANSI colors.
@@ -116,7 +117,9 @@ exports.pluralize = function (word, count) {
116
117
* @returns Relative file path.
118
*/
119
exports.toRelativePath = function (filePath, root) {
- const uri = filePath.replace("file:///", "");
120
+ const uri = filePath.startsWith("file:///")
121
+ ? fileURLToPath(filePath)
122
+ : filePath;
123
const rel = path.relative(root, uri);
124
if (rel.startsWith("..")) return uri;
125
return "." + path.sep + rel;
0 commit comments