chore(format): run prettier over src/ and scripts/
Formatting was configured but never enforced: `bun run format:check` reported 199 unformatted files and ran in no workflow and in no git hook, so .prettierrc (printWidth 100, trailing commas) described an intention rather than the tree. This is the one-time sweep that makes the check gateable. Whitespace and token-reflow only -- no behavioural change: `bun run check` reports 0 errors and all 1053 frontend tests pass before and after. Kept out of every other commit on purpose. A 199-file diff mixed with real changes is unreviewable, and the next commit turns format:check into a hard CI gate so this cannot silently accumulate again.
This commit is contained in:
@@ -98,7 +98,7 @@ export function shouldNavigateToSearch(pathname: string, query: string): boolean
|
||||
/** Read a `?scope=` value, falling back when it is absent or unrecognised. */
|
||||
export function parseSearchScope(
|
||||
raw: string | null | undefined,
|
||||
fallback: SearchScope = "all"
|
||||
fallback: SearchScope = "all",
|
||||
): SearchScope {
|
||||
return SEARCH_SCOPES.includes(raw as SearchScope) ? (raw as SearchScope) : fallback;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ export interface SearchSeed {
|
||||
*/
|
||||
export function seedFromSearchUrl(
|
||||
params: URLSearchParams,
|
||||
applied: SearchSeed | null
|
||||
applied: SearchSeed | null,
|
||||
): SearchSeed | null {
|
||||
const seed: SearchSeed = {
|
||||
query: params.get("q") ?? "",
|
||||
@@ -141,13 +141,7 @@ export function seedFromSearchUrl(
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type SearchGroupId =
|
||||
| "shows"
|
||||
| "episodes"
|
||||
| "movies"
|
||||
| "songs"
|
||||
| "albums"
|
||||
| "artists"
|
||||
| "people";
|
||||
"shows" | "episodes" | "movies" | "songs" | "albums" | "artists" | "people";
|
||||
|
||||
/**
|
||||
* Shipped default order.
|
||||
@@ -268,12 +262,12 @@ export function normalizeGroupOrder(stored: unknown): SearchGroupId[] {
|
||||
/** Groups visible under a scope, in the user's configured order. */
|
||||
export function groupsForScope(
|
||||
scope: SearchScope,
|
||||
order: readonly SearchGroupId[] = DEFAULT_GROUP_ORDER
|
||||
order: readonly SearchGroupId[] = DEFAULT_GROUP_ORDER,
|
||||
): SearchGroupId[] {
|
||||
// A `null` GROUP_SCOPE (people) belongs to no narrow scope, so it survives
|
||||
// only under `all` — the `=== scope` test already excludes it elsewhere.
|
||||
return normalizeGroupOrder(order as SearchGroupId[]).filter(
|
||||
(id) => scope === "all" || GROUP_SCOPE[id] === scope
|
||||
(id) => scope === "all" || GROUP_SCOPE[id] === scope,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -292,7 +286,7 @@ export interface SearchGroup<T> {
|
||||
export function composeSearchGroups<T extends { type?: string | null }>(
|
||||
results: readonly T[],
|
||||
scope: SearchScope,
|
||||
order: readonly SearchGroupId[] = DEFAULT_GROUP_ORDER
|
||||
order: readonly SearchGroupId[] = DEFAULT_GROUP_ORDER,
|
||||
): SearchGroup<T>[] {
|
||||
return groupsForScope(scope, order)
|
||||
.map((id) => {
|
||||
@@ -310,7 +304,7 @@ export function composeSearchGroups<T extends { type?: string | null }>(
|
||||
export function moveGroup(
|
||||
order: readonly SearchGroupId[],
|
||||
id: SearchGroupId,
|
||||
delta: number
|
||||
delta: number,
|
||||
): SearchGroupId[] {
|
||||
const next = [...order];
|
||||
const from = next.indexOf(id);
|
||||
@@ -325,7 +319,7 @@ export function moveGroup(
|
||||
export function reorderGroups(
|
||||
order: readonly SearchGroupId[],
|
||||
from: number,
|
||||
to: number
|
||||
to: number,
|
||||
): SearchGroupId[] {
|
||||
const next = [...order];
|
||||
if (from < 0 || from >= next.length || to < 0 || to >= next.length || from === to) return next;
|
||||
|
||||
Reference in New Issue
Block a user