Skip to content

Commit

Permalink
chore: lint with eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 16, 2024
1 parent 0dbe44f commit 51b0565
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import unjs from "eslint-config-unjs";

// https://github.com/unjs/eslint-config
export default unjs({
ignores: [],
rules: {
"unicorn/prevent-abbreviations": 0,
"unicorn/no-abusive-eslint-disable": 0
},
});
4 changes: 2 additions & 2 deletions test/encoding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("encodeQueryValue", () => {
out: "apple,banana,cherry",
},
{
input: "!@#$%^&*()_+{}[]|\\:;<>,./?",
input: String.raw`!@#$%^&*()_+{}[]|\:;<>,./?`,
out: "!@%23$%25^%26*()_%2B%7B%7D%5B%5D|%5C:;%3C%3E,.%2F?",
},
];
Expand Down Expand Up @@ -149,7 +149,7 @@ describe("encodeParam", () => {
{ input: "1+2=3", out: "1%2B2=3" },
{ input: "áéíóú", out: "%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA" },
{
input: "!@#$%^&*()_-+=[]{}\\|;:'\",.<>/?",
input: String.raw`!@#$%^&*()_-+=[]{}\|;:'",.<>/?`,
out: "!@%23$%25%5E%26*()_-%2B=%5B%5D%7B%7D%5C|;:'%22,.%3C%3E%2F%3F",
},
{ input: 123, out: "123" },
Expand Down
4 changes: 2 additions & 2 deletions test/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("parseURL", () => {
},
},
{
input: "https://host.name\\@foo.bar/meme3.php?url=http://0.0.0.0/2.svg",
input: String.raw`https://host.name\@foo.bar/meme3.php?url=http://0.0.0.0/2.svg`,
out: {
auth: "",
hash: "",
Expand Down Expand Up @@ -178,7 +178,7 @@ describe("parseURL", () => {

for (const t of tests) {
test(t.input.toString(), () => {
expect(JSON.parse(JSON.stringify(parseURL(t.input)))).toEqual(t.out);
expect(structuredClone(parseURL(t.input))).toEqual(t.out);
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("$URL", () => {

for (const t of tests) {
test(t.input + " throw", () => {
expect(() => new $URL(t.input as any)).toThrow(TypeError(t.out));
expect(() => new $URL(t.input as any)).toThrow(new TypeError(t.out));
});
}
});
Expand Down
6 changes: 3 additions & 3 deletions test/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("hasProtocol", () => {
{ input: "https://", out: [true, true, true] },
{ input: "https://test.com", out: [true, true, true] },
{ input: "file:///home/user", out: [true, true, true] },
{ input: "https:\\/foo.com", out: [true, true, true] },
{ input: String.raw`https:\/foo.com`, out: [true, true, true] },

// Has protocol (non strict)
{ input: "tel:", out: [true, false, true] },
Expand All @@ -43,8 +43,8 @@ describe("hasProtocol", () => {
{ input: "//test.com", out: [false, false, true] },
{ input: "///test.com", out: [false, false, true] },
{ input: "/\t//test.com", out: [false, false, true] },
{ input: "/\\/test.com", out: [false, false, true] },
{ input: "/\\localhost//", out: [false, false, true] },
{ input: String.raw`/\/test.com`, out: [false, false, true] },
{ input: String.raw`/\localhost//`, out: [false, false, true] },
];

for (const t of tests) {
Expand Down

0 comments on commit 51b0565

Please sign in to comment.