瀏覽代碼

fix(eslint): Add no-empty-function rule

release-8443
hristoterezov 8 年之前
父節點
當前提交
fa971c81b5

+ 1
- 0
.eslintrc.js 查看文件

82
         'no-case-declarations': 2,
82
         'no-case-declarations': 2,
83
         'no-div-regex': 0,
83
         'no-div-regex': 0,
84
         'no-else-return': 2,
84
         'no-else-return': 2,
85
+        'no-empty-function': 2,
85
         'no-empty-pattern': 2,
86
         'no-empty-pattern': 2,
86
         'no-eval': 2,
87
         'no-eval': 2,
87
         'no-extend-native': 2,
88
         'no-extend-native': 2,

+ 9
- 2
JitsiConference.js 查看文件

1089
         }
1089
         }
1090
         try {
1090
         try {
1091
             this._addLocalStream(
1091
             this._addLocalStream(
1092
-                localTrack.getOriginalStream(), function() {}, function() {},
1093
-                ssrcInfo, true /* don't modify SSRCs */);
1092
+                localTrack.getOriginalStream(),
1093
+                () => {
1094
+                    // There is nothing to be done after the stream is added.
1095
+                },
1096
+                () => {
1097
+                    // TODO: Maybe report the error to the user?
1098
+                },
1099
+                ssrcInfo,
1100
+                true /* don't modify SSRCs */);
1094
         } catch(e) {
1101
         } catch(e) {
1095
             GlobalOnErrorHandler.callErrorHandler(e);
1102
             GlobalOnErrorHandler.callErrorHandler(e);
1096
             logger.error(e);
1103
             logger.error(e);

+ 0
- 55
JitsiParticipant.js 查看文件

192
         return this._isMediaTypeMuted(MediaType.VIDEO);
192
         return this._isMediaTypeMuted(MediaType.VIDEO);
193
     }
193
     }
194
 
194
 
195
-    /**
196
-     * @returns {???} The latest statistics reported by this participant (i.e.
197
-     * info used to populate the GSM bars)
198
-     * TODO: do we expose this or handle it internally?
199
-     */
200
-    getLatestStats() {
201
-    }
202
-
203
     /**
195
     /**
204
      * @returns {String} The role of this participant.
196
      * @returns {String} The role of this participant.
205
      */
197
      */
207
         return this._role;
199
         return this._role;
208
     }
200
     }
209
 
201
 
210
-    /**
211
-     * @returns {Boolean} Whether this participant is the conference focus (i.e.
212
-     * jicofo).
213
-     */
214
-    isFocus() {
215
-    }
216
-
217
-    /**
218
-     * @returns {Boolean} Whether this participant is a conference recorder
219
-     * (i.e. jirecon).
220
-     */
221
-    isRecorder() {
222
-    }
223
-
224
-    /**
225
-     * @returns {Boolean} Whether this participant is a SIP gateway (i.e.
226
-     * jigasi).
227
-     */
228
-    isSipGateway() {
229
-    }
230
-
231
-    /**
232
-     * @returns {Boolean} Whether this participant is currently sharing their
233
-     * screen.
234
-     */
235
-    isScreenSharing() {
236
-    }
237
-
238
-    /**
239
-     * @returns {String} The user agent of this participant (i.e. browser
240
-     * userAgent string).
241
-     */
242
-    getUserAgent() {
243
-    }
244
-
245
-    /**
246
-     * Kicks the participant from the conference (requires certain privileges).
247
-     */
248
-    kick() {
249
-    }
250
-
251
-    /**
252
-     * Asks this participant to mute themselves.
253
-     */
254
-    askToMute() {
255
-    }
256
-
257
     supportsDTMF() {
202
     supportsDTMF() {
258
         return this._supportsDTMF;
203
         return this._supportsDTMF;
259
     }
204
     }

+ 10
- 1
modules/RTC/JitsiRemoteTrack.js 查看文件

28
 function JitsiRemoteTrack(rtc, conference, ownerEndpointId, stream, track,
28
 function JitsiRemoteTrack(rtc, conference, ownerEndpointId, stream, track,
29
                           mediaType, videoType, ssrc, muted) {
29
                           mediaType, videoType, ssrc, muted) {
30
     JitsiTrack.call(
30
     JitsiTrack.call(
31
-        this, conference, stream, track, function() {}, mediaType, videoType, ssrc);
31
+        this,
32
+        conference,
33
+        stream,
34
+        track,
35
+        () => {
36
+            // Nothing to do if the track is inactive.
37
+        },
38
+        mediaType,
39
+        videoType,
40
+        ssrc);
32
     this.rtc = rtc;
41
     this.rtc = rtc;
33
     this.ownerEndpointId = ownerEndpointId;
42
     this.ownerEndpointId = ownerEndpointId;
34
     this.muted = muted;
43
     this.muted = muted;

+ 2
- 0
modules/RTC/JitsiTrack.js 查看文件

290
  */
290
  */
291
 // eslint-disable-next-line no-unused-vars
291
 // eslint-disable-next-line no-unused-vars
292
 JitsiTrack.prototype._attachTTFMTracker = function(container) {
292
 JitsiTrack.prototype._attachTTFMTracker = function(container) {
293
+    // Should be defined by the classes that are extending JitsiTrack
293
 };
294
 };
294
 
295
 
295
 /**
296
 /**
310
  * screen capture as opposed to a camera.
311
  * screen capture as opposed to a camera.
311
  */
312
  */
312
 JitsiTrack.prototype.isScreenSharing = function() {
313
 JitsiTrack.prototype.isScreenSharing = function() {
314
+    // FIXME: Should be fixed or removed.
313
 };
315
 };
314
 
316
 
315
 /**
317
 /**

+ 0
- 2
modules/RTC/RTC.js 查看文件

632
         }
632
         }
633
     }
633
     }
634
 
634
 
635
-    dispose() { }
636
-
637
     setAudioLevel(resource, audioLevel) {
635
     setAudioLevel(resource, audioLevel) {
638
         if(!resource) {
636
         if(!resource) {
639
             return;
637
             return;

+ 4
- 2
modules/RTC/TraceablePeerConnection.js 查看文件

912
     if (RTCBrowserType.isFirefox()
912
     if (RTCBrowserType.isFirefox()
913
             || RTCBrowserType.isTemasysPluginUsed()
913
             || RTCBrowserType.isTemasysPluginUsed()
914
             || RTCBrowserType.isReactNative()) {
914
             || RTCBrowserType.isReactNative()) {
915
-        // ignore for now...
916
         if(!errback) {
915
         if(!errback) {
917
-            errback = function() {};
916
+            errback = function() {
917
+                // Making sure that getStats won't fail if error callback is
918
+                // not passed.
919
+            };
918
         }
920
         }
919
         this.peerconnection.getStats(null, callback, errback);
921
         this.peerconnection.getStats(null, callback, errback);
920
     } else {
922
     } else {

+ 1
- 1
modules/statistics/AnalyticsAdapter.js 查看文件

2
  * Interface for analytics handlers.
2
  * Interface for analytics handlers.
3
  */
3
  */
4
 class AnalyticsAbstract {
4
 class AnalyticsAbstract {
5
-    sendEvent() {}
5
+    sendEvent() {} // eslint-disable-line no-empty-function
6
 }
6
 }
7
 
7
 
8
 /**
8
 /**

+ 11
- 23
modules/xmpp/JingleSession.js 查看文件

89
      * {@link initialize}.
89
      * {@link initialize}.
90
      * @protected
90
      * @protected
91
      */
91
      */
92
-    doInitialize() {
93
-
94
-    }
92
+    doInitialize() { } // eslint-disable-line no-empty-function
95
 
93
 
96
     /**
94
     /**
97
      * Adds the ICE candidates found in the 'contents' array as remote
95
      * Adds the ICE candidates found in the 'contents' array as remote
98
      * candidates?
96
      * candidates?
99
      * Note: currently only used on transport-info
97
      * Note: currently only used on transport-info
100
      */
98
      */
101
-    // eslint-disable-next-line no-unused-vars
102
-    addIceCandidates(contents) {
103
-
104
-    }
99
+    // eslint-disable-next-line no-unused-vars, no-empty-function
100
+    addIceCandidates(contents) { }
105
 
101
 
106
     /**
102
     /**
107
      * Returns current state of this <tt>JingleSession</tt> instance.
103
      * Returns current state of this <tt>JingleSession</tt> instance.
116
      *
112
      *
117
      * @param contents an array of Jingle 'content' elements.
113
      * @param contents an array of Jingle 'content' elements.
118
      */
114
      */
119
-    // eslint-disable-next-line no-unused-vars
120
-    addSources(contents) {
121
-
122
-    }
115
+    // eslint-disable-next-line no-unused-vars, no-empty-function
116
+    addSources(contents) { }
123
 
117
 
124
     /**
118
     /**
125
      * Handles a 'remove-source' event.
119
      * Handles a 'remove-source' event.
126
      *
120
      *
127
      * @param contents an array of Jingle 'content' elements.
121
      * @param contents an array of Jingle 'content' elements.
128
      */
122
      */
129
-    // eslint-disable-next-line no-unused-vars
130
-    removeSources(contents) {
131
-
132
-    }
123
+    // eslint-disable-next-line no-unused-vars, no-empty-function
124
+    removeSources(contents) { }
133
 
125
 
134
     /**
126
     /**
135
      * Terminates this Jingle session by sending session-terminate
127
      * Terminates this Jingle session by sending session-terminate
140
      * @param failure a callback called when either timeout occurs or ERROR
132
      * @param failure a callback called when either timeout occurs or ERROR
141
      * response is received.
133
      * response is received.
142
      */
134
      */
143
-    // eslint-disable-next-line no-unused-vars
144
-    terminate(reason, text, success, failure) {
145
-
146
-    }
135
+    // eslint-disable-next-line no-unused-vars, no-empty-function
136
+    terminate(reason, text, success, failure) { }
147
 
137
 
148
     /**
138
     /**
149
      * Handles an offer from the remote peer (prepares to accept a session).
139
      * Handles an offer from the remote peer (prepares to accept a session).
154
      * error object with details(which is meant more to be printed to the logger
144
      * error object with details(which is meant more to be printed to the logger
155
      * than analysed in the code, as the error is unrecoverable anyway)
145
      * than analysed in the code, as the error is unrecoverable anyway)
156
      */
146
      */
157
-    // eslint-disable-next-line no-unused-vars
158
-    acceptOffer(jingle, success, failure) {
159
-
160
-    }
147
+    // eslint-disable-next-line no-unused-vars, no-empty-function
148
+    acceptOffer(jingle, success, failure) { }
161
 }
149
 }

+ 1
- 2
modules/xmpp/RtxModifier.spec.js 查看文件

289
     });
289
     });
290
 
290
 
291
     describe('stripRtx', function() {
291
     describe('stripRtx', function() {
292
-        beforeEach(function() {
293
-        });
292
+        beforeEach(function() { }); // eslint-disable-line no-empty-function
294
         it('should strip all rtx streams from an sdp with rtx', function() {
293
         it('should strip all rtx streams from an sdp with rtx', function() {
295
             const sdpStr = transform.write(SampleSdpStrings.rtxVideoSdp);
294
             const sdpStr = transform.write(SampleSdpStrings.rtxVideoSdp);
296
             const newSdpStr = this.rtxModifier.stripRtx(sdpStr);
295
             const newSdpStr = this.rtxModifier.stripRtx(sdpStr);

Loading…
取消
儲存