瀏覽代碼

[eslint] yoda

dev1
Lyubo Marinov 8 年之前
父節點
當前提交
2323eaa5dd

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

128
         'no-with': 2,
128
         'no-with': 2,
129
         'vars-on-top': 2,
129
         'vars-on-top': 2,
130
         'wrap-iife': [ 'error', 'inside' ],
130
         'wrap-iife': [ 'error', 'inside' ],
131
+        'yoda': 2,
131
 
132
 
132
         // Strict Mode group
133
         // Strict Mode group
133
         'strict': 2,
134
         'strict': 2,

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

84
                 dataChannel,
84
                 dataChannel,
85
                 e);
85
                 e);
86
         }
86
         }
87
-        if (('undefined' !== typeof obj) && (null !== obj)) {
87
+        if ((typeof obj !== 'undefined') && (obj !== null)) {
88
             const colibriClass = obj.colibriClass;
88
             const colibriClass = obj.colibriClass;
89
 
89
 
90
-            if ('DominantSpeakerEndpointChangeEvent' === colibriClass) {
90
+            if (colibriClass === 'DominantSpeakerEndpointChangeEvent') {
91
                 // Endpoint ID from the Videobridge.
91
                 // Endpoint ID from the Videobridge.
92
                 const dominantSpeakerEndpoint = obj.dominantSpeakerEndpoint;
92
                 const dominantSpeakerEndpoint = obj.dominantSpeakerEndpoint;
93
 
93
 
96
                     dominantSpeakerEndpoint);
96
                     dominantSpeakerEndpoint);
97
                 self.eventEmitter.emit(RTCEvents.DOMINANT_SPEAKER_CHANGED,
97
                 self.eventEmitter.emit(RTCEvents.DOMINANT_SPEAKER_CHANGED,
98
                   dominantSpeakerEndpoint);
98
                   dominantSpeakerEndpoint);
99
-            } else if ('InLastNChangeEvent' === colibriClass) {
99
+            } else if (colibriClass === 'InLastNChangeEvent') {
100
                 let oldValue = obj.oldValue;
100
                 let oldValue = obj.oldValue;
101
                 let newValue = obj.newValue;
101
                 let newValue = obj.newValue;
102
 
102
 
119
                 }
119
                 }
120
 
120
 
121
                 self.eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue);
121
                 self.eventEmitter.emit(RTCEvents.LASTN_CHANGED, oldValue, newValue);
122
-            } else if ('LastNEndpointsChangeEvent' === colibriClass) {
122
+            } else if (colibriClass === 'LastNEndpointsChangeEvent') {
123
                 // The new/latest list of last-n endpoint IDs.
123
                 // The new/latest list of last-n endpoint IDs.
124
                 const lastNEndpoints = obj.lastNEndpoints;
124
                 const lastNEndpoints = obj.lastNEndpoints;
125
                 // The list of endpoint IDs which are entering the list of
125
                 // The list of endpoint IDs which are entering the list of
132
                     lastNEndpoints, endpointsEnteringLastN, obj);
132
                     lastNEndpoints, endpointsEnteringLastN, obj);
133
                 self.eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED,
133
                 self.eventEmitter.emit(RTCEvents.LASTN_ENDPOINT_CHANGED,
134
                     lastNEndpoints, endpointsEnteringLastN, obj);
134
                     lastNEndpoints, endpointsEnteringLastN, obj);
135
-            } else if('EndpointMessage' === colibriClass) {
135
+            } else if(colibriClass === 'EndpointMessage') {
136
                 self.eventEmitter.emit(
136
                 self.eventEmitter.emit(
137
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
137
                     RTCEvents.ENDPOINT_MESSAGE_RECEIVED, obj.from,
138
                     obj.msgPayload);
138
                     obj.msgPayload);
139
-            } else if ('EndpointConnectivityStatusChangeEvent' === colibriClass) {
139
+            } else if (colibriClass === 'EndpointConnectivityStatusChangeEvent') {
140
                 const endpoint = obj.endpoint;
140
                 const endpoint = obj.endpoint;
141
                 const isActive = obj.active === 'true';
141
                 const isActive = obj.active === 'true';
142
 
142
 

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

558
     const iceConnectionState
558
     const iceConnectionState
559
         = this.conference ? this.conference.getConnectionState() : null;
559
         = this.conference ? this.conference.getConnectionState() : null;
560
 
560
 
561
-    if(this._testByteSent && 'connected' === iceConnectionState) {
561
+    if(this._testByteSent && iceConnectionState === 'connected') {
562
         setTimeout(() => {
562
         setTimeout(() => {
563
             if(this._bytesSent <= 0) {
563
             if(this._bytesSent <= 0) {
564
                 // we are not receiving anything from the microphone
564
                 // we are not receiving anything from the microphone

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

1412
             }
1412
             }
1413
 
1413
 
1414
             error.source = null;
1414
             error.source = null;
1415
-            if (request && 'function' == typeof request.tree) {
1415
+            if (request && typeof request.tree === 'function') {
1416
                 error.source = request.tree();
1416
                 error.source = request.tree();
1417
             }
1417
             }
1418
 
1418
 

+ 2
- 2
modules/xmpp/moderator.js 查看文件

161
     elem.c(
161
     elem.c(
162
         'property', {
162
         'property', {
163
             name: 'enableLipSync',
163
             name: 'enableLipSync',
164
-            value: false !== this.options.connection.enableLipSync
164
+            value: this.options.connection.enableLipSync !== false
165
         }).up();
165
         }).up();
166
     if (this.options.conference.audioPacketDelay !== undefined) {
166
     if (this.options.conference.audioPacketDelay !== undefined) {
167
         elem.c(
167
         elem.c(
390
     // Reset the error timeout (because we haven't failed here).
390
     // Reset the error timeout (because we haven't failed here).
391
     this.getNextErrorTimeout(true);
391
     this.getNextErrorTimeout(true);
392
     // eslint-disable-next-line newline-per-chained-call
392
     // eslint-disable-next-line newline-per-chained-call
393
-    if ('true' === $(result).find('conference').attr('ready')) {
393
+    if ($(result).find('conference').attr('ready') === 'true') {
394
         // Reset the non-error timeout (because we've succeeded here).
394
         // Reset the non-error timeout (because we've succeeded here).
395
         this.getNextTimeout(true);
395
         this.getNextTimeout(true);
396
         // Exec callback
396
         // Exec callback

+ 1
- 1
modules/xmpp/strophe.jingle.js 查看文件

48
         logger.log(`on jingle ${action} from ${fromJid}`, iq);
48
         logger.log(`on jingle ${action} from ${fromJid}`, iq);
49
         let sess = this.sessions[sid];
49
         let sess = this.sessions[sid];
50
 
50
 
51
-        if ('session-initiate' != action) {
51
+        if (action != 'session-initiate') {
52
             if (!sess) {
52
             if (!sess) {
53
                 ack.attrs({ type: 'error' });
53
                 ack.attrs({ type: 'error' });
54
                 ack.c('error', {type: 'cancel'})
54
                 ack.c('error', {type: 'cancel'})

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

83
         // this.caps.addFeature('urn:ietf:rfc:5576'); // a=ssrc
83
         // this.caps.addFeature('urn:ietf:rfc:5576'); // a=ssrc
84
 
84
 
85
         // Enable Lipsync ?
85
         // Enable Lipsync ?
86
-        if (RTCBrowserType.isChrome() && false !== this.options.enableLipSync) {
86
+        if (RTCBrowserType.isChrome() && this.options.enableLipSync !== false) {
87
             logger.info('Lip-sync enabled !');
87
             logger.info('Lip-sync enabled !');
88
             this.caps.addFeature('http://jitsi.org/meet/lipsync');
88
             this.caps.addFeature('http://jitsi.org/meet/lipsync');
89
         }
89
         }

Loading…
取消
儲存