mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 06:15:39 -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:
@@ -1,10 +1,21 @@
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { clearAllTables, insertUser } from "@sofa/test/db";
|
||||
|
||||
import { setSetting } from "../src/settings";
|
||||
import { isTelemetryEnabled, performTelemetryReport } from "../src/telemetry";
|
||||
|
||||
const TEST_NOW = new Date("2026-03-01T12:00:00Z");
|
||||
|
||||
beforeAll(() => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(TEST_NOW);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
clearAllTables();
|
||||
insertUser("user-1");
|
||||
@@ -60,7 +71,7 @@ describe("performTelemetryReport", () => {
|
||||
|
||||
test("respects 24-hour report interval", async () => {
|
||||
setSetting("telemetryEnabled", "true");
|
||||
setSetting("telemetryLastReportedAt", new Date().toISOString());
|
||||
setSetting("telemetryLastReportedAt", TEST_NOW.toISOString());
|
||||
|
||||
const fetchSpy = vi.spyOn(globalThis, "fetch");
|
||||
await performTelemetryReport();
|
||||
@@ -69,7 +80,7 @@ describe("performTelemetryReport", () => {
|
||||
|
||||
test("reports again after interval expires", async () => {
|
||||
setSetting("telemetryEnabled", "true");
|
||||
const oldDate = new Date(Date.now() - 25 * 60 * 60 * 1000).toISOString();
|
||||
const oldDate = new Date(TEST_NOW.getTime() - 25 * 60 * 60 * 1000).toISOString();
|
||||
setSetting("telemetryLastReportedAt", oldDate);
|
||||
|
||||
vi.spyOn(globalThis, "fetch").mockImplementation(
|
||||
|
||||
Reference in New Issue
Block a user