-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Conversation
lib/rules/sort-comp.js
Outdated
@@ -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); |
There was a problem hiding this comment.
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.
const groups = Object.assign(defaultConfig.groups, userConfig.groups); | |
const groups = Object.assign({}, defaultConfig.groups, userConfig.groups); |
lib/util/Components.js
Outdated
@@ -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); |
There was a problem hiding this comment.
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.
Thanks. |
abfe7a2
to
fce69eb
Compare
No description provided.