mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +00:00
e8f3ed9ffe
`npm run lint` reported 99 errors and 26 warnings across 65 files and had presumably been failing for a while — next.config.ts sets eslint.ignoreDuringBuilds, so the build never surfaced it. 68 were in vendored code: components/charts and components/ai-elements, pulled from upstream registries. Re-linting those reports upstream's style back at us, and "fixing" them means diverging and eating conflicts on every update — ai-elements already has exactly this carve-out on the TypeScript side via ignoreBuildErrors. Ignore both, plus the two registry files in components/ui (carousel publishes its api from an effect; the sidebar skeleton picks a random width). The other 31 were ours, nearly all react-hooks/set-state-in-effect on the same shape: an effect that re-seeds form state when a dialog opens or a selection changes. Moved to render-phase adjustment, which is both what React recommends and a real fix — the effect version paints one frame of the *previous* record's values before correcting itself. Two carried sharper bugs: the employee dialog could keep a typed password across a switch to another member, and use-wallet-sync could carry `linked` over to a newly-selected patient, briefly offering to push a record to someone else's wallet. The rest: useIsMobile and speech-support detection become useSyncExternalStore (correct on first paint, no mount flash); refs mirroring state are written in effects rather than during render; the care-team fetch moves into its effect behind a reload key, dropping an exhaustive-deps suppression. Two effects in chat-panel keep the rule disabled with a reason. Both are what effects are for: draining the queued-message buffer when the transport goes idle, and resolving ?thread from the URL — the latter mints an id with nanoid(), so moving it into render would just trade this error for a purity one. Also removes a dead /explore-era import and unused directives found on the way. lint now exits 0, with the ai-elements tsc carve-out unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
import { defineConfig, globalIgnores } from "eslint/config";
|
|
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
import nextTs from "eslint-config-next/typescript";
|
|
|
|
const eslintConfig = defineConfig([
|
|
...nextVitals,
|
|
...nextTs,
|
|
// Override default ignores of eslint-config-next.
|
|
globalIgnores([
|
|
// Default ignores of eslint-config-next:
|
|
".next/**",
|
|
"out/**",
|
|
"build/**",
|
|
"next-env.d.ts",
|
|
|
|
// Vendored component libraries we don't hand-maintain. Both are pulled in
|
|
// from upstream registries and re-linting them just reports upstream's
|
|
// style back at us — `react-hooks/refs` and `set-state-in-effect` alone
|
|
// account for most of it, and "fixing" them means diverging from upstream
|
|
// and eating the conflicts on every update.
|
|
//
|
|
// ai-elements additionally has pre-existing Base UI type drift already
|
|
// carved out via typescript.ignoreBuildErrors in next.config.ts; this is
|
|
// the lint half of that same carve-out. See CLAUDE.md.
|
|
"components/ai-elements/**",
|
|
"components/charts/**",
|
|
|
|
// Registry components, added/updated via `npx shadcn add` rather than
|
|
// hand-written. Two carry upstream patterns the compiler rules dislike
|
|
// (carousel publishes its api to the parent from an effect; the sidebar
|
|
// skeleton picks a random width), and editing them here would be undone by
|
|
// the next registry update.
|
|
"components/ui/carousel.tsx",
|
|
"components/ui/sidebar.tsx",
|
|
]),
|
|
]);
|
|
|
|
export default eslintConfig;
|