From dfebd692f31e3b445d19e9d76169ea0921789d06 Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Mon, 2 Oct 2017 18:08:07 -0500 Subject: [PATCH] eslint 4.8.0 ESLint 4.8.0 discovers a lot of error related to formatting. While I tried to fix as many of them as possible, a portion of them actually go against our coding style. In such a case, I've disabled the indent rule which effectively leaves it as it was before ESLint 4.8.0. Additionally, remove jshint because it's becoming a nuisance with its lack of understanding of ES2015+. --- .eslintrc.js | 17 ++ .jshintignore | 22 -- .jshintrc | 20 -- analytics.js | 7 +- conference.js | 245 +++++++++--------- modules/API/API.js | 26 +- modules/API/external/external_api.js | 4 +- modules/UI/audio_levels/AudioLevels.js | 16 +- modules/UI/authentication/AuthHandler.js | 3 +- modules/UI/shared_video/SharedVideo.js | 11 +- modules/UI/side_pannels/chat/Replacement.js | 4 + modules/UI/util/MessageHandler.js | 41 +-- modules/UI/util/UIUtil.js | 24 +- modules/UI/videolayout/Filmstrip.js | 48 ++-- modules/UI/videolayout/LargeVideoManager.js | 7 +- modules/UI/videolayout/RemoteVideo.js | 3 +- modules/UI/videolayout/SmallVideo.js | 9 +- modules/UI/videolayout/VideoContainer.js | 30 ++- modules/UI/videolayout/VideoLayout.js | 15 +- modules/devices/mediaDeviceHelper.js | 58 +++-- modules/keyboardshortcut/keyboardshortcut.js | 15 +- modules/remotecontrol/Receiver.js | 5 +- package.json | 14 +- react/.eslintrc.js | 8 +- react/features/app/actions.js | 6 +- react/features/base/conference/actions.js | 12 +- react/features/base/config/reducer.js | 5 + react/features/base/connection/reducer.js | 4 +- react/features/base/i18n/i18next.js | 2 + react/features/base/lib-jitsi-meet/actions.js | 4 +- .../native/RTCPeerConnection.js | 4 +- .../base/media/components/AbstractAudio.js | 6 +- .../participants/components/Avatar.native.js | 4 +- .../features/base/participants/middleware.js | 2 + .../components/web/InlineDialogFailure.js | 2 + .../base/react/components/web/Watermarks.js | 6 + .../components/Conference.native.js | 8 +- .../components/ConnectionStatsTable.js | 4 +- .../components/ContactListPanel.web.js | 2 + .../components/DesktopPickerPane.js | 2 + react/features/device-selection/actions.js | 2 +- .../dial-out/components/CountryIcon.js | 5 +- .../feedback/components/FeedbackButton.web.js | 2 + .../feedback/components/FeedbackDialog.web.js | 4 +- .../filmstrip/components/Filmstrip.native.js | 11 +- react/features/filmstrip/functions.js | 4 +- .../invite/components/AddPeopleDialog.web.js | 2 +- react/features/invite/functions.js | 11 +- react/features/mobile/background/actions.js | 4 +- .../features/mobile/background/middleware.js | 2 +- .../features/mobile/permissions/middleware.js | 13 +- .../overlay/components/ReloadButton.js | 2 + .../RemoteControlAuthorizationDialog.js | 5 +- .../toolbox/components/Toolbar.web.js | 3 +- .../LocalVideoTrackUnderlay.native.js | 1 + webpack.config.js | 4 + 56 files changed, 425 insertions(+), 375 deletions(-) delete mode 100644 .jshintignore delete mode 100644 .jshintrc diff --git a/.eslintrc.js b/.eslintrc.js index 64947373ae..55b9234426 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,6 +26,23 @@ module.exports = { 'flowtype' ], 'rules': { + 'indent': [ + 'error', + 4, + { + 'CallExpression': { + arguments: 'off' + }, + 'FunctionDeclaration': { + parameters: 2 + }, + 'FunctionExpression': { + parameters: 2 + }, + 'MemberExpression': 'off', + 'SwitchCase': 0 + } + ], 'new-cap': [ 'error', { diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index bdb025c72e..0000000000 --- a/.jshintignore +++ /dev/null @@ -1,22 +0,0 @@ -# The following do not need to be checked because they do not represent JS -# source code. -build/ -debian/ -libs/ -node_modules/ - -# The following are checked by ESLint with the maximum configuration which -# supersedes JSHint. -flow-typed/ -modules/API/ -modules/remotecontrol/ -modules/transport/ -react/ - -# The following are checked by ESLint with the minimum configuration which does -# not supersede JSHint but take advantage of advanced language features such as -# Facebook Flow which are not supported by JSHint. -app.js -modules/translation/translation.js - -analytics.js diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index eaa69ba528..0000000000 --- a/.jshintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - // Refer to http://jshint.com/docs/options/ for an exhaustive list of options - "asi": false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) - "expr": true, // true: Tolerate `ExpressionStatement` as Programs - "loopfunc": true, // true: Tolerate functions being defined in loops - "curly": false, // true: Require {} for every new block or scope - "evil": true, // true: Tolerate use of `eval` and `new Function()` - "white": true, - "undef": true, // true: Require all non-global variables to be declared (prevents global leaks) - "browser": true, // Web Browser (window, document, etc) - "node": true, // Node.js - "trailing": true, - "indent": 4, // {int} Number of spaces to use for indentation - "latedef": true, // true: Require variables/functions to be defined before being used - "newcap": true, // true: Require capitalization of all constructor functions e.g. `new F()` - "maxlen": 80, // {int} Max number of characters per line - "latedef": false, //This option prohibits the use of a variable before it was defined - "laxbreak": true, //Ignore line breaks around "=", "==", "&&", etc. - "esnext": true //support ES2015 -} diff --git a/analytics.js b/analytics.js index 45a173e10d..20971c675d 100644 --- a/analytics.js +++ b/analytics.js @@ -1,8 +1,9 @@ /* global ga */ +/* eslint-disable indent */ (function (ctx) { function Analytics() { - /* eslint-disable */ + /* eslint-disable semi */ /** * Google Analytics @@ -13,7 +14,7 @@ ga('create', 'UA-319188-14', 'jit.si'); ga('send', 'pageview'); - /* eslint-enable */ + /* eslint-enable semi */ } Analytics.prototype.sendEvent = function (action, data) { @@ -29,10 +30,8 @@ if (typeof ctx.JitsiMeetJS === "undefined") ctx.JitsiMeetJS = {}; - if (typeof ctx.JitsiMeetJS.app === "undefined") ctx.JitsiMeetJS.app = {}; - if (typeof ctx.JitsiMeetJS.app.analyticsHandlers === "undefined") ctx.JitsiMeetJS.app.analyticsHandlers = []; ctx.JitsiMeetJS.app.analyticsHandlers.push(Analytics); diff --git a/conference.js b/conference.js index 26b257f0e2..f097c1199e 100644 --- a/conference.js +++ b/conference.js @@ -123,13 +123,13 @@ const commands = { function connect(roomName) { return openConnection({retry: true, roomName: roomName}) .catch(function (err) { - if (err === ConnectionErrors.PASSWORD_REQUIRED) { - APP.UI.notifyTokenAuthFailed(); - } else { - APP.UI.notifyConnectionFailed(err); - } - throw err; - }); + if (err === ConnectionErrors.PASSWORD_REQUIRED) { + APP.UI.notifyTokenAuthFailed(); + } else { + APP.UI.notifyConnectionFailed(err); + } + throw err; + }); } /** @@ -286,38 +286,36 @@ class ConferenceConnector { logger.error('CONFERENCE FAILED:', err, ...params); switch (err) { - case ConferenceErrors.CONNECTION_ERROR: - { - let [msg] = params; - APP.UI.notifyConnectionFailed(msg); - } + case ConferenceErrors.CONNECTION_ERROR: { + let [msg] = params; + APP.UI.notifyConnectionFailed(msg); break; + } - case ConferenceErrors.NOT_ALLOWED_ERROR: - { - // let's show some auth not allowed page - assignWindowLocationPathname('static/authError.html'); - } + case ConferenceErrors.NOT_ALLOWED_ERROR: { + // let's show some auth not allowed page + assignWindowLocationPathname('static/authError.html'); break; + } - // not enough rights to create conference + // not enough rights to create conference case ConferenceErrors.AUTHENTICATION_REQUIRED: { - // Schedule reconnect to check if someone else created the room. - this.reconnectTimeout = setTimeout(() => room.join(), 5000); + // Schedule reconnect to check if someone else created the room. + this.reconnectTimeout = setTimeout(() => room.join(), 5000); - const { password } - = APP.store.getState()['features/base/conference']; + const { password } + = APP.store.getState()['features/base/conference']; + + AuthHandler.requireAuth(room, password); - AuthHandler.requireAuth(room, password); - } break; + } - case ConferenceErrors.RESERVATION_ERROR: - { - let [code, msg] = params; - APP.UI.notifyReservationError(code, msg); - } + case ConferenceErrors.RESERVATION_ERROR: { + let [code, msg] = params; + APP.UI.notifyReservationError(code, msg); break; + } case ConferenceErrors.GRACEFUL_SHUTDOWN: APP.UI.notifyGracefulShutdown(); @@ -327,24 +325,22 @@ class ConferenceConnector { APP.UI.notifyInternalError(); break; - case ConferenceErrors.CONFERENCE_DESTROYED: - { - let [reason] = params; - APP.UI.hideStats(); - APP.UI.notifyConferenceDestroyed(reason); - } + case ConferenceErrors.CONFERENCE_DESTROYED: { + let [reason] = params; + APP.UI.hideStats(); + APP.UI.notifyConferenceDestroyed(reason); break; + } - // FIXME FOCUS_DISCONNECTED is confusing event name. - // What really happens there is that the library is not ready yet, - // because Jicofo is not available, but it is going to give - // it another try. - case ConferenceErrors.FOCUS_DISCONNECTED: - { - let [focus, retrySec] = params; - APP.UI.notifyFocusDisconnected(focus, retrySec); - } + // FIXME FOCUS_DISCONNECTED is a confusing event name. + // What really happens there is that the library is not ready yet, + // because Jicofo is not available, but it is going to give it another + // try. + case ConferenceErrors.FOCUS_DISCONNECTED: { + let [focus, retrySec] = params; + APP.UI.notifyFocusDisconnected(focus, retrySec); break; + } case ConferenceErrors.FOCUS_LEFT: case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE: @@ -358,9 +354,11 @@ class ConferenceConnector { connection.disconnect(); APP.UI.notifyMaxUsersLimitReached(); break; + case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS: reload(); break; + default: this._handleConferenceFailed(err, ...params); } @@ -644,7 +642,7 @@ export default { init(options) { this.roomName = options.roomName; // attaches global error handler, if there is already one, respect it - if (JitsiMeetJS.getGlobalOnErrorHandler){ + if (JitsiMeetJS.getGlobalOnErrorHandler) { var oldOnErrorHandler = window.onerror; window.onerror = function (message, source, lineno, colno, error) { JitsiMeetJS.getGlobalOnErrorHandler( @@ -656,20 +654,18 @@ export default { var oldOnUnhandledRejection = window.onunhandledrejection; window.onunhandledrejection = function(event) { - - JitsiMeetJS.getGlobalOnErrorHandler( + JitsiMeetJS.getGlobalOnErrorHandler( null, null, null, null, event.reason); if (oldOnUnhandledRejection) oldOnUnhandledRejection(event); }; } - return JitsiMeetJS.init( - Object.assign({ - enableAnalyticsLogging: isAnalyticsEnabled(APP.store) - }, - config) - ).then(() => { + return ( + JitsiMeetJS.init({ + enableAnalyticsLogging: isAnalyticsEnabled(APP.store), + ...config + }).then(() => { initAnalytics(APP.store); return this.createInitialLocalTracksAndConnect( options.roomName, { @@ -733,7 +729,7 @@ export default { return new Promise((resolve, reject) => { (new ConferenceConnector(resolve, reject)).connect(); }); - }); + })); }, /** * Check if id is id of the local user. @@ -1700,15 +1696,12 @@ export default { room.on( ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, - (leavingIds, enteringIds) => { - APP.UI.handleLastNEndpoints(leavingIds, enteringIds); - }); + (leavingIds, enteringIds) => + APP.UI.handleLastNEndpoints(leavingIds, enteringIds)); room.on( ConferenceEvents.P2P_STATUS, - (jitsiConference, p2p) => { - APP.store.dispatch(p2pStatusChanged(p2p)); - }); + (jitsiConference, p2p) => APP.store.dispatch(p2pStatusChanged(p2p))); room.on( ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, @@ -1717,7 +1710,7 @@ export default { id, connectionStatus)); APP.UI.participantConnectionStatusChanged(id); - }); + }); room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => { APP.store.dispatch(dominantSpeakerChanged(id)); @@ -1818,21 +1811,22 @@ export default { APP.UI.setLocalRemoteControlActiveChanged(); }); - room.on(ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED, - (participant, name, oldValue, newValue) => { - switch (name) { - case 'raisedHand': - APP.UI.setRaisedHandStatus(participant, newValue); - break; - case 'remoteControlSessionStatus': - APP.UI.setRemoteControlActiveStatus( - participant.getId(), - newValue); - break; - default: - // ignore - } - }); + room.on( + ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED, + (participant, name, oldValue, newValue) => { + switch (name) { + case 'raisedHand': + APP.UI.setRaisedHandStatus(participant, newValue); + break; + case 'remoteControlSessionStatus': + APP.UI.setRemoteControlActiveStatus( + participant.getId(), + newValue); + break; + default: + // ignore + } + }); room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => { logger.log("Received recorder status change: ", status, error); @@ -1910,7 +1904,7 @@ export default { avatarURL: data.value })); APP.UI.setUserAvatarUrl(from, data.value); - }); + }); room.addCommandListener(this.commands.defaults.AVATAR_ID, (data, from) => { @@ -1972,25 +1966,27 @@ export default { }); }); - APP.UI.addListener(UIEvents.RESOLUTION_CHANGED, + APP.UI.addListener( + UIEvents.RESOLUTION_CHANGED, (id, oldResolution, newResolution, delay) => { - var logObject = { - id: "resolution_change", - participant: id, - oldValue: oldResolution, - newValue: newResolution, - delay: delay + var logObject = { + id: "resolution_change", + participant: id, + oldValue: oldResolution, + newValue: newResolution, + delay: delay }; - room.sendApplicationLog(JSON.stringify(logObject)); - // We only care about the delay between simulcast streams. - // Longer delays will be caused by something else and will just - // poison the data. - if (delay < 2000) { - JitsiMeetJS.analytics.sendEvent('stream.switch.delay', - {value: delay}); - } - }); + room.sendApplicationLog(JSON.stringify(logObject)); + + // We only care about the delay between simulcast streams. + // Longer delays will be caused by something else and will just + // poison the data. + if (delay < 2000) { + JitsiMeetJS.analytics.sendEvent('stream.switch.delay', + {value: delay}); + } + }); // Starts or stops the recording for the conference. APP.UI.addListener(UIEvents.RECORDING_TOGGLED, (options) => { @@ -2112,37 +2108,40 @@ export default { UIEvents.TOGGLE_SCREENSHARING, this.toggleScreenSharing.bind(this) ); - APP.UI.addListener(UIEvents.UPDATE_SHARED_VIDEO, + APP.UI.addListener( + UIEvents.UPDATE_SHARED_VIDEO, (url, state, time, isMuted, volume) => { - // send start and stop commands once, and remove any updates - // that had left - if (state === 'stop' || state === 'start' || state === 'playing') { - room.removeCommand(this.commands.defaults.SHARED_VIDEO); - room.sendCommandOnce(this.commands.defaults.SHARED_VIDEO, { - value: url, - attributes: { - state: state, - time: time, - muted: isMuted, - volume: volume - } - }); - } - else { - // in case of paused, in order to allow late users to join - // paused - room.removeCommand(this.commands.defaults.SHARED_VIDEO); - room.sendCommand(this.commands.defaults.SHARED_VIDEO, { - value: url, - attributes: { - state: state, - time: time, - muted: isMuted, - volume: volume - } - }); - } - }); + // send start and stop commands once, and remove any updates + // that had left + if (state === 'stop' + || state === 'start' + || state === 'playing') { + room.removeCommand(this.commands.defaults.SHARED_VIDEO); + room.sendCommandOnce(this.commands.defaults.SHARED_VIDEO, { + value: url, + attributes: { + state: state, + time: time, + muted: isMuted, + volume: volume + } + }); + } + else { + // in case of paused, in order to allow late users to join + // paused + room.removeCommand(this.commands.defaults.SHARED_VIDEO); + room.sendCommand(this.commands.defaults.SHARED_VIDEO, { + value: url, + attributes: { + state: state, + time: time, + muted: isMuted, + volume: volume + } + }); + } + }); room.addCommandListener( this.commands.defaults.SHARED_VIDEO, ({value, attributes}, id) => { diff --git a/modules/API/API.js b/modules/API/API.js index 742462a6b8..4f801672c4 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -72,7 +72,7 @@ function initCommands() { return false; }); - transport.on('request', ({ data, name }, callback) => { + transport.on('request', ({ name }, callback) => { switch (name) { case 'is-audio-muted': callback(APP.conference.isLocalAudioMuted()); @@ -145,6 +145,8 @@ function toggleScreenSharing() { * Jitsi Meet. */ class API { + _enabled: boolean; + /** * Initializes the API. Setups message event listeners that will receive * information from external applications that embed Jitsi Meet. It also @@ -179,7 +181,7 @@ class API { * @param {Object} event - The event to be sent. * @returns {void} */ - _sendEvent(event = {}) { + _sendEvent(event: Object = {}) { if (this._enabled) { transport.sendEvent(event); } @@ -191,7 +193,7 @@ class API { * @param {string} message - Message body. * @returns {void} */ - notifySendingChatMessage(message) { + notifySendingChatMessage(message: string) { this._sendEvent({ name: 'outgoing-message', message @@ -226,7 +228,7 @@ class API { * @param {string} id - User id. * @returns {void} */ - notifyUserJoined(id) { + notifyUserJoined(id: string) { this._sendEvent({ name: 'participant-joined', id @@ -240,7 +242,7 @@ class API { * @param {string} id - User id. * @returns {void} */ - notifyUserLeft(id) { + notifyUserLeft(id: string) { this._sendEvent({ name: 'participant-left', id @@ -255,7 +257,7 @@ class API { * @param {string} displayname - User nickname. * @returns {void} */ - notifyDisplayNameChanged(id, displayname) { + notifyDisplayNameChanged(id: string, displayname: string) { this._sendEvent({ name: 'display-name-change', displayname, @@ -270,7 +272,7 @@ class API { * @param {string} roomName - The room name. * @returns {void} */ - notifyConferenceJoined(roomName) { + notifyConferenceJoined(roomName: string) { this._sendEvent({ name: 'video-conference-joined', roomName @@ -284,7 +286,7 @@ class API { * @param {string} roomName - User id. * @returns {void} */ - notifyConferenceLeft(roomName) { + notifyConferenceLeft(roomName: string) { this._sendEvent({ name: 'video-conference-left', roomName @@ -308,7 +310,7 @@ class API { * @param {boolean} muted - The new muted status. * @returns {void} */ - notifyAudioMutedStatusChanged(muted) { + notifyAudioMutedStatusChanged(muted: boolean) { this._sendEvent({ name: 'audio-mute-status-changed', muted @@ -322,7 +324,7 @@ class API { * @param {boolean} muted - The new muted status. * @returns {void} */ - notifyVideoMutedStatusChanged(muted) { + notifyVideoMutedStatusChanged(muted: boolean) { this._sendEvent({ name: 'video-mute-status-changed', muted @@ -336,7 +338,7 @@ class API { * @param {boolean} available - True if available and false otherwise. * @returns {void} */ - notifyAudioAvailabilityChanged(available) { + notifyAudioAvailabilityChanged(available: boolean) { audioAvailable = available; this._sendEvent({ name: 'audio-availability-changed', @@ -351,7 +353,7 @@ class API { * @param {boolean} available - True if available and false otherwise. * @returns {void} */ - notifyVideoAvailabilityChanged(available) { + notifyVideoAvailabilityChanged(available: boolean) { videoAvailable = available; this._sendEvent({ name: 'video-availability-changed', diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index 51d4bd7091..a2093c33ad 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -87,8 +87,8 @@ function generateURL(domain, options = {}) { return urlObjectToString({ ...options, url: - `${options.noSSL ? 'http' : 'https'}://${domain - }/#jitsi_meet_external_api_id=${id}` + `${options.noSSL ? 'http' : 'https'}://${ + domain}/#jitsi_meet_external_api_id=${id}` }); } diff --git a/modules/UI/audio_levels/AudioLevels.js b/modules/UI/audio_levels/AudioLevels.js index 5d84040ab4..f4bec666d6 100644 --- a/modules/UI/audio_levels/AudioLevels.js +++ b/modules/UI/audio_levels/AudioLevels.js @@ -17,9 +17,9 @@ const AudioLevels = { * @param {number} opacity the opacity to set for the specified dot. */ _setDotLevel(elementID, index, opacity) { - - let audioSpan = document.getElementById(elementID) - .getElementsByClassName("audioindicator"); + let audioSpan + = document.getElementById(elementID) + .getElementsByClassName("audioindicator"); // Make sure the audio span is still around. if (audioSpan && audioSpan.length > 0) @@ -72,17 +72,17 @@ const AudioLevels = { /** * Updates the large video shadow effect. */ - _updateLargeVideoShadow (level) { - var scale = 2, + _updateLargeVideoShadow(level) { + const scale = 2; // Internal circle audio level. - int = { + const int = { level: level > 0.15 ? 20 : 0, color: interfaceConfig.AUDIO_LEVEL_PRIMARY_COLOR - }, + }; // External circle audio level. - ext = { + const ext = { level: (int.level * scale * level + int.level).toFixed(0), color: interfaceConfig.AUDIO_LEVEL_SECONDARY_COLOR }; diff --git a/modules/UI/authentication/AuthHandler.js b/modules/UI/authentication/AuthHandler.js index 6510a58f38..6c029858a0 100644 --- a/modules/UI/authentication/AuthHandler.js +++ b/modules/UI/authentication/AuthHandler.js @@ -111,8 +111,7 @@ function initJWTTokenListener(room) { logger.error( "Authentication failed: ", err, errCode); unregister(); - } - ); + }); }).catch(function (error, code) { unregister(); connection.disconnect(); diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index 7ff0cceeec..8b5da33922 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -90,14 +90,15 @@ export default class SharedVideoManager { } if(APP.conference.isLocalId(this.from)) { - showStopVideoPropmpt().then(() => { + showStopVideoPropmpt().then( + () => { // make sure we stop updates for playing before we send stop // if we stop it after receiving self presence, we can end // up sending stop playing, and on the other end it will not // stop - if(this.intervalId) { - clearInterval(this.intervalId); - this.intervalId = null; + if (this.intervalId) { + clearInterval(this.intervalId); + this.intervalId = null; } this.emitter.emit( UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop'); @@ -472,7 +473,7 @@ export default class SharedVideoManager { this.emitter.emit( UIEvents.UPDATE_SHARED_VIDEO, null, 'removed'); - }); + }); APP.store.dispatch(participantLeft(this.url)); diff --git a/modules/UI/side_pannels/chat/Replacement.js b/modules/UI/side_pannels/chat/Replacement.js index d87d7fac96..544b5191ae 100644 --- a/modules/UI/side_pannels/chat/Replacement.js +++ b/modules/UI/side_pannels/chat/Replacement.js @@ -21,6 +21,8 @@ export function processReplacements(body) { export function linkify(inputText) { var replacedText, replacePattern1, replacePattern2, replacePattern3; + /* eslint-disable no-useless-escape */ + //URLs starting with http://, https://, or ftp:// replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim; replacedText = inputText.replace(replacePattern1, '$1'); @@ -33,6 +35,8 @@ export function linkify(inputText) { replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim; replacedText = replacedText.replace(replacePattern3, '$1'); + /* eslint-enable no-useless-escape */ + return replacedText; } diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js index 0392d6f01e..ae33c38344 100644 --- a/modules/UI/util/MessageHandler.js +++ b/modules/UI/util/MessageHandler.js @@ -120,23 +120,22 @@ var messageHandler = { * the prompt is closed (optional) * @return the prompt that was created, or null */ - openMessageDialog: - function(titleKey, messageKey, i18nOptions, closeFunction) { + openMessageDialog(titleKey, messageKey, i18nOptions, closeFunction) { if (!popupEnabled) return null; let dialog = $.prompt( APP.translation.generateTranslationHTML(messageKey, i18nOptions), { - title: this._getFormattedTitleString(titleKey), - persistent: false, - promptspeed: 0, - classes: this._getDialogClasses(), - close: function (e, v, m, f) { - if(closeFunction) - closeFunction(e, v, m, f); - } - }); + title: this._getFormattedTitleString(titleKey), + persistent: false, + promptspeed: 0, + classes: this._getDialogClasses(), + close(e, v, m, f) { + if(closeFunction) + closeFunction(e, v, m, f); + } + }); APP.translation.translateElement(dialog, i18nOptions); return $.prompt.getApi(); }, @@ -271,8 +270,15 @@ var messageHandler = { * @param {string} dontShowAgain.localStorageKey the key for the local * storage. if not provided dontShowAgain.id will be used. */ - openDialog: function (titleKey, msgString, persistent, buttons, - submitFunction, loadedFunction, closeFunction, dontShowAgain) { + openDialog( + titleKey, + msgString, + persistent, + buttons, + submitFunction, + loadedFunction, + closeFunction, + dontShowAgain) { if (!popupEnabled) return; @@ -448,8 +454,13 @@ var messageHandler = { * @param messageArguments object with the arguments for the message. * @param optional configurations for the notification (e.g. timeout) */ - participantNotification: function(displayName, displayNameKey, cls, - messageKey, messageArguments, timeout = 2500) { + participantNotification( + displayName, + displayNameKey, + cls, + messageKey, + messageArguments, + timeout = 2500) { APP.store.dispatch( showNotification( Notification, diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js index b7ed9771c6..c347af1f4e 100644 --- a/modules/UI/util/UIUtil.js +++ b/modules/UI/util/UIUtil.js @@ -31,7 +31,7 @@ const IndicatorFontSizes = { /** * Created by hristo on 12/22/14. */ - var UIUtil = { +var UIUtil = { /** * Returns the available video width. @@ -208,7 +208,7 @@ const IndicatorFontSizes = { }, redirect(url) { - window.location.href = url; + window.location.href = url; }, /** @@ -262,11 +262,10 @@ const IndicatorFontSizes = { * @param {Object} attrs object with properties * @returns {String} string of html element attributes */ - attrsToString(attrs) { - return Object.keys(attrs).map( - key => ` ${key}="${attrs[key]}"` - ).join(' '); - }, + attrsToString(attrs) { + return ( + Object.keys(attrs).map(key => ` ${key}="${attrs[key]}"`).join(' ')); + }, /** * Checks if the given DOM element is currently visible. The offsetParent @@ -299,11 +298,12 @@ const IndicatorFontSizes = { if (hideDelay && hideDelay > 0) setTimeout( - function () { - selector.fadeOut(300, - () => {selector.css({opacity: 0});} - ); - }, hideDelay); + () => { + selector.fadeOut( + 300, + () => { selector.css({opacity: 0}); }); + }, + hideDelay); } else { selector.fadeOut(300, diff --git a/modules/UI/videolayout/Filmstrip.js b/modules/UI/videolayout/Filmstrip.js index d165761183..c5d5ae55bf 100644 --- a/modules/UI/videolayout/Filmstrip.js +++ b/modules/UI/videolayout/Filmstrip.js @@ -249,18 +249,18 @@ const Filmstrip = { if(thumbs.localThumb) { availableWidth = Math.floor( (videoAreaAvailableWidth - ( - UIUtil.parseCssInt( - localVideoContainer.css('borderLeftWidth'), 10) - + UIUtil.parseCssInt( - localVideoContainer.css('borderRightWidth'), 10) - + UIUtil.parseCssInt( - localVideoContainer.css('paddingLeft'), 10) - + UIUtil.parseCssInt( - localVideoContainer.css('paddingRight'), 10) - + UIUtil.parseCssInt( - localVideoContainer.css('marginLeft'), 10) - + UIUtil.parseCssInt( - localVideoContainer.css('marginRight'), 10))) + UIUtil.parseCssInt( + localVideoContainer.css('borderLeftWidth'), 10) + + UIUtil.parseCssInt( + localVideoContainer.css('borderRightWidth'), 10) + + UIUtil.parseCssInt( + localVideoContainer.css('paddingLeft'), 10) + + UIUtil.parseCssInt( + localVideoContainer.css('paddingRight'), 10) + + UIUtil.parseCssInt( + localVideoContainer.css('marginLeft'), 10) + + UIUtil.parseCssInt( + localVideoContainer.css('marginRight'), 10))) ); } @@ -271,18 +271,18 @@ const Filmstrip = { let remoteVideoContainer = thumbs.remoteThumbs.eq(0); availableWidth = Math.floor( (videoAreaAvailableWidth - numvids * ( - UIUtil.parseCssInt( - remoteVideoContainer.css('borderLeftWidth'), 10) - + UIUtil.parseCssInt( - remoteVideoContainer.css('borderRightWidth'), 10) - + UIUtil.parseCssInt( - remoteVideoContainer.css('paddingLeft'), 10) - + UIUtil.parseCssInt( - remoteVideoContainer.css('paddingRight'), 10) - + UIUtil.parseCssInt( - remoteVideoContainer.css('marginLeft'), 10) - + UIUtil.parseCssInt( - remoteVideoContainer.css('marginRight'), 10))) + UIUtil.parseCssInt( + remoteVideoContainer.css('borderLeftWidth'), 10) + + UIUtil.parseCssInt( + remoteVideoContainer.css('borderRightWidth'), 10) + + UIUtil.parseCssInt( + remoteVideoContainer.css('paddingLeft'), 10) + + UIUtil.parseCssInt( + remoteVideoContainer.css('paddingRight'), 10) + + UIUtil.parseCssInt( + remoteVideoContainer.css('marginLeft'), 10) + + UIUtil.parseCssInt( + remoteVideoContainer.css('marginRight'), 10))) ); } diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js index b0a09178c5..958cc60787 100644 --- a/modules/UI/videolayout/LargeVideoManager.js +++ b/modules/UI/videolayout/LargeVideoManager.js @@ -293,9 +293,10 @@ export default class LargeVideoManager { * * @private */ - updateParticipantConnStatusIndication ( - id, showProblemsIndication, messageKey) { - + updateParticipantConnStatusIndication( + id, + showProblemsIndication, + messageKey) { // Apply grey filter on the large video this.videoContainer.showRemoteConnectionProblemIndicator( showProblemsIndication); diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index d83ebebb86..fe74139065 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -290,8 +290,7 @@ RemoteVideo.prototype._setAudioVolume = function (newVal) { * @param isMuted the new muted state to update to */ RemoteVideo.prototype.updateRemoteVideoMenu = function ( - isMuted = this.isAudioMuted -) { + isMuted = this.isAudioMuted) { this.isAudioMuted = isMuted; this._generatePopupContent(); diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index aa7e6bc201..d944cd3b19 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -332,11 +332,10 @@ SmallVideo.prototype.updateStatusBar = function () { ? : null } - { this._isModerator - && !interfaceConfig.DISABLE_FOCUS_INDICATOR - ? - : null } + { this._isModerator && !interfaceConfig.DISABLE_FOCUS_INDICATOR + ? + : null } , statusBarContainer); diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.js index 021cd28db7..0b25b8ec7e 100644 --- a/modules/UI/videolayout/VideoContainer.js +++ b/modules/UI/videolayout/VideoContainer.js @@ -23,11 +23,11 @@ const logger = require('jitsi-meet-logger').getLogger(__filename); * @param videoSpaceHeight the height of the available space * @return an array with 2 elements, the video width and the video height */ -function computeDesktopVideoSize(videoWidth, - videoHeight, - videoSpaceWidth, - videoSpaceHeight) { - +function computeDesktopVideoSize( + videoWidth, + videoHeight, + videoSpaceWidth, + videoSpaceHeight) { let aspectRatio = videoWidth / videoHeight; let availableWidth = Math.max(videoWidth, videoSpaceWidth); @@ -60,11 +60,12 @@ function computeDesktopVideoSize(videoWidth, * @param videoSpaceHeight the height of the video space * @return an array with 2 elements, the video width and the video height */ -function computeCameraVideoSize(videoWidth, - videoHeight, - videoSpaceWidth, - videoSpaceHeight, - videoLayoutFit) { +function computeCameraVideoSize( + videoWidth, + videoHeight, + videoSpaceWidth, + videoSpaceHeight, + videoLayoutFit) { const aspectRatio = videoWidth / videoHeight; switch (videoLayoutFit) { case 'height': @@ -110,10 +111,11 @@ function computeCameraVideoSize(videoWidth, * @return an array with 2 elements, the horizontal indent and the vertical * indent */ -function getCameraVideoPosition(videoWidth, - videoHeight, - videoSpaceWidth, - videoSpaceHeight) { +function getCameraVideoPosition( + videoWidth, + videoHeight, + videoSpaceWidth, + videoSpaceHeight) { // Parent height isn't completely calculated when we position the video in // full screen mode and this is why we use the screen height in this case. // Need to think it further at some point and implement it properly. diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 9439e3b7f3..476418c2c8 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -602,9 +602,10 @@ var VideoLayout = { /** * Resizes thumbnails. */ - resizeThumbnails ( animate = false, - forceUpdate = false, - onComplete = null) { + resizeThumbnails( + animate = false, + forceUpdate = false, + onComplete = null) { const { localVideo, remoteVideo } = Filmstrip.calculateThumbnailSize(); @@ -870,10 +871,10 @@ var VideoLayout = { * @param completeFunction a function to be called when the video area is * resized. */ - resizeVideoArea (forceUpdate = false, - animate = false, - completeFunction = null) { - + resizeVideoArea( + forceUpdate = false, + animate = false, + completeFunction = null) { if (largeVideo) { largeVideo.updateContainerSize(); largeVideo.resize(animate); diff --git a/modules/devices/mediaDeviceHelper.js b/modules/devices/mediaDeviceHelper.js index 1c83bbef57..d5225d1b45 100644 --- a/modules/devices/mediaDeviceHelper.js +++ b/modules/devices/mediaDeviceHelper.js @@ -156,7 +156,10 @@ export default { * }} */ getNewMediaDevicesAfterDeviceListChanged( - newDevices, isSharingScreen, localVideo, localAudio) { + newDevices, + isSharingScreen, + localVideo, + localAudio) { return { audioinput: getNewAudioInputDevice(newDevices, localAudio), videoinput: !isSharingScreen && @@ -173,7 +176,9 @@ export default { * @returns {Promise.} */ createLocalTracksAfterDeviceListChanged( - createLocalTracks, cameraDeviceId, micDeviceId) { + createLocalTracks, + cameraDeviceId, + micDeviceId) { let audioTrackError; let videoTrackError; let audioRequested = !!micDeviceId; @@ -181,27 +186,28 @@ export default { if (audioRequested && videoRequested) { // First we try to create both audio and video tracks together. - return createLocalTracks({ - devices: ['audio', 'video'], - cameraDeviceId: cameraDeviceId, - micDeviceId: micDeviceId - }) - // If we fail to do this, try to create them separately. - .catch(() => Promise.all([ - createAudioTrack(false).then(([stream]) => stream), - createVideoTrack(false).then(([stream]) => stream) - ])) - .then(tracks => { - if (audioTrackError) { - APP.UI.showMicErrorNotification(audioTrackError); - } + return ( + createLocalTracks({ + devices: ['audio', 'video'], + cameraDeviceId: cameraDeviceId, + micDeviceId: micDeviceId + }) + // If we fail to do this, try to create them separately. + .catch(() => Promise.all([ + createAudioTrack(false).then(([stream]) => stream), + createVideoTrack(false).then(([stream]) => stream) + ])) + .then(tracks => { + if (audioTrackError) { + APP.UI.showMicErrorNotification(audioTrackError); + } - if (videoTrackError) { - APP.UI.showCameraErrorNotification(videoTrackError); - } + if (videoTrackError) { + APP.UI.showCameraErrorNotification(videoTrackError); + } - return tracks.filter(t => typeof t !== 'undefined'); - }); + return tracks.filter(t => typeof t !== 'undefined'); + })); } else if (videoRequested && !audioRequested) { return createVideoTrack(); } else if (audioRequested && !videoRequested) { @@ -211,7 +217,8 @@ export default { } function createAudioTrack(showError) { - return createLocalTracks({ + return ( + createLocalTracks({ devices: ['audio'], cameraDeviceId: null, micDeviceId: micDeviceId @@ -220,11 +227,12 @@ export default { audioTrackError = err; showError && APP.UI.showMicErrorNotification(err); return []; - }); + })); } function createVideoTrack(showError) { - return createLocalTracks({ + return ( + createLocalTracks({ devices: ['video'], cameraDeviceId: cameraDeviceId, micDeviceId: null @@ -233,7 +241,7 @@ export default { videoTrackError = err; showError && APP.UI.showCameraErrorNotification(err); return []; - }); + })); } } }; diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js index 649787f544..dc9922707d 100644 --- a/modules/keyboardshortcut/keyboardshortcut.js +++ b/modules/keyboardshortcut/keyboardshortcut.js @@ -144,10 +144,11 @@ const KeyboardShortcut = { * @param helpDescription the description of the shortcut that would appear * in the help menu */ - registerShortcut: function( shortcutChar, - shortcutAttr, - exec, - helpDescription) { + registerShortcut( + shortcutChar, + shortcutAttr, + exec, + helpDescription) { _shortcuts[shortcutChar] = { character: shortcutChar, shortcutAttr: shortcutAttr, @@ -199,9 +200,9 @@ const KeyboardShortcut = { if (typeof e.key === "string") { return e.key; } - if (e.type === "keypress" && ( - (e.which >= 32 && e.which <= 126) || - (e.which >= 160 && e.which <= 255) )) { + if (e.type === "keypress" + && ((e.which >= 32 && e.which <= 126) + || (e.which >= 160 && e.which <= 255) )) { return String.fromCharCode(e.which); } // try to fallback (0-9A-Za-z and QWERTY keyboard) diff --git a/modules/remotecontrol/Receiver.js b/modules/remotecontrol/Receiver.js index 3bbf20c57a..55e83a52d4 100644 --- a/modules/remotecontrol/Receiver.js +++ b/modules/remotecontrol/Receiver.js @@ -15,10 +15,7 @@ import { } from '../../service/remotecontrol/Constants'; import * as RemoteControlEvents from '../../service/remotecontrol/RemoteControlEvents'; -import { - Transport, - PostMessageTransportBackend - } from '../transport'; +import { Transport, PostMessageTransportBackend } from '../transport'; import RemoteControlParticipant from './RemoteControlParticipant'; diff --git a/package.json b/package.json index 1604590793..91aeb7eba2 100644 --- a/package.json +++ b/package.json @@ -72,13 +72,13 @@ "strophe": "1.2.4", "strophejs-plugins": "0.0.7", "styled-components": "1.3.0", - "url-polyfill": "github/url-polyfill", + "url-polyfill": "github:github/url-polyfill", "uuid": "3.1.0", "xmldom": "0.1.27" }, "devDependencies": { "babel-core": "6.26.0", - "babel-eslint": "7.2.3", + "babel-eslint": "8.0.1", "babel-loader": "7.1.2", "babel-polyfill": "6.26.0", "babel-preset-es2015": "6.24.1", @@ -86,12 +86,12 @@ "babel-preset-stage-1": "6.24.1", "clean-css": "3.4.25", "css-loader": "0.28.5", - "eslint": "3.19.0", + "eslint": "4.8.0", "eslint-plugin-flowtype": "2.30.4", "eslint-plugin-import": "2.7.0", - "eslint-plugin-jsdoc": "3.1.2", - "eslint-plugin-react": "6.10.3", - "eslint-plugin-react-native": "3.0.1", + "eslint-plugin-jsdoc": "3.1.3", + "eslint-plugin-react": "7.4.0", + "eslint-plugin-react-native": "3.1.0", "expose-loader": "0.7.3", "file-loader": "0.11.2", "flow-bin": "0.38.0", @@ -109,7 +109,7 @@ }, "license": "Apache-2.0", "scripts": { - "lint": "jshint . && eslint . && flow", + "lint": "eslint . && flow", "validate": "npm ls" }, "pre-commit": [ diff --git a/react/.eslintrc.js b/react/.eslintrc.js index f298895f11..3efcc52b85 100644 --- a/react/.eslintrc.js +++ b/react/.eslintrc.js @@ -185,7 +185,6 @@ module.exports = { 'id-blacklist': 0, 'id-length': 0, 'id-match': 0, - 'indent': [ 'error', 4, { 'SwitchCase': 0 } ], 'jsx-quotes': [ 'error', 'prefer-single' ], 'key-spacing': 2, 'keyword-spacing': 2, @@ -387,7 +386,12 @@ module.exports = { 'react/jsx-no-undef': 2, 'react/jsx-pascal-case': 2, 'react/jsx-sort-props': 2, - 'react/jsx-space-before-closing': 2, + 'react/jsx-tag-spacing': [ + 'error', + { + 'beforeSelfClosing': 'always' + } + ], 'react/jsx-uses-react': 2, 'react/jsx-uses-vars': 2, 'react/jsx-wrap-multilines': 2, diff --git a/react/features/app/actions.js b/react/features/app/actions.js index fcd995c1c0..77f94ed39d 100644 --- a/react/features/app/actions.js +++ b/react/features/app/actions.js @@ -1,3 +1,5 @@ +/* @flow */ + import { setRoom } from '../base/conference'; import { loadConfigError, setConfig } from '../base/config'; import { setLocationURL } from '../base/connection'; @@ -132,7 +134,7 @@ function _appNavigateToOptionalLocation( * app: App * }} */ -export function appWillMount(app) { +export function appWillMount(app: Object) { return (dispatch: Dispatch<*>) => { dispatch({ type: APP_WILL_MOUNT, @@ -159,7 +161,7 @@ export function appWillMount(app) { * app: App * }} */ -export function appWillUnmount(app) { +export function appWillUnmount(app: Object) { return { type: APP_WILL_UNMOUNT, app diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index f5f9b1ee01..a1b94911df 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -256,7 +256,7 @@ export function conferenceWillLeave(conference) { * @returns {Function} */ export function createConference() { - return (dispatch, getState) => { + return (dispatch: Dispatch<*>, getState: Function) => { const state = getState(); const { connection, locationURL } = state['features/base/connection']; @@ -297,7 +297,7 @@ export function createConference() { * @returns {Function} */ export function checkIfCanJoin() { - return (dispatch, getState) => { + return (dispatch: Dispatch<*>, getState: Function) => { const { authRequired, password } = getState()['features/base/conference']; @@ -412,8 +412,8 @@ export function setLastN(lastN: ?number) { * is to be joined or locked. * @returns {Function} */ -export function setPassword(conference, method, password) { - return (dispatch, getState) => { +export function setPassword(conference, method: Function, password: string) { + return (dispatch: Dispatch<*>, getState: Function) => { switch (method) { case conference.join: { let state = getState()['features/base/conference']; @@ -478,7 +478,7 @@ export function setPassword(conference, method, password) { * receiveVideoQuality: number * }} */ -export function setReceiveVideoQuality(receiveVideoQuality) { +export function setReceiveVideoQuality(receiveVideoQuality: number) { return { type: SET_RECEIVE_VIDEO_QUALITY, receiveVideoQuality @@ -495,7 +495,7 @@ export function setReceiveVideoQuality(receiveVideoQuality) { * room: string * }} */ -export function setRoom(room) { +export function setRoom(room: ?string) { return { type: SET_ROOM, room diff --git a/react/features/base/config/reducer.js b/react/features/base/config/reducer.js index b54556b0a4..82a10026b1 100644 --- a/react/features/base/config/reducer.js +++ b/react/features/base/config/reducer.js @@ -129,6 +129,8 @@ function _translateLegacyConfig(oldValue: Object) { newValue = set(newValue, 'p2p', {}); } + /* eslint-disable indent */ + // Translate the old config properties into the new config.p2p properties. for (const [ oldKey, newKey ] of [ @@ -136,6 +138,9 @@ function _translateLegacyConfig(oldValue: Object) { [ 'enableP2P', 'enabled' ], [ 'p2pStunServers', 'stunServers' ] ]) { + + /* eslint-enable indent */ + if (oldKey in newValue) { const v = newValue[oldKey]; diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.js index 88b825cc59..0c2fbe06aa 100644 --- a/react/features/base/connection/reducer.js +++ b/react/features/base/connection/reducer.js @@ -158,8 +158,8 @@ function _constructOptions(locationURL: URL) { return { bosh: - `${String(protocol)}//${domain}${locationURI.contextRoot || '/' - }http-bind`, + `${String(protocol)}//${domain}${ + locationURI.contextRoot || '/'}http-bind`, hosts: { domain, diff --git a/react/features/base/i18n/i18next.js b/react/features/base/i18n/i18next.js index bf86eedd37..07ea8eca20 100644 --- a/react/features/base/i18n/i18next.js +++ b/react/features/base/i18n/i18next.js @@ -1,3 +1,5 @@ +/* @flow */ + import i18next from 'i18next'; import I18nextXHRBackend from 'i18next-xhr-backend'; diff --git a/react/features/base/lib-jitsi-meet/actions.js b/react/features/base/lib-jitsi-meet/actions.js index 39a3d77fcb..4bb0a23762 100644 --- a/react/features/base/lib-jitsi-meet/actions.js +++ b/react/features/base/lib-jitsi-meet/actions.js @@ -1,3 +1,5 @@ +/* @flow */ + import type { Dispatch } from 'redux'; import JitsiMeetJS from './_'; @@ -95,7 +97,7 @@ export function libInitError(error: Error) { * @returns {Function} */ export function setWebRTCReady(webRTCReady: boolean | Promise<*>) { - return (dispatch: Dispatch<*>, getState: Function) => { + return (dispatch: Function, getState: Function) => { if (getState()['features/base/lib-jitsi-meet'].webRTCReady !== webRTCReady) { dispatch({ diff --git a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js b/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js index 3e0be5bd8f..1467c078ab 100644 --- a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js +++ b/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js @@ -18,7 +18,7 @@ import { RTCPeerConnection, RTCSessionDescription } from 'react-native-webrtc'; */ export default function _RTCPeerConnection(...args) { - /* eslint-disable no-invalid-this */ + /* eslint-disable indent, no-invalid-this */ RTCPeerConnection.apply(this, args); @@ -44,7 +44,7 @@ export default function _RTCPeerConnection(...args) { } }); - /* eslint-enable no-invalid-this */ + /* eslint-enable indent, no-invalid-this */ } _RTCPeerConnection.prototype = Object.create(RTCPeerConnection.prototype); diff --git a/react/features/base/media/components/AbstractAudio.js b/react/features/base/media/components/AbstractAudio.js index 81d9b430bc..da524e5e44 100644 --- a/react/features/base/media/components/AbstractAudio.js +++ b/react/features/base/media/components/AbstractAudio.js @@ -10,7 +10,9 @@ export default class AbstractAudio extends Component { * The (reference to the) {@link ReactElement} which actually implements * this {@code AbstractAudio}. */ - _ref: ?Object + _ref: ?Object; + + _setRef: Function; /** * {@code AbstractAudio} component's property types. @@ -33,7 +35,7 @@ export default class AbstractAudio extends Component { * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ - constructor(props) { + constructor(props: Object) { super(props); // Bind event handlers so they are only bound once for every instance. diff --git a/react/features/base/participants/components/Avatar.native.js b/react/features/base/participants/components/Avatar.native.js index 78776f6990..42a343ddde 100644 --- a/react/features/base/participants/components/Avatar.native.js +++ b/react/features/base/participants/components/Avatar.native.js @@ -95,6 +95,7 @@ export default class Avatar extends Component { }; if (assignState) { + // eslint-disable-next-line react/no-direct-mutation-state this.state = nextState; } else { this.setState(nextState); @@ -134,6 +135,7 @@ export default class Avatar extends Component { observer, /* immutable */ true); } else if (assignState) { + // eslint-disable-next-line react/no-direct-mutation-state this.state = { ...this.state, source: nextSource @@ -185,7 +187,7 @@ export default class Avatar extends Component { for (let i = 0; i < uri.length; i++) { hash = uri.charCodeAt(i) + ((hash << 5) - hash); - hash |= 0; // Convert to 32-bit integer + hash |= 0; // Convert to 32-bit integer } /* eslint-enable no-bitwise */ diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js index af6f59fca6..5e99724011 100644 --- a/react/features/base/participants/middleware.js +++ b/react/features/base/participants/middleware.js @@ -1,3 +1,5 @@ +/* @flow */ + import UIEvents from '../../../../service/UI/UIEvents'; import { diff --git a/react/features/base/react/components/web/InlineDialogFailure.js b/react/features/base/react/components/web/InlineDialogFailure.js index e91be56ae9..717de872c7 100644 --- a/react/features/base/react/components/web/InlineDialogFailure.js +++ b/react/features/base/react/components/web/InlineDialogFailure.js @@ -1,3 +1,5 @@ +/* @flow */ + import AKButton from '@atlaskit/button'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; diff --git a/react/features/base/react/components/web/Watermarks.js b/react/features/base/react/components/web/Watermarks.js index 6c74c538b5..e38e293d93 100644 --- a/react/features/base/react/components/web/Watermarks.js +++ b/react/features/base/react/components/web/Watermarks.js @@ -1,5 +1,6 @@ /* @flow */ +import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; @@ -21,6 +22,11 @@ const _RIGHT_WATERMARK_STYLE = { * etc. */ class Watermarks extends Component { + static propTypes = { + _isGuest: PropTypes.bool, + t: PropTypes.func + }; + state = { brandWatermarkLink: String, jitsiWatermarkLink: String, diff --git a/react/features/conference/components/Conference.native.js b/react/features/conference/components/Conference.native.js index c25eb76b2d..b6a7286b6b 100644 --- a/react/features/conference/components/Conference.native.js +++ b/react/features/conference/components/Conference.native.js @@ -203,10 +203,10 @@ class Conference extends Component { * The activity/loading indicator goes above everything, except * the toolbox/toolbars and the dialogs. */ - this.props._connecting - && - - + this.props._connecting + && + + } {/* diff --git a/react/features/connection-stats/components/ConnectionStatsTable.js b/react/features/connection-stats/components/ConnectionStatsTable.js index 28de4ce37d..6279f8233f 100644 --- a/react/features/connection-stats/components/ConnectionStatsTable.js +++ b/react/features/connection-stats/components/ConnectionStatsTable.js @@ -311,8 +311,8 @@ class ConnectionStatsTable extends Component { _renderShowMoreLink() { const translationKey = this.props.shouldShowMore - ? 'connectionindicator.less' - : 'connectionindicator.more'; + ? 'connectionindicator.less' + : 'connectionindicator.more'; return ( + + // eslint-disable-next-line react/jsx-wrap-multilines ; } diff --git a/react/features/feedback/components/FeedbackButton.web.js b/react/features/feedback/components/FeedbackButton.web.js index de8a286f4b..fd770519cf 100644 --- a/react/features/feedback/components/FeedbackButton.web.js +++ b/react/features/feedback/components/FeedbackButton.web.js @@ -23,6 +23,8 @@ class FeedbackButton extends Component { */ _conference: PropTypes.object, + dispatch: PropTypes.func, + /** * Invoked to obtain translated strings. */ diff --git a/react/features/feedback/components/FeedbackDialog.web.js b/react/features/feedback/components/FeedbackDialog.web.js index 98ea4a7bd4..bfa343fbaa 100644 --- a/react/features/feedback/components/FeedbackDialog.web.js +++ b/react/features/feedback/components/FeedbackDialog.web.js @@ -12,8 +12,8 @@ import { cancelFeedback, submitFeedback } from '../actions'; declare var interfaceConfig: Object; -const scoreAnimationClass = interfaceConfig.ENABLE_FEEDBACK_ANIMATION - ? 'shake-rotate' : ''; +const scoreAnimationClass + = interfaceConfig.ENABLE_FEEDBACK_ANIMATION ? 'shake-rotate' : ''; /** * The scores to display for selecting. The score is the index in the array and diff --git a/react/features/filmstrip/components/Filmstrip.native.js b/react/features/filmstrip/components/Filmstrip.native.js index cbeea9ee5d..3d8ded344f 100644 --- a/react/features/filmstrip/components/Filmstrip.native.js +++ b/react/features/filmstrip/components/Filmstrip.native.js @@ -53,19 +53,22 @@ class Filmstrip extends Component { visible = { this.props._visible }> { + + /* eslint-disable react/jsx-wrap-multilines */ + this._sort(this.props._participants) .map(p => ) + + /* eslint-enable react/jsx-wrap-multilines */ } diff --git a/react/features/filmstrip/functions.js b/react/features/filmstrip/functions.js index 5dd00fc1cc..542c31e446 100644 --- a/react/features/filmstrip/functions.js +++ b/react/features/filmstrip/functions.js @@ -1,3 +1,5 @@ +/* @flow */ + declare var interfaceConfig: Object; import { @@ -12,7 +14,7 @@ import { * @param {Object} state - The full redux state. * @returns {boolean} - True if remote video thumbnails should be displayed. */ -export function shouldRemoteVideosBeVisible(state) { +export function shouldRemoteVideosBeVisible(state: Object) { const participants = state['features/base/participants']; const participantsCount = participants.length; diff --git a/react/features/invite/components/AddPeopleDialog.web.js b/react/features/invite/components/AddPeopleDialog.web.js index ea3ffc5d5d..11312c962e 100644 --- a/react/features/invite/components/AddPeopleDialog.web.js +++ b/react/features/invite/components/AddPeopleDialog.web.js @@ -334,7 +334,7 @@ function _mapStateToProps(state) { inviteServiceUrl, peopleSearchQueryTypes, peopleSearchUrl - } = state['features/base/config']; + } = state['features/base/config']; return { _conference: conference, diff --git a/react/features/invite/functions.js b/react/features/invite/functions.js index 80ae96fc93..6637dc4594 100644 --- a/react/features/invite/functions.js +++ b/react/features/invite/functions.js @@ -10,12 +10,11 @@ declare var $: Function; * executed - "conferenceRooms" | "user" | "room". * @returns {Promise} - The promise created by the request. */ -export function searchPeople(// eslint-disable-line max-params - serviceUrl, - jwt, - text, - queryTypes = [ 'conferenceRooms', 'user', 'room' ] -) { +export function searchPeople( // eslint-disable-line max-params + serviceUrl, + jwt, + text, + queryTypes = [ 'conferenceRooms', 'user', 'room' ]) { const queryTypesString = JSON.stringify(queryTypes); return new Promise((resolve, reject) => { diff --git a/react/features/mobile/background/actions.js b/react/features/mobile/background/actions.js index 50029f2354..616adc6a4c 100644 --- a/react/features/mobile/background/actions.js +++ b/react/features/mobile/background/actions.js @@ -1,3 +1,5 @@ +/* @flow */ + import { setLastN } from '../../base/conference'; import { setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../../base/media'; @@ -31,7 +33,7 @@ export function _setAppStateListener(listener: ?Function) { * @returns {Function} */ export function _setBackgroundVideoMuted(muted: boolean) { - return (dispatch, getState) => { + return (dispatch: Dispatch<*>, getState: Function) => { // Disable remote video when we mute by setting lastN to 0. Skip it if // the conference is in audio-only mode, as it's already configured to // have no video. Leave it as undefined when unmuting, the default value diff --git a/react/features/mobile/background/middleware.js b/react/features/mobile/background/middleware.js index 79cf0c0e21..3af31adaa5 100644 --- a/react/features/mobile/background/middleware.js +++ b/react/features/mobile/background/middleware.js @@ -74,7 +74,7 @@ MiddlewareRegistry.register(store => next => action => { * @private * @returns {void} */ -function _appStateChanged(dispatch: Dispatch<*>, appState: string) { +function _appStateChanged(dispatch: Function, appState: string) { let muted; switch (appState) { diff --git a/react/features/mobile/permissions/middleware.js b/react/features/mobile/permissions/middleware.js index 02674d9f4a..478122b32d 100644 --- a/react/features/mobile/permissions/middleware.js +++ b/react/features/mobile/permissions/middleware.js @@ -47,11 +47,18 @@ function _alertPermissionErrorWithSettings(trackType) { // TODO i18n const deviceType = trackType === 'video' ? 'Camera' : 'Microphone'; + /* eslint-disable indent */ + + const message + = `${deviceType + } permission is required to participate in conferences with ${ + trackType}. Please grant it in Settings.`; + + /* eslint-ensable indent */ + Alert.alert( 'Permission required', - `${deviceType - } permission is required to participate in conferences with ${ - trackType}. Please grant it in Settings.`, + message, [ { text: 'Cancel' }, { diff --git a/react/features/overlay/components/ReloadButton.js b/react/features/overlay/components/ReloadButton.js index e13b3377c0..13cfe597f5 100644 --- a/react/features/overlay/components/ReloadButton.js +++ b/react/features/overlay/components/ReloadButton.js @@ -1,3 +1,5 @@ +/* @flow */ + import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; diff --git a/react/features/remote-control/components/RemoteControlAuthorizationDialog.js b/react/features/remote-control/components/RemoteControlAuthorizationDialog.js index ca7ab7661f..a2682fae73 100644 --- a/react/features/remote-control/components/RemoteControlAuthorizationDialog.js +++ b/react/features/remote-control/components/RemoteControlAuthorizationDialog.js @@ -2,10 +2,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { - Dialog, - hideDialog -} from '../../base/dialog'; +import { Dialog, hideDialog } from '../../base/dialog'; import { translate } from '../../base/i18n'; import { getParticipantById } from '../../base/participants'; diff --git a/react/features/toolbox/components/Toolbar.web.js b/react/features/toolbox/components/Toolbar.web.js index 957c8ed13a..56a56e867e 100644 --- a/react/features/toolbox/components/Toolbar.web.js +++ b/react/features/toolbox/components/Toolbar.web.js @@ -123,8 +123,7 @@ class Toolbar extends Component { * @private * @returns {ReactElement} A toolbar button. */ - _renderToolbarButton( - keyValuePair: Array<*>): ReactElement<*> { + _renderToolbarButton(keyValuePair: Array<*>): ReactElement<*> { const [ key, button ] = keyValuePair; if (button.component) { diff --git a/react/features/welcome/components/LocalVideoTrackUnderlay.native.js b/react/features/welcome/components/LocalVideoTrackUnderlay.native.js index 5c064eb485..301156b5d2 100644 --- a/react/features/welcome/components/LocalVideoTrackUnderlay.native.js +++ b/react/features/welcome/components/LocalVideoTrackUnderlay.native.js @@ -72,6 +72,7 @@ class LocalVideoTrackUnderlay extends Component { }; if (assignState) { + // eslint-disable-next-line react/no-direct-mutation-state this.state = nextState; } else { this.setState(nextState); diff --git a/webpack.config.js b/webpack.config.js index 498d3f16f4..dd9b0acba9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -209,6 +209,8 @@ function devServerProxyBypass({ path }) { const configs = module.exports; + /* eslint-disable indent */ + if ((Array.isArray(configs) ? configs : Array(configs)).some(c => { if (path.startsWith(c.output.publicPath)) { if (!minimize) { @@ -231,4 +233,6 @@ function devServerProxyBypass({ path }) { })) { return path; } + + /* eslint-enable indent */ }