Prepare for eslint 4

This commit is contained in:
Lyubo Marinov 2017-06-14 19:40:51 -05:00
parent c8c44d62ed
commit 25ec8ac6a7
23 changed files with 148 additions and 146 deletions

View File

@ -304,7 +304,7 @@ var Chat = {
$('#chatconversation').append( $('#chatconversation').append(
'<div class="errorMessage"><b>Error: </b>' + 'Your message' + '<div class="errorMessage"><b>Error: </b>' + 'Your message' +
(originalText? (' \"'+ originalText + '\"') : "") + (originalText? (` "${originalText}"`) : "") +
' was not sent.' + ' was not sent.' +
(errorMessage? (' Reason: ' + errorMessage) : '') + '</div>'); (errorMessage? (' Reason: ' + errorMessage) : '') + '</div>');
$('#chatconversation').animate( $('#chatconversation').animate(

View File

@ -44,16 +44,16 @@ function _fixURIStringHierPart(uri) {
// hipchat.com // hipchat.com
let regex let regex
= new RegExp( = new RegExp(
`^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`, `^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
'gi'); 'gi');
let match = regex.exec(uri); let match = regex.exec(uri);
if (!match) { if (!match) {
// enso.me // enso.me
regex regex
= new RegExp( = new RegExp(
`^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`, `^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
'gi'); 'gi');
match = regex.exec(uri); match = regex.exec(uri);
} }
if (match) { if (match) {

View File

@ -47,70 +47,70 @@ function _addConferenceListeners(conference, dispatch) {
// Dispatches into features/base/conference follow: // Dispatches into features/base/conference follow:
conference.on( conference.on(
JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceEvents.CONFERENCE_FAILED,
(...args) => dispatch(conferenceFailed(conference, ...args))); (...args) => dispatch(conferenceFailed(conference, ...args)));
conference.on( conference.on(
JitsiConferenceEvents.CONFERENCE_JOINED, JitsiConferenceEvents.CONFERENCE_JOINED,
(...args) => dispatch(conferenceJoined(conference, ...args))); (...args) => dispatch(conferenceJoined(conference, ...args)));
conference.on( conference.on(
JitsiConferenceEvents.CONFERENCE_LEFT, JitsiConferenceEvents.CONFERENCE_LEFT,
(...args) => dispatch(conferenceLeft(conference, ...args))); (...args) => dispatch(conferenceLeft(conference, ...args)));
conference.on( conference.on(
JitsiConferenceEvents.LOCK_STATE_CHANGED, JitsiConferenceEvents.LOCK_STATE_CHANGED,
(...args) => dispatch(lockStateChanged(conference, ...args))); (...args) => dispatch(lockStateChanged(conference, ...args)));
// Dispatches into features/base/tracks follow: // Dispatches into features/base/tracks follow:
conference.on( conference.on(
JitsiConferenceEvents.TRACK_ADDED, JitsiConferenceEvents.TRACK_ADDED,
t => t && !t.isLocal() && dispatch(trackAdded(t))); t => t && !t.isLocal() && dispatch(trackAdded(t)));
conference.on( conference.on(
JitsiConferenceEvents.TRACK_REMOVED, JitsiConferenceEvents.TRACK_REMOVED,
t => t && !t.isLocal() && dispatch(trackRemoved(t))); t => t && !t.isLocal() && dispatch(trackRemoved(t)));
// Dispatches into features/base/participants follow: // Dispatches into features/base/participants follow:
conference.on( conference.on(
JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED,
(...args) => dispatch(dominantSpeakerChanged(...args))); (...args) => dispatch(dominantSpeakerChanged(...args)));
conference.on( conference.on(
JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
(...args) => dispatch(participantConnectionStatusChanged(...args))); (...args) => dispatch(participantConnectionStatusChanged(...args)));
conference.on( conference.on(
JitsiConferenceEvents.USER_JOINED, JitsiConferenceEvents.USER_JOINED,
(id, user) => dispatch(participantJoined({ (id, user) => dispatch(participantJoined({
id, id,
name: user.getDisplayName(), name: user.getDisplayName(),
role: user.getRole() role: user.getRole()
}))); })));
conference.on( conference.on(
JitsiConferenceEvents.USER_LEFT, JitsiConferenceEvents.USER_LEFT,
(...args) => dispatch(participantLeft(...args))); (...args) => dispatch(participantLeft(...args)));
conference.on( conference.on(
JitsiConferenceEvents.USER_ROLE_CHANGED, JitsiConferenceEvents.USER_ROLE_CHANGED,
(...args) => dispatch(participantRoleChanged(...args))); (...args) => dispatch(participantRoleChanged(...args)));
conference.addCommandListener( conference.addCommandListener(
AVATAR_ID_COMMAND, AVATAR_ID_COMMAND,
(data, id) => dispatch(participantUpdated({ (data, id) => dispatch(participantUpdated({
id, id,
avatarID: data.value avatarID: data.value
}))); })));
conference.addCommandListener( conference.addCommandListener(
AVATAR_URL_COMMAND, AVATAR_URL_COMMAND,
(data, id) => dispatch(participantUpdated({ (data, id) => dispatch(participantUpdated({
id, id,
avatarURL: data.value avatarURL: data.value
}))); })));
conference.addCommandListener( conference.addCommandListener(
EMAIL_COMMAND, EMAIL_COMMAND,
(data, id) => dispatch(participantUpdated({ (data, id) => dispatch(participantUpdated({
id, id,
email: data.value email: data.value
}))); })));
} }
/** /**

View File

@ -40,14 +40,14 @@ export function connect() {
}); });
connection.addEventListener( connection.addEventListener(
JitsiConnectionEvents.CONNECTION_DISCONNECTED, JitsiConnectionEvents.CONNECTION_DISCONNECTED,
_onConnectionDisconnected); _onConnectionDisconnected);
connection.addEventListener( connection.addEventListener(
JitsiConnectionEvents.CONNECTION_ESTABLISHED, JitsiConnectionEvents.CONNECTION_ESTABLISHED,
_onConnectionEstablished); _onConnectionEstablished);
connection.addEventListener( connection.addEventListener(
JitsiConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
_onConnectionFailed); _onConnectionFailed);
connection.connect(); connection.connect();
@ -61,8 +61,8 @@ export function connect() {
*/ */
function _onConnectionDisconnected(message: string) { function _onConnectionDisconnected(message: string) {
connection.removeEventListener( connection.removeEventListener(
JitsiConnectionEvents.CONNECTION_DISCONNECTED, JitsiConnectionEvents.CONNECTION_DISCONNECTED,
_onConnectionDisconnected); _onConnectionDisconnected);
dispatch(_connectionDisconnected(connection, message)); dispatch(_connectionDisconnected(connection, message));
} }
@ -99,11 +99,11 @@ export function connect() {
*/ */
function unsubscribe() { function unsubscribe() {
connection.removeEventListener( connection.removeEventListener(
JitsiConnectionEvents.CONNECTION_ESTABLISHED, JitsiConnectionEvents.CONNECTION_ESTABLISHED,
_onConnectionEstablished); _onConnectionEstablished);
connection.removeEventListener( connection.removeEventListener(
JitsiConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
_onConnectionFailed); _onConnectionFailed);
} }
}; };
} }

View File

@ -67,8 +67,8 @@ export function connect() {
APP.UI.initConference(); APP.UI.initConference();
APP.UI.addListener( APP.UI.addListener(
UIEvents.LANG_CHANGED, UIEvents.LANG_CHANGED,
language => APP.translation.setLanguage(language)); language => APP.translation.setLanguage(language));
APP.keyboardshortcut.init(); APP.keyboardshortcut.init();

View File

@ -12,7 +12,7 @@ export function translate(component) {
// Use the default list of namespaces. // Use the default list of namespaces.
return ( return (
reactI18nextTranslate([ 'main', 'languages' ], { wait: true })( reactI18nextTranslate([ 'main', 'languages' ], { wait: true })(
component)); component));
} }
/** /**

View File

@ -48,16 +48,16 @@ i18next
// Add default language which is preloaded from the source code. // Add default language which is preloaded from the source code.
i18next.addResourceBundle( i18next.addResourceBundle(
DEFAULT_LANGUAGE, DEFAULT_LANGUAGE,
'main', 'main',
MAIN_RESOURCES, MAIN_RESOURCES,
/* deep */ true, /* deep */ true,
/* overwrite */ true); /* overwrite */ true);
i18next.addResourceBundle( i18next.addResourceBundle(
DEFAULT_LANGUAGE, DEFAULT_LANGUAGE,
'languages', 'languages',
LANGUAGES_RESOURCES, LANGUAGES_RESOURCES,
/* deep */ true, /* deep */ true,
/* overwrite */ true); /* overwrite */ true);
export default i18next; export default i18next;

View File

@ -35,7 +35,7 @@ MiddlewareRegistry.register(store => next => action => {
* @returns {Object} The new state that is the result of the reduction of the * @returns {Object} The new state that is the result of the reduction of the
* specified action. * specified action.
*/ */
function _setConfig({ dispatch, getState }, next, action) { function _setConfig({ getState }, next, action) {
const oldValue = getState()['features/base/config']; const oldValue = getState()['features/base/config'];
const result = next(action); const result = next(action);
const newValue = getState()['features/base/config']; const newValue = getState()['features/base/config'];

View File

@ -120,8 +120,8 @@ function _visitNode(node, callback) {
if (typeof global.document === 'undefined') { if (typeof global.document === 'undefined') {
const document const document
= new DOMParser().parseFromString( = new DOMParser().parseFromString(
'<html><head></head><body></body></html>', '<html><head></head><body></body></html>',
'text/xml'); 'text/xml');
// document.addEventListener // document.addEventListener
// //
@ -181,8 +181,8 @@ function _visitNode(node, callback) {
// Parse the content string. // Parse the content string.
const d const d
= new DOMParser().parseFromString( = new DOMParser().parseFromString(
`<div>${innerHTML}</div>`, `<div>${innerHTML}</div>`,
'text/xml'); 'text/xml');
// Assign the resulting nodes as children of the // Assign the resulting nodes as children of the
// element. // element.
@ -353,8 +353,8 @@ function _visitNode(node, callback) {
if (responseText) { if (responseText) {
responseXML responseXML
= new DOMParser().parseFromString( = new DOMParser().parseFromString(
responseText, responseText,
'text/xml'); 'text/xml');
} }
return responseXML; return responseXML;

View File

@ -76,7 +76,7 @@ class RouteRegistry {
}); });
} }
/* eslint-disable no-undef */ /* eslint-disable no-undef */
/** /**
* Returns registered route by name if any. * Returns registered route by name if any.
@ -87,7 +87,7 @@ class RouteRegistry {
*/ */
getRouteByComponent(component: Class<Component<*>>) { getRouteByComponent(component: Class<Component<*>>) {
/* eslint-enable no-undef */ /* eslint-enable no-undef */
const route = this._elements.find(r => r.component === component); const route = this._elements.find(r => r.component === component);
@ -106,7 +106,7 @@ class RouteRegistry {
register(route: Route) { register(route: Route) {
if (this._elements.includes(route)) { if (this._elements.includes(route)) {
throw new Error( throw new Error(
`Route ${String(route.component)} is registered already!`); `Route ${String(route.component)} is registered already!`);
} }
this._elements.push(route); this._elements.push(route);

View File

@ -277,4 +277,4 @@ function _mapStateToProps(state) {
} }
export default reactReduxConnect(_mapStateToProps, _mapDispatchToProps)( export default reactReduxConnect(_mapStateToProps, _mapDispatchToProps)(
Conference); Conference);

View File

@ -22,7 +22,7 @@ class DeviceSelectionDialog extends Component {
* @static * @static
*/ */
static propTypes = { static propTypes = {
/** /**
* All known audio and video devices split by type. This prop comes from * All known audio and video devices split by type. This prop comes from
* the app state. * the app state.
*/ */

View File

@ -21,7 +21,7 @@ class DeviceSelectionDialogBase extends Component {
* @static * @static
*/ */
static propTypes = { static propTypes = {
/** /**
* All known audio and video devices split by type. This prop comes from * All known audio and video devices split by type. This prop comes from
* the app state. * the app state.
*/ */

View File

@ -16,8 +16,9 @@ MiddlewareRegistry.register(store => next => action => {
switch (action.type) { switch (action.type) {
case UPDATE_DIAL_IN_NUMBERS_FAILED: case UPDATE_DIAL_IN_NUMBERS_FAILED:
logger.error('Error encountered while fetching dial-in numbers:', logger.error(
action.error); 'Error encountered while fetching dial-in numbers:',
action.error);
break; break;
} }

View File

@ -100,9 +100,9 @@ function _maybeSetCallOverlayVisible({ dispatch, getState }, next, action) {
callOverlayVisible callOverlayVisible
= Boolean( = Boolean(
participants participants
&& participants.length === 1 && participants.length === 1
&& participants[0].local); && participants[0].local);
// However, the CallDialog is not to be displayed/visible again // However, the CallDialog is not to be displayed/visible again
// after all remote participants leave. // after all remote participants leave.

View File

@ -24,15 +24,15 @@ export function selectParticipant() {
const id = largeVideo.participantId; const id = largeVideo.participantId;
const videoTrack const videoTrack
= getTrackByMediaTypeAndParticipant( = getTrackByMediaTypeAndParticipant(
tracks, tracks,
MEDIA_TYPE.VIDEO, MEDIA_TYPE.VIDEO,
id); id);
try { try {
conference.selectParticipant( conference.selectParticipant(
videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA
? id ? id
: null); : null);
} catch (err) { } catch (err) {
_handleParticipantError(err); _handleParticipantError(err);
} }

View File

@ -55,8 +55,7 @@ MiddlewareRegistry.register(store => next => action => {
AudioMode.setMode(mode) AudioMode.setMode(mode)
.catch(err => .catch(err =>
console.error( console.error(
`Failed to set audio mode ${String(mode)}: ` `Failed to set audio mode ${String(mode)}: ${err}`));
+ `${err}`));
} }
} }

View File

@ -52,8 +52,8 @@ MiddlewareRegistry.register(store => next => action => {
case APP_WILL_MOUNT: case APP_WILL_MOUNT:
store.dispatch( store.dispatch(
_setAppStateListener( _setAppStateListener(
_onAppStateChange.bind(undefined, store.dispatch))); _onAppStateChange.bind(undefined, store.dispatch)));
break; break;
case APP_WILL_UNMOUNT: case APP_WILL_UNMOUNT:

View File

@ -133,34 +133,34 @@ export default class AbstractPageReloadOverlay extends Component {
// sent to the backed. // sent to the backed.
// FIXME: We should dispatch action for this. // FIXME: We should dispatch action for this.
APP.conference.logEvent( APP.conference.logEvent(
'page.reload', 'page.reload',
/* value */ undefined, /* value */ undefined,
/* label */ this.props.reason); /* label */ this.props.reason);
logger.info( logger.info(
`The conference will be reloaded after ${ `The conference will be reloaded after ${
this.state.timeoutSeconds} seconds.`); this.state.timeoutSeconds} seconds.`);
AJS.progressBars.update('#reloadProgressBar', 0); AJS.progressBars.update('#reloadProgressBar', 0);
this._interval this._interval
= setInterval( = setInterval(
() => { () => {
if (this.state.timeLeft === 0) { if (this.state.timeLeft === 0) {
if (this._interval) { if (this._interval) {
clearInterval(this._interval); clearInterval(this._interval);
this._interval = undefined; this._interval = undefined;
}
this.props.dispatch(_reloadNow());
} else {
this.setState(prevState => {
return {
timeLeft: prevState.timeLeft - 1
};
});
} }
},
1000); this.props.dispatch(_reloadNow());
} else {
this.setState(prevState => {
return {
timeLeft: prevState.timeLeft - 1
};
});
}
},
1000);
} }
/** /**

View File

@ -105,19 +105,19 @@ class ReloadTimer extends Component {
const intervalId const intervalId
= setInterval( = setInterval(
() => { () => {
if (this.state.current === this.props.end) { if (this.state.current === this.props.end) {
clearInterval(intervalId); clearInterval(intervalId);
this.props.onFinish(); this.props.onFinish();
} else { } else {
this.setState((prevState, props) => { this.setState((prevState, props) => {
return { return {
current: prevState.current + props.step current: prevState.current + props.step
}; };
}); });
} }
}, },
Math.abs(this.props.interval) * 1000); Math.abs(this.props.interval) * 1000);
} }
/** /**
@ -129,9 +129,8 @@ class ReloadTimer extends Component {
*/ */
componentDidUpdate() { componentDidUpdate() {
AJS.progressBars.update( AJS.progressBars.update(
'#reloadProgressBar', '#reloadProgressBar',
Math.abs(this.state.current - this.props.start) Math.abs(this.state.current - this.props.start) / this.state.time);
/ this.state.time);
} }
/** /**

View File

@ -74,8 +74,9 @@ class RemoteControlAuthorizationDialog extends Component {
titleKey = 'dialog.remoteControlTitle' titleKey = 'dialog.remoteControlTitle'
width = 'small'> width = 'small'>
{ {
this.props.t('dialog.remoteControlRequestMessage', this.props.t(
{ user: this.props._displayName }) 'dialog.remoteControlRequestMessage',
{ user: this.props._displayName })
} }
{ {
this._getAdditionalMessage() this._getAdditionalMessage()
@ -153,8 +154,10 @@ class RemoteControlAuthorizationDialog extends Component {
*/ */
function _mapStateToProps(state, ownProps) { function _mapStateToProps(state, ownProps) {
const { _displayName, participantId } = ownProps; const { _displayName, participantId } = ownProps;
const participant = getParticipantById( const participant
state['features/base/participants'], participantId); = getParticipantById(
state['features/base/participants'],
participantId);
return { return {
_displayName: participant ? participant.name : _displayName _displayName: participant ? participant.name : _displayName

View File

@ -91,7 +91,7 @@ class SpeakerStats extends Component {
); );
} }
/** /**
* Update the internal state with the latest speaker stats. * Update the internal state with the latest speaker stats.
* *
* @returns {void} * @returns {void}

View File

@ -97,11 +97,11 @@ export class AbstractWelcomePage extends Component {
if (word.length > 1) { if (word.length > 1) {
animateTimeoutId animateTimeoutId
= setTimeout( = setTimeout(
() => { () => {
this._animateRoomnameChanging( this._animateRoomnameChanging(
word.substring(1, word.length)); word.substring(1, word.length));
}, },
70); 70);
} }
this.setState({ this.setState({