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(
'<div class="errorMessage"><b>Error: </b>' + 'Your message' +
(originalText? (' \"'+ originalText + '\"') : "") +
(originalText? (` "${originalText}"`) : "") +
' was not sent.' +
(errorMessage? (' Reason: ' + errorMessage) : '') + '</div>');
$('#chatconversation').animate(

View File

@ -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) {

View File

@ -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
})));
}
/**

View File

@ -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);
}
};
}

View File

@ -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();

View File

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

View File

@ -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;

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
* 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'];

View File

@ -120,8 +120,8 @@ function _visitNode(node, callback) {
if (typeof global.document === 'undefined') {
const document
= new DOMParser().parseFromString(
'<html><head></head><body></body></html>',
'text/xml');
'<html><head></head><body></body></html>',
'text/xml');
// document.addEventListener
//
@ -181,8 +181,8 @@ function _visitNode(node, callback) {
// Parse the content string.
const d
= new DOMParser().parseFromString(
`<div>${innerHTML}</div>`,
'text/xml');
`<div>${innerHTML}</div>`,
'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;

View File

@ -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<Component<*>>) {
/* 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);

View File

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

View File

@ -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.
*/

View File

@ -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.
*/

View File

@ -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;
}

View File

@ -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.

View File

@ -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);
}

View File

@ -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}`));
}
}

View File

@ -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:

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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

View File

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

View File

@ -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({