Skip to content

Commit 51b0565

Browse files
committedJul 16, 2024·
chore: lint with eslint v9
1 parent 0dbe44f commit 51b0565

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed
 

‎.eslintignore

-1
This file was deleted.

‎.eslintrc

-9
This file was deleted.

‎eslint.config.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import unjs from "eslint-config-unjs";
2+
3+
// https://github.com/unjs/eslint-config
4+
export default unjs({
5+
ignores: [],
6+
rules: {
7+
"unicorn/prevent-abbreviations": 0,
8+
"unicorn/no-abusive-eslint-disable": 0
9+
},
10+
});

‎test/encoding.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe("encodeQueryValue", () => {
9494
out: "apple,banana,cherry",
9595
},
9696
{
97-
input: "!@#$%^&*()_+{}[]|\\:;<>,./?",
97+
input: String.raw`!@#$%^&*()_+{}[]|\:;<>,./?`,
9898
out: "!@%23$%25^%26*()_%2B%7B%7D%5B%5D|%5C:;%3C%3E,.%2F?",
9999
},
100100
];
@@ -149,7 +149,7 @@ describe("encodeParam", () => {
149149
{ input: "1+2=3", out: "1%2B2=3" },
150150
{ input: "áéíóú", out: "%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA" },
151151
{
152-
input: "!@#$%^&*()_-+=[]{}\\|;:'\",.<>/?",
152+
input: String.raw`!@#$%^&*()_-+=[]{}\|;:'",.<>/?`,
153153
out: "!@%23$%25%5E%26*()_-%2B=%5B%5D%7B%7D%5C|;:'%22,.%3C%3E%2F%3F",
154154
},
155155
{ input: 123, out: "123" },

‎test/parse.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe("parseURL", () => {
7171
},
7272
},
7373
{
74-
input: "https://host.name\\@foo.bar/meme3.php?url=http://0.0.0.0/2.svg",
74+
input: String.raw`https://host.name\@foo.bar/meme3.php?url=http://0.0.0.0/2.svg`,
7575
out: {
7676
auth: "",
7777
hash: "",
@@ -178,7 +178,7 @@ describe("parseURL", () => {
178178

179179
for (const t of tests) {
180180
test(t.input.toString(), () => {
181-
expect(JSON.parse(JSON.stringify(parseURL(t.input)))).toEqual(t.out);
181+
expect(structuredClone(parseURL(t.input))).toEqual(t.out);
182182
});
183183
}
184184
});

‎test/url.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe("$URL", () => {
7070

7171
for (const t of tests) {
7272
test(t.input + " throw", () => {
73-
expect(() => new $URL(t.input as any)).toThrow(TypeError(t.out));
73+
expect(() => new $URL(t.input as any)).toThrow(new TypeError(t.out));
7474
});
7575
}
7676
});

‎test/utilities.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("hasProtocol", () => {
2828
{ input: "https://", out: [true, true, true] },
2929
{ input: "https://test.com", out: [true, true, true] },
3030
{ input: "file:///home/user", out: [true, true, true] },
31-
{ input: "https:\\/foo.com", out: [true, true, true] },
31+
{ input: String.raw`https:\/foo.com`, out: [true, true, true] },
3232

3333
// Has protocol (non strict)
3434
{ input: "tel:", out: [true, false, true] },
@@ -43,8 +43,8 @@ describe("hasProtocol", () => {
4343
{ input: "//test.com", out: [false, false, true] },
4444
{ input: "///test.com", out: [false, false, true] },
4545
{ input: "/\t//test.com", out: [false, false, true] },
46-
{ input: "/\\/test.com", out: [false, false, true] },
47-
{ input: "/\\localhost//", out: [false, false, true] },
46+
{ input: String.raw`/\/test.com`, out: [false, false, true] },
47+
{ input: String.raw`/\localhost//`, out: [false, false, true] },
4848
];
4949

5050
for (const t of tests) {

0 commit comments

Comments
 (0)
Please sign in to comment.