Adopt anti-slop lint rules - #20
Merged
Merged
Conversation
Contributor
Author
|
Superseded detail: the Oxlint layer described above has been replaced in this branch by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the anti-slop Oxlint rules via the shared
@flow-industries/lintpackage, and fixes every finding in this repo (34).Biome still owns formatting and the general lint set; Oxlint runs only anti-slop on top.
bun run lintis nowbiome check && oxlint.New:
cssVars()Five components asserted
{ "--x": v } as React.CSSPropertiesto smuggle CSS custom properties past React's types.src/utils/css-vars.tsreplaces all of them: keys are still checked (they must match--${string}) but nothing is asserted into a type it isn't.satisfiescannot do this job — the excess-property check rejects a fresh literal either way — so the helper is the honest fix.Behaviour fixes found along the way
form.tsxhad dead error handling. The contexts defaulted to{} as FormFieldContextValue, which made the existingif (!fieldContext) throwunreachable and placed it after the first use offieldContext.name. Contexts now default tonull, anduseFormFieldguards both contexts before use (after all hooks, so hook order is stable).sidebar.tsxsetOpenaccepted an updater it never advertised. The context type issetOpen: (open: boolean) => void, but the implementation also took(prev) => nextfor one internal call. Dropped the union so the implementation matches its published contract;toggleSidebarnow passes!open. Its dependency list was corrected accordingly.Other fixes
dock.tsx(4),status-widget.tsx,chart.tsx—Record<K, V>annotations on constant maps replaced withsatisfies.status-widget.tsx—deriveOverallfiltered endpoints then re-reade.results as ProbeResult[]; now a single filter chain that narrows on its own.input-group.tsx—(e.target as HTMLElement).closest(...)becamee.target instanceof HTMLElement && …, a real runtime check.sidebar.tsx— thetooltipprop'sstring | TooltipPropsconvenience union is discriminated withtooltip instanceof Object(a string primitive is not an Object) instead oftypeof.chart.tsx— the Recharts config lookup no longer indexes withas keyof typeof; it collects candidate fields and picks whichever names a real config entry, which is behaviour-preserving. Theme CSS generation iterates a typedTHEME_KEYStuple instead ofObject.entries+ an assertion. Primitive tests use coercion round-trips (String(x) === x,Number(x) === x) rather thantypeof.logo.tsx,profile-pill.tsx— conditional empty-object spreads replaced with plain optional properties.Testing
bun run lint(Biome + Oxlint) clean;bun run typecheckclean. The 8 remaining Biome warnings are pre-existing onmain(verified by stashing this branch's changes).bun run dev:status-widgetrenders "All systems operational" off the live API, exercising the rewrittenderiveOverall.--ratio: 1.7777,--sidebar-width: 16rem,--skeleton-width: 75%,--gap: 2,--color-desktop/#8ab4ff— everycssVarscall resolves.jan / Desktop 120 / Mobile 80, so the rewritten config lookup still resolves labels from the payload.expanded → collapsed → expanded, confirming thesetOpenchange.{ children }gives "Object form".Blocked on a publish
@flow-industries/lint@0.2.0is not on npm yet (the publish needs a 2FA OTP). Until it lands,bun install --frozen-lockfilecannot resolve it, so CI on this PR will fail andbun.lockstill records0.1.0. Once published, the branch needs one follow-up commit:bun installto regenerate the lockfile. Everything else here is final.How this was verified
Ran locally against a linked build of the new lint package.