Skip to content

fix(rule): catch unsafe boolean guards - #81

Merged
GSTJ merged 1 commit into
mainfrom
fix/boolean-evidence-writes
Aug 31, 2026
Merged

fix(rule): catch unsafe boolean guards#81
GSTJ merged 1 commit into
mainfrom
fix/boolean-evidence-writes

Conversation

@GSTJ

@GSTJ GSTJ commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

The rule now catches JSX guards that rely on a redeclared variable, the wrong initializer scope, or a replaced Boolean.

Details

  • Resolves each initializer from the lexical scope where the declaration appears.
  • Rejects ambiguous var redeclarations and every write after the trusted initializer.
  • Treats a shadowed or reassigned Boolean as unsafe, with !! as the autofix fallback.

Testing steps

  1. From the repository root, run:
pnpm install --frozen-lockfile
pnpm run test --runInBand
  1. Confirm the command reports that all tests passed.

Resolve initializer evidence from its lexical scope and reject ambiguous var redeclarations. Treat direct Boolean writes as unsafe and use a mutation-proof fallback fix.
@github-actions

Copy link
Copy Markdown

馃帀 Congratulations on making your first pull request in '@gstj/safe-jsx'! We appreciate your contribution and will review it as soon as possible. Thank you for helping us make this project better.

@GSTJ

GSTJ commented Aug 31, 2026

Copy link
Copy Markdown
Owner Author

Proof from 3e86d35: published 1.3.8 returns zero diagnostics for all three cases. The packed branch fixes them on ESLint 3 with Node 14 and ESLint 10 with Node 24.

Packed runtime behavior

The frozen install, audit, lint, format, typecheck, tests, build, changelog checks, release controls, and tarball pack all pass.

Full local suite

@GSTJ
GSTJ merged commit 481ccdc into main Aug 31, 2026
5 checks passed
@GSTJ
GSTJ deleted the fix/boolean-evidence-writes branch August 31, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant