mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-19 01:14:21 +01:00
- dufs-client.test.ts: type fetch mocks as vi.fn<typeof fetch>() (fixes the TS2493/TS2352 tuple/undefined build errors that broke `pnpm build`) - dufs-client.ts: explicit method arg drops the unreachable `?? "GET"` branch - gallery/grid: -1 viewer-index sentinel + pass media entry, removing three unreachable defensive guards; onOpenMedia now takes the entry - use-hash-path: extract serverPath() so the SSR snapshot is covered - eslint: strict+stylistic type-checked, react-hooks, reportUnusedDisable Directives; drop eslint-plugin-react (incompatible with ESLint 10) - add grid.test.tsx + use-listing.test.ts; coverage thresholds 100/100/100/100 (62 tests: statements/branches/functions/lines all 100%) - phone_focus_mode/config.sh: whitelist com.kuhy.dufs_client Deployed live via setup_cloud_gallery.sh (render-spa); fixed ffmpeg by renaming a stale /usr/local/bin shadow linking the removed libvpx.so.11; regenerated thumbnails (10 made, 0 failed). APK installed + launch-verified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0126QvdMrv2WNeUVShFiLTc3
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
import js from "@eslint/js";
|
|
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
// Aggressive, type-aware config: everything typescript-eslint's strict +
|
|
// stylistic *type-checked* presets flag is an error, plus the React Hooks
|
|
// rules. Unused disable directives are themselves errors, so every
|
|
// `eslint-disable` must be load-bearing.
|
|
//
|
|
// eslint-plugin-react is intentionally omitted: 7.37.x still calls the
|
|
// `context.getFilename()` API that ESLint 10 removed, so it crashes the run.
|
|
// TypeScript already covers prop typing, and react-hooks (v10-ready) covers the
|
|
// hook-specific rules that TS cannot.
|
|
export default tseslint.config(
|
|
{ ignores: ["dist", "coverage"] },
|
|
{ linterOptions: { reportUnusedDisableDirectives: "error" } },
|
|
js.configs.recommended,
|
|
...tseslint.configs.strictTypeChecked,
|
|
...tseslint.configs.stylisticTypeChecked,
|
|
{
|
|
files: ["**/*.{ts,tsx}"],
|
|
plugins: { "react-hooks": reactHooksPlugin },
|
|
languageOptions: {
|
|
parserOptions: {
|
|
project: "./tsconfig.json",
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
rules: {
|
|
...reactHooksPlugin.configs.recommended.rules,
|
|
"@typescript-eslint/restrict-template-expressions": [
|
|
"error",
|
|
{ allowNumber: true },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
// Asserting on a vitest mock method (e.g. `expect(client.remove)`) trips
|
|
// unbound-method even though the reference is safe; disable it in tests.
|
|
files: ["**/*.test.{ts,tsx}", "src/test/**"],
|
|
rules: { "@typescript-eslint/unbound-method": "off" },
|
|
},
|
|
{
|
|
files: ["*.js", "*.mjs", "*.cjs"],
|
|
...tseslint.configs.disableTypeChecked,
|
|
},
|
|
);
|