From 25ec8ac6a779efa55699b8255c5605616834c60f Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Wed, 14 Jun 2017 19:40:51 -0500 Subject: [PATCH] Prepare for eslint 4 --- modules/UI/side_pannels/chat/Chat.js | 2 +- react/features/app/functions.native.js | 8 +- react/features/base/conference/actions.js | 82 +++++++++---------- .../base/connection/actions.native.js | 24 +++--- react/features/base/connection/actions.web.js | 4 +- react/features/base/i18n/functions.js | 2 +- react/features/base/i18n/i18next.js | 20 ++--- react/features/base/i18n/middleware.js | 2 +- .../native/polyfills-browser.js | 12 +-- react/features/base/react/RouteRegistry.js | 6 +- .../components/Conference.native.js | 2 +- .../components/DeviceSelectionDialog.js | 2 +- .../components/DeviceSelectionDialogBase.js | 2 +- react/features/invite/middleware.js | 5 +- react/features/jwt/middleware.js | 6 +- react/features/large-video/actions.js | 12 +-- .../features/mobile/audio-mode/middleware.js | 3 +- .../features/mobile/background/middleware.js | 4 +- .../components/AbstractPageReloadOverlay.js | 42 +++++----- .../overlay/components/ReloadTimer.js | 31 ++++--- .../RemoteControlAuthorizationDialog.js | 11 ++- .../speaker-stats/components/SpeakerStats.js | 2 +- .../welcome/components/AbstractWelcomePage.js | 10 +-- 23 files changed, 148 insertions(+), 146 deletions(-) diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js index d2556fa66..6b1a643c7 100644 --- a/modules/UI/side_pannels/chat/Chat.js +++ b/modules/UI/side_pannels/chat/Chat.js @@ -304,7 +304,7 @@ var Chat = { $('#chatconversation').append( '
Error: ' + 'Your message' + - (originalText? (' \"'+ originalText + '\"') : "") + + (originalText? (` "${originalText}"`) : "") + ' was not sent.' + (errorMessage? (' Reason: ' + errorMessage) : '') + '
'); $('#chatconversation').animate( diff --git a/react/features/app/functions.native.js b/react/features/app/functions.native.js index 1eb7b6720..cbb4aacb8 100644 --- a/react/features/app/functions.native.js +++ b/react/features/app/functions.native.js @@ -44,16 +44,16 @@ function _fixURIStringHierPart(uri) { // hipchat.com let regex = new RegExp( - `^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`, - 'gi'); + `^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`, + 'gi'); let match = regex.exec(uri); if (!match) { // enso.me regex = new RegExp( - `^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`, - 'gi'); + `^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`, + 'gi'); match = regex.exec(uri); } if (match) { diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js index 1e1c29fcb..83fbd643d 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.js @@ -47,70 +47,70 @@ function _addConferenceListeners(conference, dispatch) { // Dispatches into features/base/conference follow: conference.on( - JitsiConferenceEvents.CONFERENCE_FAILED, - (...args) => dispatch(conferenceFailed(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_FAILED, + (...args) => dispatch(conferenceFailed(conference, ...args))); conference.on( - JitsiConferenceEvents.CONFERENCE_JOINED, - (...args) => dispatch(conferenceJoined(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_JOINED, + (...args) => dispatch(conferenceJoined(conference, ...args))); conference.on( - JitsiConferenceEvents.CONFERENCE_LEFT, - (...args) => dispatch(conferenceLeft(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_LEFT, + (...args) => dispatch(conferenceLeft(conference, ...args))); conference.on( - JitsiConferenceEvents.LOCK_STATE_CHANGED, - (...args) => dispatch(lockStateChanged(conference, ...args))); + JitsiConferenceEvents.LOCK_STATE_CHANGED, + (...args) => dispatch(lockStateChanged(conference, ...args))); // Dispatches into features/base/tracks follow: conference.on( - JitsiConferenceEvents.TRACK_ADDED, - t => t && !t.isLocal() && dispatch(trackAdded(t))); + JitsiConferenceEvents.TRACK_ADDED, + t => t && !t.isLocal() && dispatch(trackAdded(t))); conference.on( - JitsiConferenceEvents.TRACK_REMOVED, - t => t && !t.isLocal() && dispatch(trackRemoved(t))); + JitsiConferenceEvents.TRACK_REMOVED, + t => t && !t.isLocal() && dispatch(trackRemoved(t))); // Dispatches into features/base/participants follow: conference.on( - JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, - (...args) => dispatch(dominantSpeakerChanged(...args))); + JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, + (...args) => dispatch(dominantSpeakerChanged(...args))); conference.on( - JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, - (...args) => dispatch(participantConnectionStatusChanged(...args))); + JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, + (...args) => dispatch(participantConnectionStatusChanged(...args))); conference.on( - JitsiConferenceEvents.USER_JOINED, - (id, user) => dispatch(participantJoined({ - id, - name: user.getDisplayName(), - role: user.getRole() - }))); + JitsiConferenceEvents.USER_JOINED, + (id, user) => dispatch(participantJoined({ + id, + name: user.getDisplayName(), + role: user.getRole() + }))); conference.on( - JitsiConferenceEvents.USER_LEFT, - (...args) => dispatch(participantLeft(...args))); + JitsiConferenceEvents.USER_LEFT, + (...args) => dispatch(participantLeft(...args))); conference.on( - JitsiConferenceEvents.USER_ROLE_CHANGED, - (...args) => dispatch(participantRoleChanged(...args))); + JitsiConferenceEvents.USER_ROLE_CHANGED, + (...args) => dispatch(participantRoleChanged(...args))); conference.addCommandListener( - AVATAR_ID_COMMAND, - (data, id) => dispatch(participantUpdated({ - id, - avatarID: data.value - }))); + AVATAR_ID_COMMAND, + (data, id) => dispatch(participantUpdated({ + id, + avatarID: data.value + }))); conference.addCommandListener( - AVATAR_URL_COMMAND, - (data, id) => dispatch(participantUpdated({ - id, - avatarURL: data.value - }))); + AVATAR_URL_COMMAND, + (data, id) => dispatch(participantUpdated({ + id, + avatarURL: data.value + }))); conference.addCommandListener( - EMAIL_COMMAND, - (data, id) => dispatch(participantUpdated({ - id, - email: data.value - }))); + EMAIL_COMMAND, + (data, id) => dispatch(participantUpdated({ + id, + email: data.value + }))); } /** diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.js index 285b9f7ee..efa36dbcd 100644 --- a/react/features/base/connection/actions.native.js +++ b/react/features/base/connection/actions.native.js @@ -40,14 +40,14 @@ export function connect() { }); connection.addEventListener( - JitsiConnectionEvents.CONNECTION_DISCONNECTED, - _onConnectionDisconnected); + JitsiConnectionEvents.CONNECTION_DISCONNECTED, + _onConnectionDisconnected); connection.addEventListener( - JitsiConnectionEvents.CONNECTION_ESTABLISHED, - _onConnectionEstablished); + JitsiConnectionEvents.CONNECTION_ESTABLISHED, + _onConnectionEstablished); connection.addEventListener( - JitsiConnectionEvents.CONNECTION_FAILED, - _onConnectionFailed); + JitsiConnectionEvents.CONNECTION_FAILED, + _onConnectionFailed); connection.connect(); @@ -61,8 +61,8 @@ export function connect() { */ function _onConnectionDisconnected(message: string) { connection.removeEventListener( - JitsiConnectionEvents.CONNECTION_DISCONNECTED, - _onConnectionDisconnected); + JitsiConnectionEvents.CONNECTION_DISCONNECTED, + _onConnectionDisconnected); dispatch(_connectionDisconnected(connection, message)); } @@ -99,11 +99,11 @@ export function connect() { */ function unsubscribe() { connection.removeEventListener( - JitsiConnectionEvents.CONNECTION_ESTABLISHED, - _onConnectionEstablished); + JitsiConnectionEvents.CONNECTION_ESTABLISHED, + _onConnectionEstablished); connection.removeEventListener( - JitsiConnectionEvents.CONNECTION_FAILED, - _onConnectionFailed); + JitsiConnectionEvents.CONNECTION_FAILED, + _onConnectionFailed); } }; } diff --git a/react/features/base/connection/actions.web.js b/react/features/base/connection/actions.web.js index 422d9b573..2d4f953f0 100644 --- a/react/features/base/connection/actions.web.js +++ b/react/features/base/connection/actions.web.js @@ -67,8 +67,8 @@ export function connect() { APP.UI.initConference(); APP.UI.addListener( - UIEvents.LANG_CHANGED, - language => APP.translation.setLanguage(language)); + UIEvents.LANG_CHANGED, + language => APP.translation.setLanguage(language)); APP.keyboardshortcut.init(); diff --git a/react/features/base/i18n/functions.js b/react/features/base/i18n/functions.js index 8f9765b84..c69b0d780 100644 --- a/react/features/base/i18n/functions.js +++ b/react/features/base/i18n/functions.js @@ -12,7 +12,7 @@ export function translate(component) { // Use the default list of namespaces. return ( reactI18nextTranslate([ 'main', 'languages' ], { wait: true })( - component)); + component)); } /** diff --git a/react/features/base/i18n/i18next.js b/react/features/base/i18n/i18next.js index f1e571eb7..780949446 100644 --- a/react/features/base/i18n/i18next.js +++ b/react/features/base/i18n/i18next.js @@ -48,16 +48,16 @@ i18next // Add default language which is preloaded from the source code. i18next.addResourceBundle( - DEFAULT_LANGUAGE, - 'main', - MAIN_RESOURCES, - /* deep */ true, - /* overwrite */ true); + DEFAULT_LANGUAGE, + 'main', + MAIN_RESOURCES, + /* deep */ true, + /* overwrite */ true); i18next.addResourceBundle( - DEFAULT_LANGUAGE, - 'languages', - LANGUAGES_RESOURCES, - /* deep */ true, - /* overwrite */ true); + DEFAULT_LANGUAGE, + 'languages', + LANGUAGES_RESOURCES, + /* deep */ true, + /* overwrite */ true); export default i18next; diff --git a/react/features/base/i18n/middleware.js b/react/features/base/i18n/middleware.js index 349e90036..adf525725 100644 --- a/react/features/base/i18n/middleware.js +++ b/react/features/base/i18n/middleware.js @@ -35,7 +35,7 @@ MiddlewareRegistry.register(store => next => action => { * @returns {Object} The new state that is the result of the reduction of the * specified action. */ -function _setConfig({ dispatch, getState }, next, action) { +function _setConfig({ getState }, next, action) { const oldValue = getState()['features/base/config']; const result = next(action); const newValue = getState()['features/base/config']; diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js index a2a80d567..9bde778e1 100644 --- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js +++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js @@ -120,8 +120,8 @@ function _visitNode(node, callback) { if (typeof global.document === 'undefined') { const document = new DOMParser().parseFromString( - '', - 'text/xml'); + '', + 'text/xml'); // document.addEventListener // @@ -181,8 +181,8 @@ function _visitNode(node, callback) { // Parse the content string. const d = new DOMParser().parseFromString( - `
${innerHTML}
`, - 'text/xml'); + `
${innerHTML}
`, + 'text/xml'); // Assign the resulting nodes as children of the // element. @@ -353,8 +353,8 @@ function _visitNode(node, callback) { if (responseText) { responseXML = new DOMParser().parseFromString( - responseText, - 'text/xml'); + responseText, + 'text/xml'); } return responseXML; diff --git a/react/features/base/react/RouteRegistry.js b/react/features/base/react/RouteRegistry.js index 58d9b0c3a..b768027a4 100644 --- a/react/features/base/react/RouteRegistry.js +++ b/react/features/base/react/RouteRegistry.js @@ -76,7 +76,7 @@ class RouteRegistry { }); } -/* eslint-disable no-undef */ + /* eslint-disable no-undef */ /** * Returns registered route by name if any. @@ -87,7 +87,7 @@ class RouteRegistry { */ getRouteByComponent(component: Class>) { -/* eslint-enable no-undef */ + /* eslint-enable no-undef */ const route = this._elements.find(r => r.component === component); @@ -106,7 +106,7 @@ class RouteRegistry { register(route: Route) { if (this._elements.includes(route)) { throw new Error( - `Route ${String(route.component)} is registered already!`); + `Route ${String(route.component)} is registered already!`); } this._elements.push(route); diff --git a/react/features/conference/components/Conference.native.js b/react/features/conference/components/Conference.native.js index 0ac9c4e3e..6f2ff2f15 100644 --- a/react/features/conference/components/Conference.native.js +++ b/react/features/conference/components/Conference.native.js @@ -277,4 +277,4 @@ function _mapStateToProps(state) { } export default reactReduxConnect(_mapStateToProps, _mapDispatchToProps)( - Conference); + Conference); diff --git a/react/features/device-selection/components/DeviceSelectionDialog.js b/react/features/device-selection/components/DeviceSelectionDialog.js index c2e8ef30d..c393a2cea 100644 --- a/react/features/device-selection/components/DeviceSelectionDialog.js +++ b/react/features/device-selection/components/DeviceSelectionDialog.js @@ -22,7 +22,7 @@ class DeviceSelectionDialog extends Component { * @static */ static propTypes = { - /** + /** * All known audio and video devices split by type. This prop comes from * the app state. */ diff --git a/react/features/device-selection/components/DeviceSelectionDialogBase.js b/react/features/device-selection/components/DeviceSelectionDialogBase.js index 9994b58bf..91d6c6afa 100644 --- a/react/features/device-selection/components/DeviceSelectionDialogBase.js +++ b/react/features/device-selection/components/DeviceSelectionDialogBase.js @@ -21,7 +21,7 @@ class DeviceSelectionDialogBase extends Component { * @static */ static propTypes = { - /** + /** * All known audio and video devices split by type. This prop comes from * the app state. */ diff --git a/react/features/invite/middleware.js b/react/features/invite/middleware.js index 531f61efc..e6a29a348 100644 --- a/react/features/invite/middleware.js +++ b/react/features/invite/middleware.js @@ -16,8 +16,9 @@ MiddlewareRegistry.register(store => next => action => { switch (action.type) { case UPDATE_DIAL_IN_NUMBERS_FAILED: - logger.error('Error encountered while fetching dial-in numbers:', - action.error); + logger.error( + 'Error encountered while fetching dial-in numbers:', + action.error); break; } diff --git a/react/features/jwt/middleware.js b/react/features/jwt/middleware.js index c83822751..e719fdf86 100644 --- a/react/features/jwt/middleware.js +++ b/react/features/jwt/middleware.js @@ -100,9 +100,9 @@ function _maybeSetCallOverlayVisible({ dispatch, getState }, next, action) { callOverlayVisible = Boolean( - participants - && participants.length === 1 - && participants[0].local); + participants + && participants.length === 1 + && participants[0].local); // However, the CallDialog is not to be displayed/visible again // after all remote participants leave. diff --git a/react/features/large-video/actions.js b/react/features/large-video/actions.js index 22403f436..7301e5e84 100644 --- a/react/features/large-video/actions.js +++ b/react/features/large-video/actions.js @@ -24,15 +24,15 @@ export function selectParticipant() { const id = largeVideo.participantId; const videoTrack = getTrackByMediaTypeAndParticipant( - tracks, - MEDIA_TYPE.VIDEO, - id); + tracks, + MEDIA_TYPE.VIDEO, + id); try { conference.selectParticipant( - videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA - ? id - : null); + videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA + ? id + : null); } catch (err) { _handleParticipantError(err); } diff --git a/react/features/mobile/audio-mode/middleware.js b/react/features/mobile/audio-mode/middleware.js index 25a262fd7..ec9b59cf0 100644 --- a/react/features/mobile/audio-mode/middleware.js +++ b/react/features/mobile/audio-mode/middleware.js @@ -55,8 +55,7 @@ MiddlewareRegistry.register(store => next => action => { AudioMode.setMode(mode) .catch(err => console.error( - `Failed to set audio mode ${String(mode)}: ` - + `${err}`)); + `Failed to set audio mode ${String(mode)}: ${err}`)); } } diff --git a/react/features/mobile/background/middleware.js b/react/features/mobile/background/middleware.js index 19c40a128..79cf0c0e2 100644 --- a/react/features/mobile/background/middleware.js +++ b/react/features/mobile/background/middleware.js @@ -52,8 +52,8 @@ MiddlewareRegistry.register(store => next => action => { case APP_WILL_MOUNT: store.dispatch( - _setAppStateListener( - _onAppStateChange.bind(undefined, store.dispatch))); + _setAppStateListener( + _onAppStateChange.bind(undefined, store.dispatch))); break; case APP_WILL_UNMOUNT: diff --git a/react/features/overlay/components/AbstractPageReloadOverlay.js b/react/features/overlay/components/AbstractPageReloadOverlay.js index 9e00fa133..1e713c1de 100644 --- a/react/features/overlay/components/AbstractPageReloadOverlay.js +++ b/react/features/overlay/components/AbstractPageReloadOverlay.js @@ -133,34 +133,34 @@ export default class AbstractPageReloadOverlay extends Component { // sent to the backed. // FIXME: We should dispatch action for this. APP.conference.logEvent( - 'page.reload', - /* value */ undefined, - /* label */ this.props.reason); + 'page.reload', + /* value */ undefined, + /* label */ this.props.reason); logger.info( - `The conference will be reloaded after ${ - this.state.timeoutSeconds} seconds.`); + `The conference will be reloaded after ${ + this.state.timeoutSeconds} seconds.`); AJS.progressBars.update('#reloadProgressBar', 0); this._interval = setInterval( - () => { - if (this.state.timeLeft === 0) { - if (this._interval) { - clearInterval(this._interval); - this._interval = undefined; - } - - this.props.dispatch(_reloadNow()); - } else { - this.setState(prevState => { - return { - timeLeft: prevState.timeLeft - 1 - }; - }); + () => { + if (this.state.timeLeft === 0) { + if (this._interval) { + clearInterval(this._interval); + this._interval = undefined; } - }, - 1000); + + this.props.dispatch(_reloadNow()); + } else { + this.setState(prevState => { + return { + timeLeft: prevState.timeLeft - 1 + }; + }); + } + }, + 1000); } /** diff --git a/react/features/overlay/components/ReloadTimer.js b/react/features/overlay/components/ReloadTimer.js index 8b9240883..f8ca6b1ef 100644 --- a/react/features/overlay/components/ReloadTimer.js +++ b/react/features/overlay/components/ReloadTimer.js @@ -105,19 +105,19 @@ class ReloadTimer extends Component { const intervalId = setInterval( - () => { - if (this.state.current === this.props.end) { - clearInterval(intervalId); - this.props.onFinish(); - } else { - this.setState((prevState, props) => { - return { - current: prevState.current + props.step - }; - }); - } - }, - Math.abs(this.props.interval) * 1000); + () => { + if (this.state.current === this.props.end) { + clearInterval(intervalId); + this.props.onFinish(); + } else { + this.setState((prevState, props) => { + return { + current: prevState.current + props.step + }; + }); + } + }, + Math.abs(this.props.interval) * 1000); } /** @@ -129,9 +129,8 @@ class ReloadTimer extends Component { */ componentDidUpdate() { AJS.progressBars.update( - '#reloadProgressBar', - Math.abs(this.state.current - this.props.start) - / this.state.time); + '#reloadProgressBar', + Math.abs(this.state.current - this.props.start) / this.state.time); } /** diff --git a/react/features/remote-control/components/RemoteControlAuthorizationDialog.js b/react/features/remote-control/components/RemoteControlAuthorizationDialog.js index add703130..796f7390c 100644 --- a/react/features/remote-control/components/RemoteControlAuthorizationDialog.js +++ b/react/features/remote-control/components/RemoteControlAuthorizationDialog.js @@ -74,8 +74,9 @@ class RemoteControlAuthorizationDialog extends Component { titleKey = 'dialog.remoteControlTitle' width = 'small'> { - this.props.t('dialog.remoteControlRequestMessage', - { user: this.props._displayName }) + this.props.t( + 'dialog.remoteControlRequestMessage', + { user: this.props._displayName }) } { this._getAdditionalMessage() @@ -153,8 +154,10 @@ class RemoteControlAuthorizationDialog extends Component { */ function _mapStateToProps(state, ownProps) { const { _displayName, participantId } = ownProps; - const participant = getParticipantById( - state['features/base/participants'], participantId); + const participant + = getParticipantById( + state['features/base/participants'], + participantId); return { _displayName: participant ? participant.name : _displayName diff --git a/react/features/speaker-stats/components/SpeakerStats.js b/react/features/speaker-stats/components/SpeakerStats.js index 414347d8d..c83d79018 100644 --- a/react/features/speaker-stats/components/SpeakerStats.js +++ b/react/features/speaker-stats/components/SpeakerStats.js @@ -91,7 +91,7 @@ class SpeakerStats extends Component { ); } - /** + /** * Update the internal state with the latest speaker stats. * * @returns {void} diff --git a/react/features/welcome/components/AbstractWelcomePage.js b/react/features/welcome/components/AbstractWelcomePage.js index 78209ca7c..79df2ed84 100644 --- a/react/features/welcome/components/AbstractWelcomePage.js +++ b/react/features/welcome/components/AbstractWelcomePage.js @@ -97,11 +97,11 @@ export class AbstractWelcomePage extends Component { if (word.length > 1) { animateTimeoutId = setTimeout( - () => { - this._animateRoomnameChanging( - word.substring(1, word.length)); - }, - 70); + () => { + this._animateRoomnameChanging( + word.substring(1, word.length)); + }, + 70); } this.setState({