Skip to content

Commit

Permalink
style: Re-enable the prefer-spread eslint rule
Browse files Browse the repository at this point in the history
The prefer-spread rule to prevent use of apply() was disabled, but we
had another custom rule that also prevented the use of apply().  This
re-enables the standard rule.

Issue shaka-project#2639

Change-Id: Ic3778d7267deb6cd5ed49282ea43bb84ad076060
  • Loading branch information
joeyparrish committed Jun 15, 2020
1 parent 486123c commit f86e720
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ const commonNoRestrictedSyntax = [
'message': 'Use for-of instead of forEach',
},
{
'selector': 'CallExpression[callee.property.name=/^(bind|call|apply)$/]',
'message': 'Don\'t use Function bind/call/apply.',
// NOTE: prefer-spread rule covers .apply() already.
'selector': 'CallExpression[callee.property.name=/^(bind|call)$/]',
'message': 'Don\'t use Function bind/call.',
},
{
'selector': 'MemberExpression[property.name="prototype"]',
Expand Down Expand Up @@ -79,7 +80,6 @@ module.exports = {

// Temporary Google style overrides while we get in compliance with the
// latest style guide {{{
'prefer-spread': 'off',
'require-jsdoc': 'off',
// }}}

Expand Down
4 changes: 2 additions & 2 deletions lib/cast/cast_receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ shaka.cast.CastReceiver = class extends shaka.util.FakeEventTarget {
const methodName = message['methodName'];
const args = message['args'];
const target = this.targets_[targetName];
// eslint-disable-next-line no-restricted-syntax
// eslint-disable-next-line prefer-spread
target[methodName].apply(target, args);
break;
}
Expand All @@ -672,7 +672,7 @@ shaka.cast.CastReceiver = class extends shaka.util.FakeEventTarget {
const id = message['id'];
const senderId = event.senderId;
const target = this.targets_[targetName];
// eslint-disable-next-line no-restricted-syntax
// eslint-disable-next-line prefer-spread
let p = target[methodName].apply(target, args);
if (targetName == 'player' && methodName == 'load') {
// Wait until the manifest has actually loaded to send another media
Expand Down
2 changes: 1 addition & 1 deletion test/player_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ describe('Player', () => {
if (arguments.length > 2000) {
throw new RangeError('Synthetic Range Error');
}
// eslint-disable-next-line no-restricted-syntax
// eslint-disable-next-line prefer-spread
return oldFromCharCode.apply(null, arguments);
};
await player.load('/base/test/test/assets/large_file.mpd');
Expand Down

0 comments on commit f86e720

Please sign in to comment.