浏览代码

fix(eslint): Add max-depth rule

dev1
hristoterezov 8 年前
父节点
当前提交
f647f03e5d
共有 4 个文件被更改,包括 13 次插入0 次删除
  1. 1
    0
      .eslintrc.js
  2. 2
    0
      modules/RTC/TraceablePeerConnection.js
  3. 9
    0
      modules/xmpp/SDP.js
  4. 1
    0
      modules/xmpp/SdpConsistency.js

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

@@ -186,6 +186,7 @@ module.exports = {
186 186
                 'beforeLineComment': true
187 187
             }
188 188
         ],
189
+        'max-depth': 2,
189 190
         'max-len': [ 'error', 80 ],
190 191
         'max-lines': 0,
191 192
         'max-nested-callbacks': 2,

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

@@ -491,6 +491,8 @@ function extractSSRCMap(desc) {
491 491
                     // Note that group.semantics is already present
492 492
 
493 493
                     group.ssrcs = groupSSRCs;
494
+
495
+                    // eslint-disable-next-line max-depth
494 496
                     if (!groupsMap.has(primarySSRC)) {
495 497
                         groupsMap.set(primarySSRC, []);
496 498
                     }

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

@@ -241,6 +241,8 @@ SDP.prototype.toJingle = function(elem, thecreator) {
241 241
 
242 242
                 if (afmtpline) {
243 243
                     tmp = SDPUtil.parseFmtp(afmtpline);
244
+
245
+                    // eslint-disable-next-line max-depth
244 246
                     for (k = 0; k < tmp.length; k++) {
245 247
                         elem.c('parameter', tmp[k]).up();
246 248
                     }
@@ -317,11 +319,14 @@ SDP.prototype.toJingle = function(elem, thecreator) {
317 319
                     // FIXME what is this ? global APP.RTC in SDP ?
318 320
                     const localTrack = APP.RTC.getLocalTracks(mline.media);
319 321
 
322
+                    // eslint-disable-next-line max-depth
320 323
                     if (localTrack) {
321 324
                         // FIXME before this changes the track id was accessed,
322 325
                         // but msid stands for the stream id, makes no sense ?
323 326
                         msid = localTrack.getTrackId();
324 327
                     }
328
+
329
+                    // eslint-disable-next-line max-depth
325 330
                     if (msid !== null) {
326 331
                         msid = SDPUtil.filterSpecialChars(msid);
327 332
                         elem.c('parameter');
@@ -375,7 +380,11 @@ SDP.prototype.toJingle = function(elem, thecreator) {
375 380
                         uri: tmp.uri,
376 381
                         id: tmp.value
377 382
                     });
383
+
384
+                    // eslint-disable-next-line max-depth
378 385
                     if (tmp.hasOwnProperty('direction')) {
386
+
387
+                        // eslint-disable-next-line max-depth
379 388
                         switch (tmp.direction) {
380 389
                         case 'sendonly':
381 390
                             elem.attrs({ senders: 'responder' });

+ 1
- 0
modules/xmpp/SdpConsistency.js 查看文件

@@ -103,6 +103,7 @@ export default class SdpConsistency {
103 103
                         const primarySsrc = parsePrimarySSRC(group);
104 104
                         const rtxSsrc = parseSecondarySSRC(group);
105 105
 
106
+                        // eslint-disable-next-line max-depth
106 107
                         if (primarySsrc === newPrimarySsrc) {
107 108
                             group.ssrcs
108 109
                                 = `${this.cachedPrimarySsrc} ${rtxSsrc}`;

正在加载...
取消
保存