In T377777 we upgraded eslint-config-wikimedia in Wikibase to 0.28.2. This version would normally have included the no-jquery/no-extend rule that replaces usages of $.extend with Object.assign. Unfortunately, Object.assign is not a drop-in replacement for $.extend. To allow the upgrade to go through, the rule has been disabled in Wikibase, but we want to enable the rule again.
Object.assign differs in semantics from a shallow (default) $.extend in that:
- Object.assign does not copy undefined values from the source to the target object
- Object.assign only acts on own properties - it does not copy properties inherited from the object prototype.
Audit the 73 uses of $.extend in the Wikibase repository and replace them with appropriate uses of Object.assign (plus Object.create for the case of copying inherited properties). Re-enable the disabled linting rule no-jquery/no-extend.
Acceptance Criteria
- Depending on the result of an initial spike, either this ticket is broken down or it the following acceptance criteria are fulfilled
- All uses of $.extend have been removed from the Wikibase codebase
- All tests pass and Wikibase continues to work as before
- The no-jquery/no-extend rule is enabled again for the codebase
TIMEBOX: 8 hrs