Skip to content

feat: Object.assign detection to mutation rules - #2929

Merged
ota-meshi merged 3 commits into
masterfrom
detect-object-assign
Sep 22, 2025
Merged

ota-meshi merged 3 commits into
masterfrom
detect-object-assign

Conversation

@waynzh

@waynzh waynzh commented Sep 5, 2025

Copy link
Copy Markdown
Member

resolve #2823

@changeset-bot

changeset-bot Bot commented Sep 5, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c943abf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-vue Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@FloEdelmann FloEdelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks!

@FloEdelmann
FloEdelmann requested a review from Copilot September 5, 2025 13:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the vue/no-mutating-props and vue/no-side-effects-in-computed-properties rules to detect mutations caused by Object.assign() when the target object (first argument) is a prop or reactive data.

Key changes:

  • Added utility function to detect Object.assign calls with specific target nodes
  • Enhanced mutation detection logic to identify Object.assign as a mutation operation
  • Added comprehensive test coverage for both valid and invalid Object.assign usage patterns

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lib/utils/index.js Added isObjectAssignCall utility function and integrated Object.assign detection into mutation analysis
tests/lib/rules/no-mutating-props.js Added test cases for Object.assign prop mutation detection
tests/lib/rules/no-side-effects-in-computed-properties.js Added test cases for Object.assign side effect detection in computed properties
.changeset/hot-beers-help.md Added changelog entry documenting the enhancement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread lib/utils/index.js Resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@ota-meshi ota-meshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@ota-meshi
ota-meshi merged commit 7aaba4d into master Sep 22, 2025
20 of 22 checks passed
@ota-meshi
ota-meshi deleted the detect-object-assign branch September 22, 2025 01:27
@github-actions github-actions Bot mentioned this pull request Sep 22, 2025
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.

vue/no-mutating-props should warn on Object.assign with prop as first argument

4 participants