mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 05:05:38 -04:00
chore: migrate oxlint config to e18e plugin and fix lint violations
- Replace root `eslint-plugin-lingui` jsPlugin with `@e18e/eslint-plugin`; move lingui rules into per-app `.oxlintrc.json` overrides for native and web
- Add `jsx-a11y`, `react-hooks-js` (native), and expanded lingui rule sets to per-app configs
- Add `oxc/no-barrel-file` warning at threshold 0 to root config
- Fix `e18e/prefer-url-canparse`: replace `try { new URL() } catch` with `URL.canParse()` in server-url screen and server lib
- Fix `e18e/prefer-timer-args`: pass callback args directly to `setTimeout` instead of wrapping in arrow functions (use-debounce, integration-card)
- Fix `e18e/prefer-static-regex`: hoist `/\/+$/` to module-level constant in server-url screen
- Fix `react-hooks-js/refs` and `react-hooks-js/set-state-in-effect`: convert `useRef` tracking patterns to `useState` + render-time derived updates in `use-server-connection`, `expandable-text`, and settings screen
- Fix `react-hooks-js/immutability`: extract stable palette sub-values before `useMemo` deps in title detail screen
- Apply `e18e` and other rule fixes across core, tmdb, web components, and i18n packages
This commit is contained in:
@@ -338,7 +338,11 @@ export function getRecommendationsFeed(userId: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const sorted = [...recs.values()].sort((a, b) => b.score - a.score).slice(0, 20);
|
||||
const sorted = recs
|
||||
.values()
|
||||
.toArray()
|
||||
.toSorted((a, b) => b.score - a.score)
|
||||
.slice(0, 20);
|
||||
|
||||
if (sorted.length === 0) return [];
|
||||
|
||||
@@ -495,7 +499,7 @@ export function getUpcomingFeed(
|
||||
// Compute cursor from the last item on this page
|
||||
let nextCursor: string | null = null;
|
||||
if (hasMore && pageItems.length > 0) {
|
||||
const last = pageItems[pageItems.length - 1]!;
|
||||
const last = pageItems.at(-1)!;
|
||||
nextCursor = btoa(JSON.stringify({ d: last.date, n: last.titleName, i: last.titleId }));
|
||||
}
|
||||
|
||||
@@ -579,7 +583,7 @@ export function getRecommendationsForTitle(titleId: string) {
|
||||
tmdb_recommendations: 0,
|
||||
tmdb_similar: 1,
|
||||
} as const;
|
||||
const orderedRecs = [...recs].sort(
|
||||
const orderedRecs = recs.toSorted(
|
||||
(a, b) => a.rank - b.rank || sourcePriority[a.source] - sourcePriority[b.source],
|
||||
);
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ export async function cacheProviderLogos(titleId: string) {
|
||||
}
|
||||
}
|
||||
const checks = await Promise.all(
|
||||
[...uniqueLogos.entries()].map(async ([basename, logoPath]) => ({
|
||||
Array.from(uniqueLogos.entries(), async ([basename, logoPath]) => ({
|
||||
logoPath,
|
||||
cached: await isImageCached("logos", basename),
|
||||
})),
|
||||
@@ -248,7 +248,7 @@ export async function cacheProfilePhotos(titleId: string) {
|
||||
}
|
||||
}
|
||||
const checks = await Promise.all(
|
||||
[...uniqueProfiles.entries()].map(async ([basename, profilePath]) => ({
|
||||
Array.from(uniqueProfiles.entries(), async ([basename, profilePath]) => ({
|
||||
profilePath,
|
||||
cached: await isImageCached("profiles", basename),
|
||||
})),
|
||||
|
||||
@@ -6,6 +6,7 @@ const APP_VERSION = process.env.APP_VERSION || "0.0.0";
|
||||
|
||||
const log = createLogger("update-check");
|
||||
|
||||
const VERSION_PREFIX_RE = /^v/;
|
||||
const PUBLIC_API_URL = process.env.PUBLIC_API_URL || "https://public-api.sofa.watch";
|
||||
const CHECK_INTERVAL_MS = 6 * 60 * 60 * 1000; // 6 hours
|
||||
|
||||
@@ -25,7 +26,7 @@ export function isUpdateCheckEnabled(): boolean {
|
||||
|
||||
/** @internal Returns true if `latest` is strictly newer than `current` using semver comparison. */
|
||||
export function isNewerVersion(latest: string, current: string): boolean {
|
||||
const parse = (v: string) => v.replace(/^v/, "").split(".").map(Number);
|
||||
const parse = (v: string) => v.replace(VERSION_PREFIX_RE, "").split(".").map(Number);
|
||||
const [lMajor = 0, lMinor = 0, lPatch = 0] = parse(latest);
|
||||
const [cMajor = 0, cMinor = 0, cPatch = 0] = parse(current);
|
||||
if (lMajor !== cMajor) return lMajor > cMajor;
|
||||
|
||||
Reference in New Issue
Block a user