Selaa lähdekoodia

[eslint] no-continue

master
Lyubo Marinov 8 vuotta sitten
vanhempi
commit
110fe997b6

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

@@ -150,6 +150,7 @@ module.exports = {
150 150
         'new-cap': 2,
151 151
         'new-parens': 2,
152 152
         'no-array-constructor': 2,
153
+        'no-continue': 2,
153 154
         'no-inline-comments': 0,
154 155
         'no-lonely-if': 2,
155 156
         'no-mixed-operators': 2,

+ 6
- 7
modules/RTC/RTC.js Näytä tiedosto

@@ -311,14 +311,13 @@ export default class RTC extends Listenable {
311 311
 
312 312
             for (const trackMediaType of endpointMediaTypes) {
313 313
                 // per media type filtering
314
-                if (mediaType && mediaType !== trackMediaType) {
315
-                    continue;
316
-                }
317
-
318
-                const mediaTrack = this.remoteTracks[endpoint][trackMediaType];
314
+                if (!mediaType || mediaType === trackMediaType) {
315
+                    const mediaTrack
316
+                        = this.remoteTracks[endpoint][trackMediaType];
319 317
 
320
-                if (mediaTrack) {
321
-                    remoteTracks.push(mediaTrack);
318
+                    if (mediaTrack) {
319
+                        remoteTracks.push(mediaTrack);
320
+                    }
322 321
                 }
323 322
             }
324 323
         }

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

@@ -438,7 +438,7 @@ function extractSSRCMap(desc) {
438 438
 
439 439
     for (const mLine of session.media) {
440 440
         if (!Array.isArray(mLine.ssrcs)) {
441
-            continue;
441
+            continue; // eslint-disable-line no-continue
442 442
         }
443 443
 
444 444
         if (Array.isArray(mLine.ssrcGroups)) {
@@ -461,7 +461,7 @@ function extractSSRCMap(desc) {
461 461
         }
462 462
         for (const ssrc of mLine.ssrcs) {
463 463
             if (ssrc.attribute !== 'msid') {
464
-                continue;
464
+                continue; // eslint-disable-line no-continue
465 465
             }
466 466
 
467 467
             const msid = ssrc.value;

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

@@ -368,6 +368,8 @@ StatsCollector.prototype._defineGetStatValueMethod = function(keys) {
368 368
     };
369 369
 };
370 370
 
371
+/* eslint-disable no-continue */
372
+
371 373
 /**
372 374
  * Stats processing logic.
373 375
  */
@@ -612,8 +614,8 @@ StatsCollector.prototype.processAudioLevelReport = function() {
612 614
         if(!this.currentAudioLevelsReport.hasOwnProperty(idx)) {
613 615
             continue;
614 616
         }
615
-        const now = this.currentAudioLevelsReport[idx];
616 617
 
618
+        const now = this.currentAudioLevelsReport[idx];
617 619
         if (now.type != 'ssrc') {
618 620
             continue;
619 621
         }
@@ -656,3 +658,5 @@ StatsCollector.prototype.processAudioLevelReport = function() {
656 658
         }
657 659
     }
658 660
 };
661
+
662
+/* eslint-enable no-continue */

+ 9
- 10
modules/xmpp/ChatRoom.js Näytä tiedosto

@@ -33,17 +33,16 @@ const parser = {
33 33
     json2packet(nodes, packet) {
34 34
         for(let i = 0; i < nodes.length; i++) {
35 35
             const node = nodes[i];
36
-            if(!node || node === null) {
37
-                continue;
38
-            }
39
-            packet.c(node.tagName, node.attributes);
40
-            if(node.value) {
41
-                packet.t(node.value);
42
-            }
43
-            if(node.children) {
44
-                this.json2packet(node.children, packet);
36
+            if(node) {
37
+                packet.c(node.tagName, node.attributes);
38
+                if(node.value) {
39
+                    packet.t(node.value);
40
+                }
41
+                if(node.children) {
42
+                    this.json2packet(node.children, packet);
43
+                }
44
+                packet.up();
45 45
             }
46
-            packet.up();
47 46
         }
48 47
         // packet.up();
49 48
     }

+ 3
- 3
modules/xmpp/SDP.js Näytä tiedosto

@@ -110,7 +110,7 @@ SDP.prototype.mangle = function() {
110 110
         lines.pop(); // remove empty last element
111 111
         mline = SDPUtil.parse_mline(lines.shift());
112 112
         if (mline.media != 'audio') {
113
-            continue;
113
+            continue; // eslint-disable-line no-continue
114 114
         }
115 115
         newdesc = '';
116 116
         mline.fmt.length = 0;
@@ -118,7 +118,7 @@ SDP.prototype.mangle = function() {
118 118
             if (lines[j].substr(0, 9) == 'a=rtpmap:') {
119 119
                 rtpmap = SDPUtil.parse_rtpmap(lines[j]);
120 120
                 if (rtpmap.name == 'CN' || rtpmap.name == 'ISAC') {
121
-                    continue;
121
+                    continue; // eslint-disable-line no-continue
122 122
                 }
123 123
                 mline.fmt.push(rtpmap.id);
124 124
             }
@@ -173,7 +173,7 @@ SDP.prototype.toJingle = function(elem, thecreator) {
173 173
         if (!(mline.media === 'audio'
174 174
               || mline.media === 'video'
175 175
               || mline.media === 'application')) {
176
-            continue;
176
+            continue; // eslint-disable-line no-continue
177 177
         }
178 178
         const assrcline = SDPUtil.find_line(this.media[i], 'a=ssrc:');
179 179
         if (assrcline) {

Loading…
Peruuta
Tallenna