Просмотр исходного кода

[eslint] prefer-rest-params

dev1
Lyubo Marinov 8 лет назад
Родитель
Сommit
1068233eac

+ 1
- 0
.eslintrc.js Просмотреть файл

@@ -211,6 +211,7 @@ module.exports = {
211 211
         ],
212 212
         'prefer-const': 2,
213 213
         'prefer-reflect': 0,
214
+        'prefer-rest-params': 2,
214 215
         'prefer-spread': 2,
215 216
         'prefer-template': 2,
216 217
         'require-yield': 2,

+ 2
- 4
JitsiConnection.js Просмотреть файл

@@ -65,14 +65,12 @@ JitsiConnection.prototype.attach = function(options) {
65 65
 /**
66 66
  * Disconnect the client from the server.
67 67
  */
68
-JitsiConnection.prototype.disconnect = function() {
68
+JitsiConnection.prototype.disconnect = function(...args) {
69 69
     // XXX Forward any arguments passed to JitsiConnection.disconnect to
70 70
     // XMPP.disconnect. For example, the caller of JitsiConnection.disconnect
71 71
     // may optionally pass the event which triggered the disconnect in order to
72 72
     // provide the implementation with finer-grained context.
73
-    const x = this.xmpp;
74
-
75
-    x.disconnect(...arguments);
73
+    this.xmpp.disconnect(...args);
76 74
 };
77 75
 
78 76
 /**

+ 2
- 2
JitsiMediaDevices.js Просмотреть файл

@@ -129,8 +129,8 @@ const JitsiMediaDevices = {
129 129
      * Emits an event.
130 130
      * @param {string} event - event name
131 131
      */
132
-    emitEvent(event) { // eslint-disable-line no-unused-vars
133
-        eventEmitter.emit(...arguments);
132
+    emitEvent(event, ...args) {
133
+        eventEmitter.emit(event, ...args);
134 134
     }
135 135
 };
136 136
 

+ 1
- 0
modules/RTC/RTCUtils.js Просмотреть файл

@@ -650,6 +650,7 @@ function handleLocalStream(streams, resolution) {
650 650
  */
651 651
 function wrapAttachMediaStream(origAttachMediaStream) {
652 652
     return function(element, stream) {
653
+        // eslint-disable-next-line prefer-rest-params
653 654
         const res = origAttachMediaStream.apply(rtcUtils, arguments);
654 655
 
655 656
         if (stream

+ 1
- 1
modules/statistics/CallStats.js Просмотреть файл

@@ -127,7 +127,7 @@ function initCallback(err, msg) {
127 127
 function _try_catch(f) {
128 128
     return function() {
129 129
         try {
130
-            f.apply(this, arguments);
130
+            f.apply(this, arguments); // eslint-disable-line prefer-rest-params
131 131
         } catch (e) {
132 132
             GlobalOnErrorHandler.callErrorHandler(e);
133 133
             logger.error(e);

+ 3
- 4
modules/util/EventEmitterForwarder.js Просмотреть файл

@@ -22,14 +22,13 @@ function EventEmitterForwarder(src, dest) {
22 22
  * @param arguments all other passed arguments are going to be fired with
23 23
  * dstEvent.
24 24
  */
25
-EventEmitterForwarder.prototype.forward = function() {
26
-    // This line is only for fixing jshint errors.
27
-    const args = arguments;
25
+EventEmitterForwarder.prototype.forward = function(...args) {
28 26
     const srcEvent = args[0];
29 27
     // This will be the "this" value for emit function.
30 28
     args[0] = this.dest;
31 29
     // Using bind.apply to pass the arguments as Array-like object ("arguments")
32
-    this.src.addListener(srcEvent,
30
+    this.src.addListener(
31
+        srcEvent,
33 32
         Function.prototype.bind.apply(this.dest.emit, args));
34 33
 };
35 34
 

Загрузка…
Отмена
Сохранить