-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Remove custom prettier config
- Loading branch information
Showing
33 changed files
with
1,996 additions
and
2,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"updatedAt": "2020-04-24T17:18:33.648Z"} | ||
{ "updatedAt": "2020-04-24T17:18:33.648Z" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ module.exports = { | |
project: "./tsconfig.json", | ||
sourceType: "module", | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export const PUBLIC_SUFFIX_URL = | ||
"https://publicsuffix.org/list/public_suffix_list.dat"; | ||
"https://publicsuffix.org/list/public_suffix_list.dat"; | ||
export const PUBLIC_SUFFIX_MARKER_ICANN_START = "// ===BEGIN ICANN DOMAINS==="; | ||
export const PUBLIC_SUFFIX_MARKER_ICANN_END = "// ===END ICANN DOMAINS==="; | ||
export const PUBLIC_SUFFIX_MARKER_PRIVATE_START = | ||
"// ===BEGIN PRIVATE DOMAINS==="; | ||
"// ===BEGIN PRIVATE DOMAINS==="; | ||
export const PUBLIC_SUFFIX_MARKER_PRIVATE_END = "// ===END PRIVATE DOMAINS==="; | ||
export const FETCH_PSL_EXPECTED_MIN_LENGTH = 214528; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,86 @@ | ||
import {fromUrl, NO_HOSTNAME} from "./from-url"; | ||
import { fromUrl, NO_HOSTNAME } from "./from-url"; | ||
|
||
describe(fromUrl.name, () => { | ||
test("it returns the hostname only", () => { | ||
expect(fromUrl("https://user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com", | ||
); | ||
}); | ||
test("it returns the hostname only", () => { | ||
expect(fromUrl("https://user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com" | ||
); | ||
}); | ||
|
||
test("it handles other protocols well", () => { | ||
expect(fromUrl("ftp://user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com", | ||
); | ||
}); | ||
test("it handles other protocols well", () => { | ||
expect(fromUrl("ftp://user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com" | ||
); | ||
}); | ||
|
||
test("it accepts incomplete URLs", () => { | ||
expect(fromUrl("//user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com", | ||
); | ||
expect(fromUrl("user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com", | ||
); | ||
expect(fromUrl("@www.example.com:8080/path?query")).toBe("www.example.com"); | ||
expect(fromUrl("www.example.com:8080/path?query")).toBe("www.example.com"); | ||
expect(fromUrl("com:8080/path?query")).toBe("com"); | ||
expect(fromUrl("com/?query")).toBe("com"); | ||
expect(fromUrl("com?query")).toBe("com"); | ||
}); | ||
test("it accepts incomplete URLs", () => { | ||
expect(fromUrl("//user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com" | ||
); | ||
expect(fromUrl("user@www.example.com:8080/path?query")).toBe( | ||
"www.example.com" | ||
); | ||
expect(fromUrl("@www.example.com:8080/path?query")).toBe("www.example.com"); | ||
expect(fromUrl("www.example.com:8080/path?query")).toBe("www.example.com"); | ||
expect(fromUrl("com:8080/path?query")).toBe("com"); | ||
expect(fromUrl("com/?query")).toBe("com"); | ||
expect(fromUrl("com?query")).toBe("com"); | ||
}); | ||
|
||
test("it returns the root domain for URLs with just the root domain", () => { | ||
expect(fromUrl(".:8080/path?query")).toBe("."); | ||
expect(fromUrl("./?query")).toBe("."); | ||
expect(fromUrl(".?query")).toBe("."); | ||
}); | ||
test("it returns the root domain for URLs with just the root domain", () => { | ||
expect(fromUrl(".:8080/path?query")).toBe("."); | ||
expect(fromUrl("./?query")).toBe("."); | ||
expect(fromUrl(".?query")).toBe("."); | ||
}); | ||
|
||
test("it returns a puny-encoded hostname", () => { | ||
expect(fromUrl("http://münchen.de")).toBe("xn--mnchen-3ya.de"); | ||
expect(fromUrl("münchen.de")).toBe("xn--mnchen-3ya.de"); | ||
}); | ||
test("it returns a puny-encoded hostname", () => { | ||
expect(fromUrl("http://münchen.de")).toBe("xn--mnchen-3ya.de"); | ||
expect(fromUrl("münchen.de")).toBe("xn--mnchen-3ya.de"); | ||
}); | ||
|
||
test("it handles already puny-encoded hostnames well", () => { | ||
expect(fromUrl("http://xn--mnchen-3ya.de")).toBe("xn--mnchen-3ya.de"); | ||
expect(fromUrl("xn--mnchen-3ya.de")).toBe("xn--mnchen-3ya.de"); | ||
}); | ||
test("it handles already puny-encoded hostnames well", () => { | ||
expect(fromUrl("http://xn--mnchen-3ya.de")).toBe("xn--mnchen-3ya.de"); | ||
expect(fromUrl("xn--mnchen-3ya.de")).toBe("xn--mnchen-3ya.de"); | ||
}); | ||
|
||
test("it handles URLs with IPv4", () => { | ||
expect(fromUrl("http://192.168.1.1/path?query")).toBe("192.168.1.1"); | ||
expect(fromUrl("//192.168.1.1")).toBe("192.168.1.1"); | ||
expect(fromUrl("192.168.1.1")).toBe("192.168.1.1"); | ||
}); | ||
test("it handles URLs with IPv4", () => { | ||
expect(fromUrl("http://192.168.1.1/path?query")).toBe("192.168.1.1"); | ||
expect(fromUrl("//192.168.1.1")).toBe("192.168.1.1"); | ||
expect(fromUrl("192.168.1.1")).toBe("192.168.1.1"); | ||
}); | ||
|
||
test("it handles URLs with IPv6", () => { | ||
expect(fromUrl("http://[1:2:3:4:5:6:7:8]/path?query")).toBe( | ||
"[1:2:3:4:5:6:7:8]", | ||
); | ||
expect(fromUrl("//[1:2:3:4:5:6:7:8]")).toBe("[1:2:3:4:5:6:7:8]"); | ||
expect(fromUrl("[1:2:3:4:5:6:7:8]")).toBe("[1:2:3:4:5:6:7:8]"); | ||
}); | ||
test("it handles URLs with IPv6", () => { | ||
expect(fromUrl("http://[1:2:3:4:5:6:7:8]/path?query")).toBe( | ||
"[1:2:3:4:5:6:7:8]" | ||
); | ||
expect(fromUrl("//[1:2:3:4:5:6:7:8]")).toBe("[1:2:3:4:5:6:7:8]"); | ||
expect(fromUrl("[1:2:3:4:5:6:7:8]")).toBe("[1:2:3:4:5:6:7:8]"); | ||
}); | ||
|
||
test("it returns the NO_HOSTNAME symbol for invalid URLs", () => { | ||
expect(fromUrl(":8080/path?query")).toBe(NO_HOSTNAME); | ||
expect(fromUrl("/path?query")).toBe(NO_HOSTNAME); | ||
expect(fromUrl("?query")).toBe(NO_HOSTNAME); | ||
expect(fromUrl("")).toBe(NO_HOSTNAME); | ||
}); | ||
test("it returns the NO_HOSTNAME symbol for invalid URLs", () => { | ||
expect(fromUrl(":8080/path?query")).toBe(NO_HOSTNAME); | ||
expect(fromUrl("/path?query")).toBe(NO_HOSTNAME); | ||
expect(fromUrl("?query")).toBe(NO_HOSTNAME); | ||
expect(fromUrl("")).toBe(NO_HOSTNAME); | ||
}); | ||
|
||
test("it handles different schemes", () => { | ||
expect(fromUrl("android-app://com.org.example")).toBe("com.org.example"); | ||
expect(fromUrl("file://root/.config")).toBe("root"); | ||
expect(fromUrl("mailto://person@mail.com")).toBe('mail.com'); | ||
expect(fromUrl("coap+ws://example.com")).toBe("example.com"); | ||
}); | ||
test("it handles different schemes", () => { | ||
expect(fromUrl("android-app://com.org.example")).toBe("com.org.example"); | ||
expect(fromUrl("file://root/.config")).toBe("root"); | ||
expect(fromUrl("mailto://person@mail.com")).toBe("mail.com"); | ||
expect(fromUrl("coap+ws://example.com")).toBe("example.com"); | ||
}); | ||
|
||
test("it returns the NO_HOSTNAME symbol for invalid input types", () => { | ||
// @ts-expect-error This is a deliberate error just for the test | ||
expect(fromUrl(undefined)).toBe(NO_HOSTNAME); | ||
// @ts-expect-error This is a deliberate error just for the test | ||
// eslint-disable-next-line no-null/no-null | ||
expect(fromUrl(null)).toBe(NO_HOSTNAME); | ||
// @ts-expect-error This is a deliberate error just for the test | ||
expect(fromUrl(true)).toBe(NO_HOSTNAME); | ||
// @ts-expect-error This is a deliberate error just for the test | ||
expect(fromUrl(1)).toBe(NO_HOSTNAME); | ||
/* eslint-enable */ | ||
}); | ||
test("it returns the NO_HOSTNAME symbol for invalid input types", () => { | ||
// @ts-expect-error This is a deliberate error just for the test | ||
expect(fromUrl(undefined)).toBe(NO_HOSTNAME); | ||
// @ts-expect-error This is a deliberate error just for the test | ||
// eslint-disable-next-line no-null/no-null | ||
expect(fromUrl(null)).toBe(NO_HOSTNAME); | ||
// @ts-expect-error This is a deliberate error just for the test | ||
expect(fromUrl(true)).toBe(NO_HOSTNAME); | ||
// @ts-expect-error This is a deliberate error just for the test | ||
expect(fromUrl(1)).toBe(NO_HOSTNAME); | ||
/* eslint-enable */ | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
/* istanbul ignore file */ | ||
// Jest will report function coverage errors here otherwise | ||
export { | ||
parseDomain, | ||
ParseResult, | ||
ParseResultType, | ||
ParseResultInvalid, | ||
ParseResultReserved, | ||
ParseResultNotListed, | ||
ParseResultListed, | ||
parseDomain, | ||
ParseResult, | ||
ParseResultType, | ||
ParseResultInvalid, | ||
ParseResultReserved, | ||
ParseResultNotListed, | ||
ParseResultListed, | ||
} from "./parse-domain"; | ||
export {fromUrl, NO_HOSTNAME} from "./from-url"; | ||
export {ValidationError, ValidationErrorType} from "./sanitize"; | ||
export { fromUrl, NO_HOSTNAME } from "./from-url"; | ||
export { ValidationError, ValidationErrorType } from "./sanitize"; |
Oops, something went wrong.