Migrate Prettier/Eslint/Stylelint setup to Biome (#1772)

* Initial

* CSS lint

* Test CI

* Add 1v1, 2v2, and 3v3 Tags (#1771)

* Initial

* CSS lint

* Test CI

* Rename step

---------

Co-authored-by: xi <104683822+ximk@users.noreply.github.com>
This commit is contained in:
Kalle
2024-06-24 13:07:17 +03:00
committed by GitHub
parent 73e9fca492
commit fd48bced91
1070 changed files with 219485 additions and 224310 deletions

View File

@@ -2,69 +2,69 @@ import type { GearType } from "~/db/types";
import { assertUnreachable } from "./types";
export function inGameNameWithoutDiscriminator(inGameName: string) {
return inGameName.split("#")[0];
return inGameName.split("#")[0];
}
export function makeTitle(title: string | string[]) {
return `${Array.isArray(title) ? title.join(" | ") : title} | sendou.ink`;
return `${Array.isArray(title) ? title.join(" | ") : title} | sendou.ink`;
}
export function semiRandomId() {
return String(Math.random());
return String(Math.random());
}
export const rawSensToString = (sens: number) =>
`${sens > 0 ? "+" : ""}${sens / 10}`;
`${sens > 0 ? "+" : ""}${sens / 10}`;
type WithStart<
S extends string,
Start extends string,
S extends string,
Start extends string,
> = S extends `${Start}${infer Rest}` ? `${Start}${Rest}` : never;
export function startsWith<S extends string, Start extends string>(
str: S,
start: Start,
// @ts-expect-error TS 4.9 upgrade
str: S,
start: Start,
// @ts-expect-error TS 4.9 upgrade
): str is WithStart<S, Start> {
return str.startsWith(start);
return str.startsWith(start);
}
type Split<S extends string, Sep extends string> = string extends S
? string[]
: S extends ""
? []
: S extends `${infer T}${Sep}${infer U}`
? [T, ...Split<U, Sep>]
: [S];
? string[]
: S extends ""
? []
: S extends `${infer T}${Sep}${infer U}`
? [T, ...Split<U, Sep>]
: [S];
export function split<S extends string, Sep extends string>(
str: S,
seperator: Sep,
str: S,
seperator: Sep,
) {
return str.split(seperator) as Split<S, Sep>;
return str.split(seperator) as Split<S, Sep>;
}
export function gearTypeToInitial(gearType: GearType) {
switch (gearType) {
case "HEAD":
return "H";
case "CLOTHES":
return "C";
case "SHOES":
return "S";
default:
assertUnreachable(gearType);
}
switch (gearType) {
case "HEAD":
return "H";
case "CLOTHES":
return "C";
case "SHOES":
return "S";
default:
assertUnreachable(gearType);
}
}
export function capitalize(str: string) {
return str[0].toUpperCase() + str.slice(1);
return str[0].toUpperCase() + str.slice(1);
}
export function pathnameFromPotentialURL(maybeUrl: string) {
try {
return new URL(maybeUrl).pathname.replace("/", "");
} catch {
return maybeUrl;
}
try {
return new URL(maybeUrl).pathname.replace("/", "");
} catch {
return maybeUrl;
}
}