Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor]: replace util._extend with Object.assign #2265

Merged
merged 1 commit into from May 10, 2019

Conversation

Projects
None yet
2 participants
@golopot
Copy link
Contributor

commented May 8, 2019

No description provided.

@@ -58,7 +57,7 @@ const defaultConfig = {
function getMethodsOrder(userConfig) {
userConfig = userConfig || {};

const groups = util._extend(defaultConfig.groups, userConfig.groups);
const groups = Object.assign(defaultConfig.groups, userConfig.groups);

This comment has been minimized.

Copy link
@ljharb

ljharb May 8, 2019

Collaborator

this should probably not mutate the default groups - this might be a bug in the rule itself.

Suggested change
const groups = Object.assign(defaultConfig.groups, userConfig.groups);
const groups = Object.assign({}, defaultConfig.groups, userConfig.groups);
@@ -110,7 +109,7 @@ class Components {
// preserving original array so it can be merged later on.
copyUsedPropTypes = this._list[id].usedPropTypes && this._list[id].usedPropTypes.slice();
}
this._list[id] = util._extend(this._list[id], props);
this._list[id] = Object.assign(this._list[id], props);

This comment has been minimized.

Copy link
@ljharb

ljharb May 8, 2019

Collaborator

this should either be Object.assign(this._list[id], props); or this._list[id] = Object.assign({}, this._list[id], props); - iow, if it's mutating, it shouldn't reassign.

Show resolved Hide resolved lib/util/Components.js Outdated
@ljharb

ljharb approved these changes May 10, 2019

@golopot

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2019

Thanks.

@ljharb ljharb force-pushed the golopot:remove-util-extends branch from abfe7a2 to fce69eb May 10, 2019

@ljharb ljharb changed the title [Chore]: replace util._extend with Object.assign [Refactor]: replace util._extend with Object.assign May 10, 2019

@ljharb ljharb merged commit fce69eb into yannickcr:master May 10, 2019

2 of 5 checks passed

continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.003%) to 97.451%
Details

@golopot golopot deleted the golopot:remove-util-extends branch May 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.