Skip to content

fix(var): fix logic bugs and add unit tests for @eslint-react/var#1672

Merged
Rel1cx merged 1 commit intomainfrom
fix/var-module-bugs-and-tests
Mar 31, 2026
Merged

fix(var): fix logic bugs and add unit tests for @eslint-react/var#1672
Rel1cx merged 1 commit intomainfrom
fix/var-module-bugs-and-tests

Conversation

@Rel1cx
Copy link
Copy Markdown
Owner

@Rel1cx Rel1cx commented Mar 31, 2026

  • compute-object-type: check left side first in LogicalExpression
  • compute-object-type: recognize Array.from/of, Object.create/assign/fromEntries
  • compute-object-type: remove dead code guards on MemberExpression and AssignmentExpression
  • is-value-equal: use value equality for computed MemberExpression properties
  • is-value-equal: distinguish same vs different ForOfStatement for destructuring
  • find-enclosing-assignment-target: add ExportDefaultDeclaration case
  • find-enclosing-assignment-target: replace unreachable node.parent === node with node.parent == null
  • find-enclosing-assignment-target: remove unresolved @todo

Add 48 unit tests across 5 new test files:

  • resolve.test.ts (8 tests)
  • compute-object-type.test.ts (18 tests)
  • find-enclosing-assignment-target.test.ts (9 tests)
  • is-value-equal.test.ts (10 tests)
  • is-assignment-target-equal.test.ts (3 tests)

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Perf
  • Docs
  • Test
  • Chore
  • Enhancement
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • I have added a convincing reason for adding this feature, if necessary

Other information

- compute-object-type: check left side first in LogicalExpression
- compute-object-type: recognize Array.from/of, Object.create/assign/fromEntries
- compute-object-type: remove dead code guards on MemberExpression and AssignmentExpression
- is-value-equal: use value equality for computed MemberExpression properties
- is-value-equal: distinguish same vs different ForOfStatement for destructuring
- find-enclosing-assignment-target: add ExportDefaultDeclaration case
- find-enclosing-assignment-target: replace unreachable `node.parent === node` with `node.parent == null`
- find-enclosing-assignment-target: remove unresolved @todo

Add 48 unit tests across 5 new test files:
- resolve.test.ts (8 tests)
- compute-object-type.test.ts (18 tests)
- find-enclosing-assignment-target.test.ts (9 tests)
- is-value-equal.test.ts (10 tests)
- is-assignment-target-equal.test.ts (3 tests)
@Rel1cx Rel1cx marked this pull request as ready for review March 31, 2026 15:04
@Rel1cx Rel1cx merged commit 1ca8c54 into main Mar 31, 2026
9 checks passed
@Rel1cx Rel1cx deleted the fix/var-module-bugs-and-tests branch March 31, 2026 15:05
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eslint-react Ready Ready Preview, Comment Mar 31, 2026 3:05pm

Request Review

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