瀏覽代碼

[eslint] no-continue

tags/v0.0.2
Lyubo Marinov 8 年之前
父節點
當前提交
110fe997b6

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

150
         'new-cap': 2,
150
         'new-cap': 2,
151
         'new-parens': 2,
151
         'new-parens': 2,
152
         'no-array-constructor': 2,
152
         'no-array-constructor': 2,
153
+        'no-continue': 2,
153
         'no-inline-comments': 0,
154
         'no-inline-comments': 0,
154
         'no-lonely-if': 2,
155
         'no-lonely-if': 2,
155
         'no-mixed-operators': 2,
156
         'no-mixed-operators': 2,

+ 6
- 7
modules/RTC/RTC.js 查看文件

311
 
311
 
312
             for (const trackMediaType of endpointMediaTypes) {
312
             for (const trackMediaType of endpointMediaTypes) {
313
                 // per media type filtering
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 查看文件

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

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

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

+ 9
- 10
modules/xmpp/ChatRoom.js 查看文件

33
     json2packet(nodes, packet) {
33
     json2packet(nodes, packet) {
34
         for(let i = 0; i < nodes.length; i++) {
34
         for(let i = 0; i < nodes.length; i++) {
35
             const node = nodes[i];
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
         // packet.up();
47
         // packet.up();
49
     }
48
     }

+ 3
- 3
modules/xmpp/SDP.js 查看文件

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

Loading…
取消
儲存