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

golopot
Copy link
Contributor

@golopot golopot 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);
Copy link
Member

Choose a reason for hiding this comment

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

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);
Copy link
Member

Choose a reason for hiding this comment

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

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.

lib/util/Components.js Outdated Show resolved Hide resolved
@golopot
Copy link
Contributor Author

golopot commented May 10, 2019

Thanks.

@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 jsx-eslint:master May 10, 2019
@golopot golopot deleted the remove-util-extends branch May 10, 2019 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants