Skip to content

fix: don't report ref targets as unassigned - #232

Open
dex157 wants to merge 1 commit into
solidjs-community:mainfrom
dex157:fix/no-unassigned-vars-refs
Open

dex157 wants to merge 1 commit into
solidjs-community:mainfrom
dex157:fix/no-unassigned-vars-refs

Conversation

@dex157

@dex157 dex157 commented Sep 27, 2026

Copy link
Copy Markdown

Fixes #231.

ESLint 10's recommended no-unassigned-vars reports let el; <div ref={el} />. The compiler assigns el, but scope analysis only sees a read.

This adds solid/no-unassigned-vars. It uses the core rule's logic but counts a ref={el} or ref={el!} value as an assignment. recommended, and the configs that extend it, switch the core rule off in its favour.

Tested: the new rule's tests pass on all parsers, and pnpm ci passes. The repro from #231 now lints clean, while a genuinely unassigned let is still reported.

Add solid/no-unassigned-vars: ESLint's no-unassigned-vars, but a `ref={el}`
value counts as an assignment. The configs use it in place of the core rule,
which ESLint 10 enables in its recommended set.
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.

no-unassigned-vars (ESLint 10 recommended) flags variables used as ref={el}

1 participant