Chore: make ESLint Happy

This commit is contained in:
SukkaW
2024-10-10 21:40:54 +08:00
parent 40cda6997a
commit e40979e50e
31 changed files with 228 additions and 220 deletions

View File

@@ -3,19 +3,19 @@ import { parse as tldtsParse } from 'tldts';
import { $fetch } from './make-fetch-happen';
import type { NodeFetchResponse } from './make-fetch-happen';
const isDomainLoose = (domain: string): boolean => {
function isDomainLoose(domain: string): boolean {
const { isIcann, isPrivate, isIp } = tldtsParse(domain);
return !!(!isIp && (isIcann || isPrivate));
};
}
export const extractDomainsFromFelixDnsmasq = (line: string): string | null => {
export function extractDomainsFromFelixDnsmasq(line: string): string | null {
if (line.startsWith('server=/') && line.endsWith('/114.114.114.114')) {
return line.slice(8, -16);
}
return null;
};
}
export const parseFelixDnsmasqFromResp = async (resp: Response | NodeFetchResponse): Promise<string[]> => {
export async function parseFelixDnsmasqFromResp(resp: Response | NodeFetchResponse): Promise<string[]> {
const results: string[] = [];
for await (const line of createReadlineInterfaceFromResponse(resp)) {
@@ -26,9 +26,9 @@ export const parseFelixDnsmasqFromResp = async (resp: Response | NodeFetchRespon
}
return results;
};
}
export const parseFelixDnsmasq = async (url: string): Promise<string[]> => {
export async function parseFelixDnsmasq(url: string): Promise<string[]> {
const resp = await $fetch(url);
return parseFelixDnsmasqFromResp(resp);
};
}