Selaa lähdekoodia

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

dev1
hristoterezov 8 vuotta sitten
vanhempi
commit
fa971c81b5

+ 1
- 0
.eslintrc.js Näytä tiedosto

@@ -82,6 +82,7 @@ module.exports = {
82 82
         'no-case-declarations': 2,
83 83
         'no-div-regex': 0,
84 84
         'no-else-return': 2,
85
+        'no-empty-function': 2,
85 86
         'no-empty-pattern': 2,
86 87
         'no-eval': 2,
87 88
         'no-extend-native': 2,

+ 9
- 2
JitsiConference.js Näytä tiedosto

@@ -1089,8 +1089,15 @@ JitsiConference.prototype.onIncomingCall
1089 1089
         }
1090 1090
         try {
1091 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 1101
         } catch(e) {
1095 1102
             GlobalOnErrorHandler.callErrorHandler(e);
1096 1103
             logger.error(e);

+ 0
- 55
JitsiParticipant.js Näytä tiedosto

@@ -192,14 +192,6 @@ export default class JitsiParticipant {
192 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 196
      * @returns {String} The role of this participant.
205 197
      */
@@ -207,53 +199,6 @@ export default class JitsiParticipant {
207 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 202
     supportsDTMF() {
258 203
         return this._supportsDTMF;
259 204
     }

+ 10
- 1
modules/RTC/JitsiRemoteTrack.js Näytä tiedosto

@@ -28,7 +28,16 @@ let ttfmTrackerVideoAttached = false;
28 28
 function JitsiRemoteTrack(rtc, conference, ownerEndpointId, stream, track,
29 29
                           mediaType, videoType, ssrc, muted) {
30 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 41
     this.rtc = rtc;
33 42
     this.ownerEndpointId = ownerEndpointId;
34 43
     this.muted = muted;

+ 2
- 0
modules/RTC/JitsiTrack.js Näytä tiedosto

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

+ 0
- 2
modules/RTC/RTC.js Näytä tiedosto

@@ -632,8 +632,6 @@ export default class RTC extends Listenable {
632 632
         }
633 633
     }
634 634
 
635
-    dispose() { }
636
-
637 635
     setAudioLevel(resource, audioLevel) {
638 636
         if(!resource) {
639 637
             return;

+ 4
- 2
modules/RTC/TraceablePeerConnection.js Näytä tiedosto

@@ -912,9 +912,11 @@ TraceablePeerConnection.prototype.getStats = function(callback, errback) {
912 912
     if (RTCBrowserType.isFirefox()
913 913
             || RTCBrowserType.isTemasysPluginUsed()
914 914
             || RTCBrowserType.isReactNative()) {
915
-        // ignore for now...
916 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 921
         this.peerconnection.getStats(null, callback, errback);
920 922
     } else {

+ 1
- 1
modules/statistics/AnalyticsAdapter.js Näytä tiedosto

@@ -2,7 +2,7 @@
2 2
  * Interface for analytics handlers.
3 3
  */
4 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 Näytä tiedosto

@@ -89,19 +89,15 @@ export default class JingleSession {
89 89
      * {@link initialize}.
90 90
      * @protected
91 91
      */
92
-    doInitialize() {
93
-
94
-    }
92
+    doInitialize() { } // eslint-disable-line no-empty-function
95 93
 
96 94
     /**
97 95
      * Adds the ICE candidates found in the 'contents' array as remote
98 96
      * candidates?
99 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 103
      * Returns current state of this <tt>JingleSession</tt> instance.
@@ -116,20 +112,16 @@ export default class JingleSession {
116 112
      *
117 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 119
      * Handles a 'remove-source' event.
126 120
      *
127 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 127
      * Terminates this Jingle session by sending session-terminate
@@ -140,10 +132,8 @@ export default class JingleSession {
140 132
      * @param failure a callback called when either timeout occurs or ERROR
141 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 139
      * Handles an offer from the remote peer (prepares to accept a session).
@@ -154,8 +144,6 @@ export default class JingleSession {
154 144
      * error object with details(which is meant more to be printed to the logger
155 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 Näytä tiedosto

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

Loading…
Peruuta
Tallenna