Commit Graph

44 Commits

Author SHA1 Message Date
Aiden Bai 2b0f06ec70 perf: profile and optimize rule execution (#1663) 2026-08-20 22:05:20 -07:00
Aiden Bai bea01b8cf5 feat(r3f): add material rendering diagnostics (#1633) 2026-08-12 15:40:07 -07:00
Aiden Bai 8dfb013067 Add comprehensive Three.js and R3F diagnostics (#1629) 2026-08-11 15:40:53 -07:00
Aiden Bai c1611428d2 test(fuzz): complete React Bench audit corpus (#1619) 2026-08-09 02:04:45 -07:00
Aiden Bai 27a39dede7 fix(rules): recognize retained cleanup ownership (#1615)
* fix(rules): recognize retained cleanup ownership

* fix(types): normalize optional AST parents

* test: store imported corpus as source text fixtures
2026-08-08 21:50:44 -07:00
Aiden Bai 7f028ea904 fix(rules): accept compound unmount guards (#1606) 2026-08-08 06:23:37 -07:00
Aiden Bai f27fd5d136 fix(rules): close exhaustive React Bench audit gaps (#1605)
* fix(rules): close exhaustive React Bench audit gaps

* fix(core): fingerprint effect helper imports

* test(fuzz): preserve audit corpus bytes
2026-08-08 04:49:52 -07:00
Aiden Bai 6a546c2a4c test(fuzz): pin exhaustive React Bench audit corpus (#1603)
* test(fuzz): pin exhaustive React Bench audit corpus

* fix(fuzz): normalize corpus paths

* test(fuzz): normalize corpus expectations

* fix(fuzz): skip TypeScript declarations
2026-08-07 17:38:28 -07:00
Aiden Bai d62caa575f fix(rule): harden effect cleanup regressions (#1596)
* fix(rule): harden effect cleanup regressions

* fix(fuzz): preserve cleanup-local scope
2026-08-06 17:43:18 -07:00
Aiden Bai 0efadda676 fix(rule): preserve lifecycle synchronization semantics (#1579) 2026-08-04 23:54:24 -07:00
Skosh afd60dbe69 fix(effect-needs-cleanup): prove effect-owned cleanup (#1559)
* fix(effect-needs-cleanup): handle returned identifiers for addEventListener/addListener

Fixes #1558 - Part 1

- Allow returning identifiers bound to addEventListener/addListener results as valid cleanup
- Recognize calling such identifiers (e.g., ) as cleanup
- This fixes false positives for React Native's NetInfo.addEventListener and similar APIs

Remaining work: helper function cleanup and array collection cleanup

Co-authored-by: Skosh <skoshx@users.noreply.github.com>

* docs: add changeset for addEventListener cleanup fix

Co-authored-by: Skosh <skoshx@users.noreply.github.com>

* fix(effect-needs-cleanup): prove resource ownership

* fix(effect-needs-cleanup): harden ownership proofs

* fix(effect-needs-cleanup): isolate deferred ownership

* fix(effect-needs-cleanup): prove deferred timer ownership

* fix(effect-needs-cleanup): narrow invocation owners

* fix(effect-needs-cleanup): track helper collection mutations

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Aiden Bai <aiden@million.dev>
2026-08-03 13:29:06 -07:00
Aiden Bai 8c4959bb74 fix(rules): harden parity diagnostics (#1419)
* fix(rules): harden parity diagnostics

* fix(evals): keep parity artifacts parseable

* fix(evals): support Windows harness tests

* fix(fuzz): parse CRLF corpus directives
2026-07-20 22:28:25 -07:00
Aiden Bai 5b468f8a92 feat(rules): add React Three Fiber diagnostics (#1371) 2026-07-20 09:22:48 -07:00
Aiden Bai 0b0b5ac523 feat(rules): add deterministic UI, accessibility, and animation diagnostics (#1337)
* feat(rules): add 10 motion, accessibility, and design lint rules

Derived from a cross-resource design reference (every principle from the
design knowledge base), deduped against the full existing rule inventory.

Motion: extend no-transition-all to the Tailwind `transition-all` class
(was inline-only) and add no-tailwind-layout-transition for arbitrary
`transition-[<layout-prop>]`.

Accessibility: no-autoplay-without-muted, no-uninformative-aria-label,
no-target-blank-without-rel, and no-low-contrast-inline-style (computes the
real WCAG 2.1 ratio from co-located inline color + backgroundColor).

Design/Tailwind hygiene: no-redundant-display-class, prefer-truncate-shorthand,
no-full-viewport-width, and no-svg-currentcolor-with-fill-class.

All register via codegen (388 rules); 77 co-located tests pass; typecheck,
lint, and format clean.

* fix(rules): correct two false positives found in rule-validate

- no-low-contrast-inline-style: when the inline style has no `fontSize`,
  the text may be sized large via a class (`text-5xl`), so fall back to the
  lenient 3:1 large-text threshold instead of 4.5:1 to avoid flagging large
  text that only needs 3:1. Stricter 4.5:1 applies only when the size is a
  visible normal size.
- no-redundant-display-class: `<li>` defaults to `display: list-item`, not
  `block`, so `block` on an `<li>` is meaningful — removed `li` from the
  block-default set.

Adds regression tests for both.

* fix(rules): resolve Cursor Bugbot findings

- no-low-contrast-inline-style: use a solid `background` shorthand color as
  the background (was skipped entirely, missing low-contrast pairs); skip only
  gradients/images/ambiguous (both backgroundColor + background). Also treat a
  string `fontWeight: "700"` as bold for the large-text threshold.
- no-transition-all: match `transition-all` as a whole Tailwind token (segment
  after variant prefixes) so compound classes like `transition-all-custom` are
  not falsely flagged.
- no-svg-currentcolor-with-fill-class: exclude stroke-WIDTH utilities
  (`stroke-2`, `stroke-[1.5]`) — they set thickness, not color — so they no
  longer false-conflict with `stroke="currentColor"`.

Adds regression tests for each.

* feat(rules): add 3 Tailwind-canonicalization rules from ui.sh guidance

- no-deprecated-tailwind-class: flag Tailwind v4 renames (bg-gradient-* →
  bg-linear-*, flex-shrink-* → shrink-*, flex-grow-* → grow-*,
  overflow-ellipsis → text-ellipsis). Gated on a new `tailwind:4` capability.
- no-arbitrary-px-font-size: `text-[13px]` → rem so text scales with the
  user's root font size (px stays fine for border-*/outline-*).
- prefer-dvh-over-vh: `h-screen`/`min-h-screen`/`h-[100vh]` → dvh (tailwind:3.4).

Adds `tailwind:4` capability to @react-doctor/core and extracts a shared
`get-class-name-tokens` util (variant-aware token splitting), reused by
no-transition-all and no-svg-currentcolor-with-fill-class.

* fix(rules): adversarial-review false positives in the new design rules

- no-tailwind-layout-transition: match transition-[…] property names exactly
  (comma-split + set) so SVG `stroke-width` / `border-width` — which merely
  contain "width" — are no longer flagged as HTML layout thrash.
- no-full-viewport-width: drop `max-w-*` / `maxWidth` (a defensive cap, not the
  overflow footgun); keep `w-screen`/`w-[100vw]`/`width`/`minWidth`.
- prefer-dvh-over-vh: drop `max-h-*` / `maxHeight` (a valid height cap, e.g. a
  scrollable modal); keep `h-screen`/`min-h-screen`/`height`/`minHeight`.
- no-deprecated-tailwind-class: only rename `bg-gradient-to-*` → `bg-linear-to-*`
  (v4 radial/conic are `bg-radial`/`bg-conic`, not `bg-linear-radial`).

Adds regression tests for each false positive.

* fix(rules): resolve thermo-review false positives

- no-svg-currentcolor-with-fill-class: only treat UNPREFIXED `fill-*`/`stroke-*`
  color classes as conflicts; `hover:fill-blue-600` / `dark:fill-white` (state-
  gated, no static conflict with the base `fill="currentColor"`) are no longer
  flagged — a very common icon pattern.
- no-low-contrast-inline-style: reject 4-arg `rgb(0,0,0,0.5)` / slash-form alpha
  (was judged opaque), and bail when the style object contains a `{...spread}`
  that could override the colors. Tag `test-noise` to match sibling no-tiny-text.
- no-full-viewport-width: drop the redundant `category: "Architecture"` override
  (it's the design-bucket default).
- Extract `has-jsx-spread-attribute` util; use it in the two a11y rules.

Adds regression tests for the variant-prefixed svg classes, rgb-alpha, opaque
rgb, and the style-spread bail.

* refactor(rules): deslop the design/motion/a11y rule additions

Consolidate duplication surfaced by an adversarial deslop pass; no behavior
change (the same diagnostics fire for the same inputs):

- no-autoplay-without-muted: fold isStaticallyTrue/isStaticallyFalse into one
  tri-state resolveStaticBoolean, mirroring the existing parseJsxValue idiom
- no-svg-currentcolor-with-fill-class: collapse the duplicated fill/stroke
  branches into a single loop over the two paint attributes
- no-low-contrast-inline-style: hoist the repeated `properties` fallback
- no-uncontrolled-input: drop the local hasJsxSpreadAttribute copy in favor of
  the branch's new shared utils/has-jsx-spread-attribute, completing the extraction

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(rules): no-deprecated-tailwind-class stops flagging overflow-clip

`overflow-clip` is a current Tailwind utility for `overflow: clip` (v3.1+,
still present in v4) — it was never renamed to `text-clip`, which sets the
unrelated `text-overflow: clip`. The stray mapping produced an incorrect
"renamed in v4" suggestion (Cursor Bugbot). Only `overflow-ellipsis ->
text-ellipsis` is a real rename; keep that. Adds a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(capabilities): require a confirmed Tailwind major for the tailwind:4 gate

`tailwind:4` gates no-deprecated-tailwind-class, which tells users a class was
renamed/removed in v4. The optimistic-on-null policy (assume latest for an
unparseable spec like `workspace:*`) is right for the suggestion rule behind
`tailwind:3.4`, but for a deprecation rule it surfaces confidently-wrong
"renamed in v4" warnings on a v3 project. Require a CONFIRMED parsed major >= 4
for tailwind:4 — favor a false negative over a false positive (Cursor Bugbot).
`tailwind:3.4` stays optimistic. Adds an unparseable-version regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(rules): resolve Bugbot/Devin review findings on design/a11y rules

- no-full-viewport-width: match variant-prefixed `md:w-screen` / `lg:min-w-screen`, mirroring the sibling `prefer-dvh-over-vh` regex (overflow happens at every breakpoint).
- no-target-blank-without-rel: resolve `rel={'noopener'}` expression-container literals instead of treating them as dynamic, so reverse-tabnabbing isn't silently missed; share one literal resolver with the `target` check.
- Extract the bare `16` root-font-size divisor into `ROOT_FONT_SIZE_PX` per the magic-number convention.

* fix(rules): no-uninformative-aria-label resolves braced string literals

Extracts no-target-blank-without-rel's inline getStringLiteralAttributeValue
into a shared util and uses it in no-uninformative-aria-label, so a static
braced literal like aria-label={'icon'} is judged instead of silently skipped
(getJsxPropStringValue only handles plain string literals). Adds regression
tests for the braced uninformative and braced descriptive cases.

Addresses Bugbot review on #850.

* test(rules): add liveness fixtures after rebase

* fix(rules): address automated review findings

* fix(rules): handle leading-dot stroke widths

* fix(rules): skip dynamic background overrides

* fix(rules): address target blank and transition reviews

* fix(rules): skip svg layout transitions

* fix(rules): preserve font line height suggestion

* fix(rules): match complete transition utilities

* fix(rules): share layout transition properties

* fix(rules): bound deprecated utility prefixes

* fix(rules): clear dynamically overridden colors

* fix(rules): tighten style and svg precision

* fix(rules): preserve competing display utilities

* fix(rules): preserve animation property scopes

* feat(rules): expand deterministic design checks

* feat(rules): add structural design diagnostics

* feat(rules): complete source-auditable design checks

* fix(rules): skip unresolved input types

* fix(rules): tighten layout and boundary detection

* fix(rules): close motion and padding gaps

* fix(rules): tighten surface and line-height proofs

* fix(rules): evaluate opaque hsl contrast

* fix(rules): honor effective static values

* fix(rules): honor final inline style declarations

* fix(rules): respect variants and share surface checks

* fix(rules): traverse fragments and preserve variant scope

* feat(rules): deepen UI quality diagnostics

* feat(rules): add deterministic animation diagnostics

* fix(rules): retain in-house accessibility checks

* feat(rules): expand deterministic UI diagnostics

* feat(rules): detect generated interface patterns

* fix(rules): respect dynamic style overrides

* feat(rules): expand deterministic design diagnostics

* fix(rules): close design precision gaps

* feat(rules): expand deterministic design and accessibility checks

* feat(rules): detect unsafe Motion API usage

* test(fuzz): remove duplicate module snippets

* feat(cli): add focused design command

* fix(design): include the complete rule bucket

* fix(core): align opt-in rule gates

* feat(rules): expand deterministic motion and interaction checks

* feat(rules): harden deterministic design diagnostics

* fix(rules): harden design expansion diagnostics

* fix(rules): apply large-corpus precision review

* fix(rules): suppress large-corpus accessibility noise

* fix(core): detect compiler in rstack configs

* fix(a11y): avoid responsive navigation false positives

* fix(rules): reduce design corpus false positives

* fix(rules): restore will-change build after rebase

* fix(rules): harden all-rules corpus precision

---------

Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 01:09:01 -07:00
Aiden Bai cd9ca68faa NEW_RULES: Add rule analysis foundation and 56 rules (#1402)
* NEW_RULES: Reapply rule analysis foundation

Reapply the complete reviewed NEW_RULES stack on top of current main after the rollback.

* fix(rules): harden new diagnostics against false positives

* fix(rules): preserve dynamic context providers

* fix(core): resolve styled-components workspace versions

* fix(rules): harden new diagnostics after deep audit
2026-07-20 00:54:55 -07:00
Aiden Bai 6fcd9c9576 feat(plugin): detect eager Zustand get calls (#1407)
* feat(plugin): detect eager Zustand get calls

* fix(rule): cover eager async Zustand reads

* fix(rule): model Zustand async suspension paths

* fix(rule): follow eager Zustand helper calls
2026-07-19 23:51:17 -07:00
Aiden Bai 7eca0eebf9 feat(rule): detect whole Zustand store subscriptions (#1398)
* feat(plugin): detect whole Zustand subscriptions

* fix(rule): cover traditional Zustand stores

* fix(rule): detect imported Zustand store creators
2026-07-19 23:47:57 -07:00
Aiden Bai 8e5ae45dd3 feat(rules): detect unstable Zustand selector results (#1395)
* feat(rules): detect unstable Zustand selector results

* fix(rules): tighten Zustand selector provenance

* fix(rules): gate fresh Zustand selectors to v5

* fix(rules): harden Zustand selector gating

* fix(rule): respect Zustand v5 equality APIs

* fix(rule): harden Zustand selector analysis

* fix(rule): prove Zustand selector collection shapes

* test(rule): cover split curried Zustand stores

* fix(rule): classify Object collection helpers
2026-07-19 23:44:55 -07:00
Aiden Bai 5774353907 feat(rules): detect Valtio snapshot reads in callbacks (#1397)
* feat(rules): detect Valtio snapshot reads in callbacks

* fix(rules): gate Valtio callback checks by dependency

* fix(rules): follow deferred Valtio callback aliases

* fix(rules): require supported Valtio version
2026-07-19 07:01:38 -07:00
Aiden Bai a4eaeddefe feat(rules): detect Valtio proxy reads during render (#1396) 2026-07-19 06:44:56 -07:00
Aiden Bai 88114a2332 Revert "NEW_RULES: Add rule analysis foundation" (#1401)
Reverts #1338 in full.
2026-07-19 03:16:55 -07:00
Aiden Bai 3018538b7c NEW_RULES: Add rule analysis foundation (#1338)
Replace aggregate PR #1000 with the reviewed NEW_RULES stack, including workspace capability aggregation and stable performance regression coverage.
2026-07-19 02:56:31 -07:00
Aiden Bai d9700556d1 fix(rules): guideline audit — compiler gates, capability fixes, message honesty across 15 rules (#1369)
Co-authored-by: Aiden Bai <aiden.bai05@gmail.com>
2026-07-18 01:03:13 -07:00
Aiden Bai 43327b535c fix(no-unstable-nested-components): prove element-type usage (#1252)
* test(no-unstable-nested-components): reproduce memo callback FP

* fix(no-unstable-nested-components): prove element-type usage

* test(no-unstable-nested-components): preserve component slots

---------

Co-authored-by: Oracle <oracle@bench.local>
2026-07-14 00:01:00 -07:00
Aiden Bai ed3e9411a1 fix(require-reduced-motion): require executable evidence (#1238)
* chore: mark reduced-motion evidence fix

* fix: require semantic reduced-motion evidence

* fix: harden executable reduced-motion evidence

* fix: continue motion export resolution

* fix: resolve default motion exports

---------

Co-authored-by: Oracle <oracle@bench.local>
2026-07-14 00:00:57 -07:00
Ray Arayilakath c1916d577d fix(effect-needs-cleanup): require exhaustive loop cleanup (follow-up to #1199) (#1212)
* refactor(effect-needs-cleanup): simplify loop cleanup review deslop

- doesCleanupFunctionReleaseUsage: hoist the duplicated ChainExpression unwrap into one binding and short-circuit async/generator checks before helper recursion
- resolveIteratorCollectionKey: collapse the split symbol/kind guards back into one
- isAssignmentFormForOfIteratorReference: consolidate the two near-duplicate walkAst reference-matching blocks into one assignsReferencedSymbol closure

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(effect-needs-cleanup): address review findings on fix/effect-cleanup-loop-pairs

- effect-needs-cleanup.ts:1692 — require an exhaustive removal loop in doesReleaseCallMatchUsage's for-of pairing so retained-handler analysis (fileContainsReleaseForUsage) no longer treats a break-truncated loop as a full release; pinned both directions plus the effect-cleanup path in effect-needs-cleanup.regressions.test.ts
- utils/resolve-event-listener-capture.ts — folded the rule-local resolveStaticEventListenerCapture fork into the shared resolveEventListenerCapture behind allowComputedString/allowIndeterminateEntries options; both consuming rules keep their exact prior semantics
- packages/fuzz/corpus — relocated the true-positive fixture effect-needs-cleanup--assignment-form-loop-mismatch.tsx out of the confirmed-false-positive regressions/ directory into new true-positives/, and documented (README, smoke test, fuzz skill) that firing expectations live in the rule's unit suite, not the fuzz harness

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(changeset): document effect-needs-cleanup loop cleanup fix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 05:56:39 -05:00
Aiden Bai 5349cba199 fix(rule): ignore async effect callback chains (#1204)
* fix(rule): ignore async effect callback chains

* fix(rule): exclude async downstream chain links

* test(rule): make async downstream chain-link pins non-vacuous

- no-effect-chain.regressions.test.ts:379-407 — the four "async downstream
  chain link" variants used fetch, which main's external-sync suppression
  already silenced, so they passed against the pre-fix rule and pinned
  nothing; replaced fetch with an opaque loadTargetValue loader mirroring
  the corpus fixture, verified all four now fail against origin/main's
  rule and pass at head

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 05:55:27 -05:00
Aiden Bai 55dcb937fb fix(zod): recognize the official v4 export (#1201)
* chore: scaffold zod v4 subpath fix

* fix(zod): recognize the official v4 export

* test(zod): harden v4 subpath coverage
2026-07-13 05:55:12 -05:00
Aiden Bai 5699529155 fix(no-cascading-set-state): retire unsound redraw warning (#1198)
* fix(no-cascading-set-state): model React batch boundaries

* fix(no-cascading-set-state): retire unsound redraw warning

* test(no-cascading-set-state): update retirement coverage

* test(no-cascading-set-state): keep retired coverage coherent
2026-07-13 05:55:02 -05:00
Aiden Bai 1d7b6e2887 fix(rules): constrain min max sort advice (#1191)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
2026-07-13 03:47:31 -04:00
Aiden Bai d674163123 fix(rule): prove propTypes component ownership (#1195)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
2026-07-13 03:47:02 -04:00
Aiden Bai b36e439c26 fix(rule): preserve stateful RegExp loop semantics (MVP) (#1189)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
2026-07-13 03:46:47 -04:00
Aiden Bai 37c53d6ebf fix(rule): resolve forwardRef binding provenance (#1192)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
2026-07-13 03:21:17 -04:00
Aiden Bai 79105a3b97 fix(rule): resolve exact effect callback bindings (#1182)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
2026-07-13 03:20:45 -04:00
Aiden Bai 8ee2977e17 fix(rule): detect sealed server module state (#1180)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Rayhan Noufal Arayilakath <me@rayhanadev.com>
2026-07-13 03:20:26 -04:00
Aiden Bai 47beb255f2 fix(rule): ignore URL fragments in polyfill detection (#1194) 2026-07-13 03:20:11 -04:00
Aiden Bai 63fc41f4af feat(rules): detect prop callbacks during render (#1130)
* feat(rules): detect prop callbacks during render

* fix(rules): trace concise render callbacks

* fix(rules): preserve iterator callback results

* fix(rules): preserve render callback consumers
2026-07-11 06:09:12 -07:00
Aiden Bai 7bbb792e98 feat(rules): detect ref mutations during render (#1131)
* feat(rules): detect ref mutations during render

* fix(rules): narrow lazy ref guard typing

* fix(rules): trace nested lazy ref guards

* fix(rules): unwrap typed ref initializers

* fix(rules): unwrap ref mutation receivers
2026-07-11 06:00:48 -07:00
Aiden Bai 98005f2c3d feat(rules): detect impure state updaters (#1132) 2026-07-11 05:32:05 -07:00
Aiden Bai 6610ea9ea4 fix(rules): trace parent callbacks through refs (#1127) 2026-07-11 05:32:01 -07:00
Aiden Bai 6b70b3231c RB_792026: detect effect listener cleanup mismatches (#1110)
* feat(oxlint-plugin): detect ineffective listener cleanup

Catch effect cleanup that cannot detach its EventTarget listener because the callback identity or capture flag differs.

* fix(oxlint-plugin): preserve listener cleanup verdicts

Treat final cleanup return expressions like equivalent concise arrows so semantics-preserving rewrites retain diagnostics.

* fix(oxlint-plugin): harden listener cleanup precision

Cover valid abort, branch, alias, and EventTarget cleanup shapes found by adversarial fuzzing while preserving provable mismatch diagnostics.
2026-07-10 00:40:08 -07:00
Aiden Bai 2953b2592d feat(oxlint-plugin): no-stale-timer-ref — flag cleared timer refs left holding stale ids (#1107)
* feat(oxlint-plugin): no-stale-timer-ref — flag cleared timer refs left holding stale ids

clearTimeout(ref.current) without ref.current = null leaves the old id
truthy, so components that gate behavior on the ref as a "timer pending"
signal re-arm dismissed work or skip future scheduling. Skips the
clear-then-null and clear-then-re-arm (debounce) shapes, bare clear-guard
idioms, and effect-cleanup returns.

* fix(oxlint-plugin): no-stale-timer-ref — resolve the cleared ref via closest binding

A shadowing parameter or local re-declaration of the ref name was
misattributed to the outer useRef binding, flagging clears on non-ref
receivers. Resolve through findVariableInitializer (closest-scope, the
advanced-event-handler-refs pattern) instead of a bespoke scope walker,
consolidate the duplicated clear-call parsing, extract the getRangeStart
helper shared with effect-needs-cleanup, and drop the body casts in
favor of the isFunctionLike guard.

* fix(oxlint-plugin): no-stale-timer-ref — exempt component-level cleanups returned from an effect

Bugbot: a cleanup arrow declared in the component body and handed to
useEffect via `return stop` was never linked to the effect by the
nesting walk, so its clear was flagged despite being an effect-cleanup
return. Match the clearing function's binding name against every
effect's returned identifier in the owner scope.

* test(fuzz): timer-ref handler snippets + audit no-stale-timer-ref for verdict robustness

The generator had no useRef-held timer shape, so no-stale-timer-ref was
silent under fuzz (only its early bails were exercised). Two handler-pool
snippets (guarded schedule/cancel and debounce queue/flush) make it fire
12-23 programs per 500-iteration run, and the rule joins AUDITED_RULE_IDS
since its liveness fixture survives every must-preserve rewrite.
2026-07-09 05:49:02 -07:00
Aiden Bai 9b59d96f06 feat(fuzz): verdict-preserving mutation oracle + two new rules + detection robustness sweep
Fuzz: add the verdict-drop oracle — semantics-preserving source rewrites
(parenthesized/cast/non-null receivers, concise-arrow-to-block returns,
no-op prologues, optional-chain and computed-member spellings) applied to
firing programs; a rule that goes silent under one keys on incidental
token shape. Wired into fuzz-rule as an advisory finding kind, a strict
per-rule robustness suite over the audited liveness fixtures, a
registry-wide census script, and new regression-corpus entries.

Rules: add no-locale-format-in-render (locale/timezone-dependent
formatting during render in SSR-capable projects → hydration mismatch,
gated off client-only frameworks) and extend
prefer-use-sync-external-store to detect hand-rolled module-scope stores
(let + listener set + subscribe fn consumed via useState snapshot +
useEffect subscription).

Robustness sweep: shared is-no-op-statement / is-global-method-call /
executes-during-render utilities and cast-wrapper unwrapping across the
rule registry so detection survives the rewrites above; census is 0
drops across all fixture-covered rules.
2026-07-09 03:37:39 -07:00
devin-ai-integration[bot] 0748a4ba19 test: adversarial fuzzing harness for every rule (@react-doctor/fuzz) (#1022)
Co-authored-by: Aiden Bai <aiden.bai05@gmail.com>
2026-07-02 15:09:02 -07:00