Преглед на файлове

Coding style

A few occurrences of coding style/formatting which I noticed while
reviewing 'feat(eslint): Enable for non react files'. These are
definitely not all occurrences I could've noticed during the review
but... we're talking about files outside react/ anyway.
master
Lyubo Marinov преди 7 години
родител
ревизия
5d313a8cd8
променени са 8 файла, в които са добавени 110 реда и са изтрити 108 реда
  1. 0
    1
      analytics.js
  2. 43
    46
      conference.js
  3. 3
    1
      config.js
  4. 12
    6
      connection.js
  5. 2
    0
      interface_config.js
  6. 1
    2
      modules/FollowMe.js
  7. 41
    40
      modules/UI/UI.js
  8. 8
    12
      webpack.config.js

+ 0
- 1
analytics.js Целия файл

@@ -1,5 +1,4 @@
1 1
 /* global ga */
2
-/* eslint-disable indent */
3 2
 
4 3
 (function(ctx) {
5 4
     /**

+ 43
- 46
conference.js Целия файл

@@ -1,5 +1,4 @@
1 1
 /* global $, APP, JitsiMeetJS, config, interfaceConfig */
2
-const logger = require('jitsi-meet-logger').getLogger(__filename);
3 2
 
4 3
 import { openConnection } from './connection';
5 4
 
@@ -88,6 +87,8 @@ import {
88 87
     showDesktopSharingButton
89 88
 } from './react/features/toolbox';
90 89
 
90
+const logger = require('jitsi-meet-logger').getLogger(__filename);
91
+
91 92
 const eventEmitter = new EventEmitter();
92 93
 
93 94
 let room;
@@ -211,10 +212,12 @@ function maybeRedirectToWelcomePage(options) {
211 212
 
212 213
     // if Welcome page is enabled redirect to welcome page after 3 sec.
213 214
     if (config.enableWelcomePage) {
214
-        setTimeout(() => {
215
-            APP.settings.setWelcomePageEnabled(true);
216
-            assignWindowLocationPathname('./');
217
-        }, 3000);
215
+        setTimeout(
216
+            () => {
217
+                APP.settings.setWelcomePageEnabled(true);
218
+                assignWindowLocationPathname('./');
219
+            },
220
+            3000);
218 221
     }
219 222
 }
220 223
 
@@ -595,10 +598,8 @@ export default {
595 598
                         // Try audio only...
596 599
                         audioAndVideoError = err;
597 600
 
598
-                        return createLocalTracksF(
599
-                            { devices: [ 'audio' ] },
600
-                            true
601
-                        );
601
+                        return (
602
+                            createLocalTracksF({ devices: [ 'audio' ] }, true));
602 603
                     } else if (requestedAudio && !requestedVideo) {
603 604
                         audioOnlyError = err;
604 605
 
@@ -949,9 +950,9 @@ export default {
949 950
     isParticipantModerator(id) {
950 951
         const user = room.getParticipantById(id);
951 952
 
952
-
953 953
         return user && user.isModerator();
954 954
     },
955
+
955 956
     get membersCount() {
956 957
         return room.getParticipants().length + 1;
957 958
     },
@@ -1084,7 +1085,6 @@ export default {
1084 1085
     getParticipantConnectionStatus(id) {
1085 1086
         const participant = this.getParticipantById(id);
1086 1087
 
1087
-
1088 1088
         return participant ? participant.getConnectionStatus() : null;
1089 1089
     },
1090 1090
 
@@ -1109,12 +1109,10 @@ export default {
1109 1109
         }
1110 1110
 
1111 1111
         return interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;
1112
-
1113
-
1114 1112
     },
1113
+
1115 1114
     getMyUserId() {
1116
-        return this._room
1117
-            && this._room.myUserId();
1115
+        return this._room && this._room.myUserId();
1118 1116
     },
1119 1117
 
1120 1118
     /**
@@ -1287,15 +1285,15 @@ export default {
1287 1285
         const options = config;
1288 1286
 
1289 1287
         if (config.enableRecording && !config.recordingType) {
1290
-            options.recordingType = config.hosts
1291
-                && (typeof config.hosts.jirecon !== 'undefined')
1292
-                ? 'jirecon' : 'colibri';
1288
+            options.recordingType
1289
+                = config.hosts && (typeof config.hosts.jirecon !== 'undefined')
1290
+                    ? 'jirecon'
1291
+                    : 'colibri';
1293 1292
         }
1294 1293
 
1295 1294
         return options;
1296 1295
     },
1297 1296
 
1298
-
1299 1297
     /**
1300 1298
      * Start using provided video stream.
1301 1299
      * Stops previous video stream.
@@ -1484,7 +1482,6 @@ export default {
1484 1482
         }
1485 1483
 
1486 1484
         return this._untoggleScreenSharing();
1487
-
1488 1485
     },
1489 1486
 
1490 1487
     /**
@@ -1595,34 +1592,34 @@ export default {
1595 1592
         this.videoSwitchInProgress = true;
1596 1593
 
1597 1594
         return this._createDesktopTrack(options)
1598
-        .then(stream => this.useVideoStream(stream))
1599
-        .then(() => {
1600
-            this.videoSwitchInProgress = false;
1601
-            sendEvent('conference.sharingDesktop.start');
1602
-            logger.log('sharing local desktop');
1603
-        })
1604
-        .catch(error => {
1605
-            this.videoSwitchInProgress = false;
1606
-
1607
-            // Pawel: With this call I'm trying to preserve the original
1608
-            // behaviour although it is not clear why would we "untoggle"
1609
-            // on failure. I suppose it was to restore video in case there
1610
-            // was some problem during "this.useVideoStream(desktopStream)".
1611
-            // It's important to note that the handler will not be available
1612
-            // if we fail early on trying to get desktop media (which makes
1613
-            // sense, because the camera video is still being used, so
1614
-            // nothing to "untoggle").
1615
-            if (this._untoggleScreenSharing) {
1616
-                this._untoggleScreenSharing();
1617
-            }
1595
+            .then(stream => this.useVideoStream(stream))
1596
+            .then(() => {
1597
+                this.videoSwitchInProgress = false;
1598
+                sendEvent('conference.sharingDesktop.start');
1599
+                logger.log('sharing local desktop');
1600
+            })
1601
+            .catch(error => {
1602
+                this.videoSwitchInProgress = false;
1603
+
1604
+                // Pawel: With this call I'm trying to preserve the original
1605
+                // behaviour although it is not clear why would we "untoggle"
1606
+                // on failure. I suppose it was to restore video in case there
1607
+                // was some problem during "this.useVideoStream(desktopStream)".
1608
+                // It's important to note that the handler will not be available
1609
+                // if we fail early on trying to get desktop media (which makes
1610
+                // sense, because the camera video is still being used, so
1611
+                // nothing to "untoggle").
1612
+                if (this._untoggleScreenSharing) {
1613
+                    this._untoggleScreenSharing();
1614
+                }
1618 1615
 
1619
-            // FIXME the code inside of _handleScreenSharingError is
1620
-            // asynchronous, but does not return a Promise and is not part
1621
-            // of the current Promise chain.
1622
-            this._handleScreenSharingError(error);
1616
+                // FIXME the code inside of _handleScreenSharingError is
1617
+                // asynchronous, but does not return a Promise and is not part
1618
+                // of the current Promise chain.
1619
+                this._handleScreenSharingError(error);
1623 1620
 
1624
-            return Promise.reject(error);
1625
-        });
1621
+                return Promise.reject(error);
1622
+            });
1626 1623
     },
1627 1624
 
1628 1625
     /**

+ 3
- 1
config.js Целия файл

@@ -1,5 +1,6 @@
1 1
 /* eslint-disable no-unused-vars, no-var */
2
-var config = { // eslint-disable-line no-unused-vars
2
+
3
+var config = {
3 4
     // Configuration
4 5
     //
5 6
 
@@ -288,4 +289,5 @@ var config = { // eslint-disable-line no-unused-vars
288 289
         // userRegion: "asia"
289 290
     }
290 291
 };
292
+
291 293
 /* eslint-enable no-unused-vars, no-var */

+ 12
- 6
connection.js Целия файл

@@ -35,8 +35,10 @@ function checkForAttachParametersAndConnect(id, password, connection) {
35 35
         // If the connection optimization is deployed and enabled and there is
36 36
         // a failure the value will be window.XMPPAttachInfo.status = "error"
37 37
         if (window.XMPPAttachInfo.status === 'error') {
38
-            connection.connect({ id,
39
-                password });
38
+            connection.connect({
39
+                id,
40
+                password
41
+            });
40 42
 
41 43
             return;
42 44
         }
@@ -47,13 +49,17 @@ function checkForAttachParametersAndConnect(id, password, connection) {
47 49
             connection.attach(attachOptions);
48 50
             delete window.XMPPAttachInfo.data;
49 51
         } else {
50
-            connection.connect({ id,
51
-                password });
52
+            connection.connect({
53
+                id,
54
+                password
55
+            });
52 56
         }
53 57
     } else {
54 58
         APP.connect.status = 'ready';
55
-        APP.connect.handler = checkForAttachParametersAndConnect.bind(null,
56
-            id, password, connection);
59
+        APP.connect.handler
60
+            = checkForAttachParametersAndConnect.bind(
61
+                null,
62
+                id, password, connection);
57 63
     }
58 64
 }
59 65
 

+ 2
- 0
interface_config.js Целия файл

@@ -1,4 +1,5 @@
1 1
 /* eslint-disable no-unused-vars, no-var, max-len */
2
+
2 3
 var interfaceConfig = {
3 4
     // TO FIX: this needs to be handled from SASS variables. There are some
4 5
     // methods allowing to use variables both in css and js.
@@ -142,4 +143,5 @@ var interfaceConfig = {
142 143
      */
143 144
     // ADD_PEOPLE_APP_NAME: ""
144 145
 };
146
+
145 147
 /* eslint-enable no-unused-vars, no-var, max-len */

+ 1
- 2
modules/FollowMe.js Целия файл

@@ -339,8 +339,7 @@ class FollowMe {
339 339
         }
340 340
 
341 341
         if (!this._conference.isParticipantModerator(id)) {
342
-            logger.warn('Received follow-me command '
343
-                + 'not from moderator');
342
+            logger.warn('Received follow-me command not from moderator');
344 343
 
345 344
             return;
346 345
         }

+ 41
- 40
modules/UI/UI.js Целия файл

@@ -122,9 +122,7 @@ const UIListeners = new Map([
122 122
         () => UI.toggleContactList()
123 123
     ], [
124 124
         UIEvents.TOGGLE_PROFILE,
125
-        () => {
126
-            UI.toggleSidePanel('profile_container');
127
-        }
125
+        () => UI.toggleSidePanel('profile_container')
128 126
     ], [
129 127
         UIEvents.TOGGLE_FILMSTRIP,
130 128
         () => UI.handleToggleFilmstrip()
@@ -139,9 +137,7 @@ const UIListeners = new Map([
139 137
  * (a.k.a. presentation mode in Chrome).
140 138
  */
141 139
 UI.toggleFullScreen = function() {
142
-    UIUtil.isFullScreen()
143
-        ? UIUtil.exitFullScreen()
144
-        : UIUtil.enterFullScreen();
140
+    UIUtil.isFullScreen() ? UIUtil.exitFullScreen() : UIUtil.enterFullScreen();
145 141
 };
146 142
 
147 143
 /**
@@ -158,9 +154,13 @@ UI.notifyGracefulShutdown = function() {
158 154
  * Notify user that reservation error happened.
159 155
  */
160 156
 UI.notifyReservationError = function(code, msg) {
161
-    const message = APP.translation.generateTranslationHTML(
162
-        'dialog.reservationErrorMsg', { code,
163
-            msg });
157
+    const message
158
+        = APP.translation.generateTranslationHTML(
159
+            'dialog.reservationErrorMsg',
160
+            {
161
+                code,
162
+                msg
163
+            });
164 164
 
165 165
     messageHandler.openDialog(
166 166
         'dialog.reservationError', message, true, {}, () => false);
@@ -171,8 +171,8 @@ UI.notifyReservationError = function(code, msg) {
171 171
  */
172 172
 UI.notifyKicked = function() {
173 173
     messageHandler.openMessageDialog(
174
-            'dialog.sessTerminated',
175
-            'dialog.kickMessage');
174
+        'dialog.sessTerminated',
175
+        'dialog.kickMessage');
176 176
 };
177 177
 
178 178
 /**
@@ -192,10 +192,9 @@ UI.notifyConferenceDestroyed = function(reason) {
192 192
  * @param msg
193 193
  */
194 194
 UI.showChatError = function(err, msg) {
195
-    if (interfaceConfig.filmStripOnly) {
196
-        return;
195
+    if (!interfaceConfig.filmStripOnly) {
196
+        Chat.chatAddError(err, msg);
197 197
     }
198
-    Chat.chatAddError(err, msg);
199 198
 };
200 199
 
201 200
 /**
@@ -229,8 +228,11 @@ UI.showLocalConnectionInterrupted = function(isInterrupted) {
229 228
 UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
230 229
     VideoLayout.setRaisedHandStatus(participant.getId(), raisedHandStatus);
231 230
     if (raisedHandStatus) {
232
-        messageHandler.participantNotification(participant.getDisplayName(),
233
-            'notify.somebody', 'connected', 'notify.raisedHand');
231
+        messageHandler.participantNotification(
232
+            participant.getDisplayName(),
233
+            'notify.somebody',
234
+            'connected',
235
+            'notify.raisedHand');
234 236
     }
235 237
 };
236 238
 
@@ -313,7 +315,6 @@ UI.start = function() {
313 315
     // Set the defaults for prompt dialogs.
314 316
     $.prompt.setDefaults({ persistent: false });
315 317
 
316
-
317 318
     SideContainerToggler.init(eventEmitter);
318 319
     Filmstrip.init(eventEmitter);
319 320
 
@@ -471,8 +472,7 @@ UI.addUser = function(user) {
471 472
     const displayName = user.getDisplayName();
472 473
 
473 474
     messageHandler.participantNotification(
474
-        displayName, 'notify.somebody', 'connected', 'notify.connected'
475
-    );
475
+        displayName, 'notify.somebody', 'connected', 'notify.connected');
476 476
 
477 477
     if (!config.startAudioMuted
478 478
         || config.startAudioMuted > APP.conference.membersCount) {
@@ -498,11 +498,10 @@ UI.addUser = function(user) {
498 498
  */
499 499
 UI.removeUser = function(id, displayName) {
500 500
     messageHandler.participantNotification(
501
-        displayName, 'notify.somebody', 'disconnected', 'notify.disconnected'
502
-    );
501
+        displayName, 'notify.somebody', 'disconnected', 'notify.disconnected');
503 502
 
504 503
     if (!config.startAudioMuted
505
-        || config.startAudioMuted > APP.conference.membersCount) {
504
+            || config.startAudioMuted > APP.conference.membersCount) {
506 505
         UIUtil.playSoundNotification('userLeft');
507 506
     }
508 507
 
@@ -558,15 +557,17 @@ UI.updateUserRole = user => {
558 557
 
559 558
     if (displayName) {
560 559
         messageHandler.participantNotification(
561
-            displayName, 'notify.somebody',
562
-            'connected', 'notify.grantedTo', {
563
-                to: UIUtil.escapeHtml(displayName)
564
-            }
565
-        );
560
+            displayName,
561
+            'notify.somebody',
562
+            'connected',
563
+            'notify.grantedTo',
564
+            { to: UIUtil.escapeHtml(displayName) });
566 565
     } else {
567 566
         messageHandler.participantNotification(
568
-            '', 'notify.somebody',
569
-            'connected', 'notify.grantedToUnknown');
567
+            '',
568
+            'notify.somebody',
569
+            'connected',
570
+            'notify.grantedToUnknown');
570 571
     }
571 572
 };
572 573
 
@@ -584,10 +585,11 @@ UI.updateUserStatus = (user, status) => {
584 585
     const displayName = user.getDisplayName();
585 586
 
586 587
     messageHandler.participantNotification(
587
-        displayName, '', 'connected', 'dialOut.statusMessage',
588
-        {
589
-            status: UIUtil.escapeHtml(status)
590
-        });
588
+        displayName,
589
+        '',
590
+        'connected',
591
+        'dialOut.statusMessage',
592
+        { status: UIUtil.escapeHtml(status) });
591 593
 };
592 594
 
593 595
 /**
@@ -648,9 +650,10 @@ UI.inputDisplayNameHandler = function(newDisplayName) {
648 650
  */
649 651
 // eslint-disable-next-line max-params
650 652
 UI.showCustomToolbarPopup = function(buttonName, popupID, show, timeout) {
651
-    const action = show
652
-        ? setButtonPopupTimeout(buttonName, popupID, timeout)
653
-        : clearButtonPopup(buttonName);
653
+    const action
654
+        = show
655
+            ? setButtonPopupTimeout(buttonName, popupID, timeout)
656
+            : clearButtonPopup(buttonName);
654 657
 
655 658
     APP.store.dispatch(action);
656 659
 };
@@ -681,10 +684,8 @@ UI.showLoginPopup = function(callback) {
681 684
 
682 685
     // eslint-disable-next-line max-params
683 686
     const submitFunction = (e, v, m, f) => {
684
-        if (v) {
685
-            if (f.username && f.password) {
686
-                callback(f.username, f.password);
687
-            }
687
+        if (v && f.username && f.password) {
688
+            callback(f.username, f.password);
688 689
         }
689 690
     };
690 691
 

+ 8
- 12
webpack.config.js Целия файл

@@ -64,6 +64,7 @@ const config = {
64 64
         rules: [ {
65 65
             // Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
66 66
             // as well.
67
+
67 68
             exclude: node_modules, // eslint-disable-line camelcase
68 69
             loader: 'babel-loader',
69 70
             options: {
@@ -210,11 +211,10 @@ function devServerProxyBypass({ path }) {
210 211
 
211 212
     const configs = module.exports;
212 213
 
213
-    /* eslint-disable indent */
214
-    let formattedPath = path;
214
+    /* eslint-disable array-callback-return, indent */
215 215
 
216 216
     if ((Array.isArray(configs) ? configs : Array(configs)).some(c => {
217
-                if (formattedPath.startsWith(c.output.publicPath)) {
217
+                if (path.startsWith(c.output.publicPath)) {
218 218
                     if (!minimize) {
219 219
                         // Since webpack-dev-server is serving non-minimized
220 220
                         // artifacts, serve them even if the minimized ones are
@@ -222,24 +222,20 @@ function devServerProxyBypass({ path }) {
222 222
                         Object.keys(c.entry).some(e => {
223 223
                             const name = `${e}.min.js`;
224 224
 
225
-                            if (formattedPath.indexOf(name) !== -1) {
226
-                                formattedPath
227
-                                    = formattedPath.replace(name, `${e}.js`);
225
+                            if (path.indexOf(name) !== -1) {
226
+                                // eslint-disable-next-line no-param-reassign
227
+                                path = path.replace(name, `${e}.js`);
228 228
 
229 229
                                 return true;
230 230
                             }
231
-
232
-                            return false;
233 231
                         });
234 232
                     }
235 233
 
236 234
                     return true;
237 235
                 }
238
-
239
-                return false;
240 236
             })) {
241
-        return formattedPath;
237
+        return path;
242 238
     }
243 239
 
244
-    /* eslint-enable indent */
240
+    /* eslint-enable array-callback-return, indent */
245 241
 }

Loading…
Отказ
Запис