Skip to content

Commit a85706b

Browse files
committed
chore: lint
1 parent 2b23e17 commit a85706b

File tree

2 files changed

+59
-42
lines changed

2 files changed

+59
-42
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/index.spec.ts

Lines changed: 59 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,17 @@ runTest("normalizeString", normalizeString, {
6161
// './foobar./../a/./': 'a',
6262

6363
// Windows
64-
[normalizeWindowsPath("C:\\temp\\..")]: "C:",
65-
[normalizeWindowsPath("C:\\temp\\..\\.\\Users")]: "C:/Users",
66-
[normalizeWindowsPath("C:\\temp\\..\\.well-known\\Users")]:
64+
[normalizeWindowsPath(String.raw`C:\temp\..`)]: "C:",
65+
[normalizeWindowsPath(String.raw`C:\temp\..\.\Users`)]: "C:/Users",
66+
[normalizeWindowsPath(String.raw`C:\temp\..\.well-known\Users`)]:
6767
"C:/.well-known/Users",
68-
[normalizeWindowsPath("C:\\temp\\..\\..well-known\\Users")]:
68+
[normalizeWindowsPath(String.raw`C:\temp\..\..well-known\Users`)]:
6969
"C:/..well-known/Users",
7070
[normalizeWindowsPath("C:\\a\\..\\")]: "C:",
71-
[normalizeWindowsPath("C:\\temp\\myfile.html")]: "C:/temp/myfile.html",
72-
[normalizeWindowsPath("\\temp\\myfile.html")]: "temp/myfile.html",
73-
[normalizeWindowsPath(".\\myfile.html")]: "myfile.html",
71+
[normalizeWindowsPath(String.raw`C:\temp\myfile.html`)]:
72+
"C:/temp/myfile.html",
73+
[normalizeWindowsPath(String.raw`\temp\myfile.html`)]: "temp/myfile.html",
74+
[normalizeWindowsPath(String.raw`.\myfile.html`)]: "myfile.html",
7475
});
7576

7677
runTest("basename", basename, [
@@ -81,11 +82,11 @@ runTest("basename", basename, [
8182
["./undefined", undefined, "undefined"],
8283

8384
// Windows
84-
["C:\\temp\\myfile.html", "myfile.html"],
85-
["\\temp\\myfile.html", "myfile.html"],
86-
[".\\myfile.html", "myfile.html"],
87-
[".\\myfile.html", ".html", "myfile"],
88-
[".\\undefined", undefined, "undefined"],
85+
[String.raw`C:\temp\myfile.html`, "myfile.html"],
86+
[String.raw`\temp\myfile.html`, "myfile.html"],
87+
[String.raw`.\myfile.html`, "myfile.html"],
88+
[String.raw`.\myfile.html`, ".html", "myfile"],
89+
[String.raw`.\undefined`, undefined, "undefined"],
8990
]);
9091

9192
runTest("dirname", dirname, {
@@ -135,7 +136,7 @@ runTest("format", format, [
135136

136137
// Windows
137138
[{ name: "file", base: "file.txt" }, "file.txt"],
138-
[{ dir: "C:\\path\\dir", base: "file.txt" }, "C:/path/dir/file.txt"],
139+
[{ dir: String.raw`C:\path\dir`, base: "file.txt" }, "C:/path/dir/file.txt"],
139140
]);
140141

141142
runTest("join", join, [
@@ -145,18 +146,29 @@ runTest("join", join, [
145146
["/test//", "//path", "/test/path"],
146147
["some/nodejs/deep", "../path", "some/nodejs/path"],
147148
["./some/local/unix/", "../path", "some/local/path"],
148-
["./some\\current\\mixed", "..\\path", "some/current/path"],
149-
["../some/relative/destination", "..\\path", "../some/relative/path"],
149+
[String.raw`./some\current\mixed`, String.raw`..\path`, "some/current/path"],
150+
[
151+
"../some/relative/destination",
152+
String.raw`..\path`,
153+
"../some/relative/path",
154+
],
150155
["some/nodejs/deep", "../path", "some/nodejs/path"],
151156
["/foo", "bar", "baz/asdf", "quux", "..", "/foo/bar/baz/asdf"],
152157

153-
["C:\\foo", "bar", "baz\\asdf", "quux", "..", "C:/foo/bar/baz/asdf"],
154-
["some/nodejs\\windows", "../path", "some/nodejs/path"],
155-
["some\\windows\\only", "..\\path", "some/windows/path"],
158+
[
159+
String.raw`C:\foo`,
160+
"bar",
161+
String.raw`baz\asdf`,
162+
"quux",
163+
"..",
164+
"C:/foo/bar/baz/asdf",
165+
],
166+
[String.raw`some/nodejs\windows`, "../path", "some/nodejs/path"],
167+
[String.raw`some\windows\only`, String.raw`..\path`, "some/windows/path"],
156168
// UNC paths
157-
["\\\\server\\share\\file", "..\\path", "//server/share/path"],
158-
["\\\\.\\c:\\temp\\file", "..\\path", "//./c:/temp/path"],
159-
["\\\\server/share/file", "../path", "//server/share/path"],
169+
[String.raw`\\server\share\file`, String.raw`..\path`, "//server/share/path"],
170+
[String.raw`\\.\c:\temp\file`, String.raw`..\path`, "//./c:/temp/path"],
171+
[String.raw`\\server/share/file`, "../path", "//server/share/path"],
160172
]);
161173

162174
runTest("normalize", normalize, {
@@ -216,14 +228,14 @@ it("parse", () => {
216228
});
217229

218230
// Windows
219-
expect(parse("C:\\path\\dir\\file.txt")).to.deep.equal({
231+
expect(parse(String.raw`C:\path\dir\file.txt`)).to.deep.equal({
220232
root: "C:",
221233
dir: "C:/path/dir",
222234
base: "file.txt",
223235
ext: ".txt",
224236
name: "file",
225237
});
226-
expect(parse(".\\dir\\file")).to.deep.equal({
238+
expect(parse(String.raw`.\dir\file`)).to.deep.equal({
227239
root: ".",
228240
dir: "./dir",
229241
base: "file",
@@ -244,11 +256,19 @@ runTest("relative", relative, [
244256
],
245257

246258
// Windows
247-
["C:\\orandea\\test\\aaa", "C:\\orandea\\impl\\bbb", "../../impl/bbb"],
248-
["C:\\orandea\\test\\aaa", "c:\\orandea\\impl\\bbb", "../../impl/bbb"],
249-
["C:\\", "C:\\foo\\bar", "foo/bar"],
250-
["C:\\foo", "C:\\", ".."],
251-
["C:\\foo", "d:\\bar", "D:/bar"],
259+
[
260+
String.raw`C:\orandea\test\aaa`,
261+
String.raw`C:\orandea\impl\bbb`,
262+
"../../impl/bbb",
263+
],
264+
[
265+
String.raw`C:\orandea\test\aaa`,
266+
String.raw`c:\orandea\impl\bbb`,
267+
"../../impl/bbb",
268+
],
269+
["C:\\", String.raw`C:\foo\bar`, "foo/bar"],
270+
[String.raw`C:\foo`, "C:\\", ".."],
271+
[String.raw`C:\foo`, String.raw`d:\bar`, "D:/bar"],
252272
[
253273
() => process.cwd().replace(/\\/g, "/"),
254274
"./dist/client/b-scroll.d.ts",
@@ -278,13 +298,13 @@ runTest("resolve", resolve, [
278298
],
279299

280300
// Windows
281-
["C:\\foo\\bar", ".\\baz", "C:/foo/bar/baz"],
282-
["\\foo\\bar", ".\\baz", "/foo/bar/baz"],
283-
["\\foo\\bar", "..", ".", ".\\baz", "/foo/baz"],
284-
["\\foo\\bar", "\\tmp\\file\\", "/tmp/file"],
285-
["\\foo\\bar", undefined, null, "", "\\tmp\\file\\", "/tmp/file"],
301+
[String.raw`C:\foo\bar`, String.raw`.\baz`, "C:/foo/bar/baz"],
302+
[String.raw`\foo\bar`, String.raw`.\baz`, "/foo/bar/baz"],
303+
[String.raw`\foo\bar`, "..", ".", String.raw`.\baz`, "/foo/baz"],
304+
[String.raw`\foo\bar`, "\\tmp\\file\\", "/tmp/file"],
305+
[String.raw`\foo\bar`, undefined, null, "", "\\tmp\\file\\", "/tmp/file"],
286306
[
287-
"\\foo\\bar",
307+
String.raw`\foo\bar`,
288308
undefined,
289309
null,
290310
"",
@@ -297,15 +317,15 @@ runTest("resolve", resolve, [
297317
[
298318
"wwwroot",
299319
"static_files\\png\\",
300-
"..\\gif\\image.gif",
320+
String.raw`..\gif\image.gif`,
301321
() =>
302322
`${process.cwd().replace(/\\/g, "/")}/wwwroot/static_files/gif/image.gif`,
303323
],
304-
["C:\\Windows\\path\\only", "../../reports", "C:/Windows/reports"],
324+
[String.raw`C:\Windows\path\only`, "../../reports", "C:/Windows/reports"],
305325
[
306-
"C:\\Windows\\long\\path\\mixed/with/unix",
326+
String.raw`C:\Windows\long\path\mixed/with/unix`,
307327
"../..",
308-
"..\\../reports",
328+
String.raw`..\../reports`,
309329
"C:/Windows/long/reports",
310330
],
311331
]);
@@ -367,7 +387,7 @@ export function runTest(name, function_, items) {
367387
expected,
368388
)} on Windows`, () => {
369389
cwd = process.cwd;
370-
process.cwd = vi.fn(() => "C:\\Windows\\path\\only");
390+
process.cwd = vi.fn(() => String.raw`C:\Windows\path\only`);
371391
expect(function_(...arguments_.map((i) => _r(i)))).to.equal(
372392
_r(expected),
373393
);

0 commit comments

Comments
 (0)