Repository navigation
fix: no-destructure and import autofixes that broke code (fixes #261) - #263
Merged
Merged
Conversation
no-destructure now reports without an autofix when the fix can't be
faithful:
- a nested pattern (`{ user: { name } }`) or non-identifier rest, which
has no `props.x` rewrite and used to leave the inner bindings undefined;
- a default that reads another destructured prop (`{ a, b = a }`), which
used to crash ESLint with overlapping fixes;
- `props` or `_props` already declared in the function (or a nested
scope) or read from an enclosing scope, which the new parameter would
redeclare or shadow.
appendImports (jsx-no-undef, imports) no longer merges named specifiers
into a namespace import (`import * as Solid, { For }` is a syntax error);
it adds a separate import declaration instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWPBR5hjwWf2VYS9c3p
Merged
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.
Requested by Ryan · project thread
Fixes #261 (all five cases from the report).
solid/no-destructurenow reports without an autofix when the fix can't be faithful:A nested pattern (
({ user: { name } }),({ items: [first] })) or a non-identifier rest. The fix used to replace the parameter and leavenameundefined.and 3.
propsor_propsalready declared in the function or a nested scope, or read from an enclosing scope (an outer component'sprops). The new parameter used to shadow it or cause a duplicate declaration.A default that reads another destructured prop (
({ a, b = a })). This used to crash ESLint with "Fix objects must not be overlapped", and movingainto themerge(...)call would leave it unbound anyway.appendImports(used byjsx-no-undefandimports) no longer writesimport * as Solid, { For } from "solid-js", which is a syntax error. With a namespace import it adds a separateimport { For } from "solid-js";after it.A destructured prop that is itself named
props(({ props })) still autofixes, since that binding goes away.Tests
New invalid cases (no output) for each skipped fix, plus a
jsx-no-undefnamespace case; 8 of them fail without the change. FullPARSER=allsuite passes (3,134 tests).🤖 Generated with Claude Code
https://claude.ai/code/session_0117BoWPBR5hjwWf2VYS9c3p