Coding style

A few occurrences of coding style/formatting which I noticed while
reviewing 'feat(eslint): Enable for non react files'. These are
definitely not all occurrences I could've noticed during the review
but... we're talking about files outside react/ anyway.
pull/2057/head jitsi-meet_2544
Lyubo Marinov 7 years ago
parent 969f5d67ab
commit 5d313a8cd8
  1. 1
      analytics.js
  2. 89
      conference.js
  3. 4
      config.js
  4. 18
      connection.js
  5. 2
      interface_config.js
  6. 3
      modules/FollowMe.js
  7. 81
      modules/UI/UI.js
  8. 20
      webpack.config.js

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

@ -1,5 +1,4 @@
/* global $, APP, JitsiMeetJS, config, interfaceConfig */
const logger = require('jitsi-meet-logger').getLogger(__filename);
import { openConnection } from './connection';
@ -88,6 +87,8 @@ import {
showDesktopSharingButton
} from './react/features/toolbox';
const logger = require('jitsi-meet-logger').getLogger(__filename);
const eventEmitter = new EventEmitter();
let room;
@ -211,10 +212,12 @@ function maybeRedirectToWelcomePage(options) {
// if Welcome page is enabled redirect to welcome page after 3 sec.
if (config.enableWelcomePage) {
setTimeout(() => {
APP.settings.setWelcomePageEnabled(true);
assignWindowLocationPathname('./');
}, 3000);
setTimeout(
() => {
APP.settings.setWelcomePageEnabled(true);
assignWindowLocationPathname('./');
},
3000);
}
}
@ -595,10 +598,8 @@ export default {
// Try audio only...
audioAndVideoError = err;
return createLocalTracksF(
{ devices: [ 'audio' ] },
true
);
return (
createLocalTracksF({ devices: [ 'audio' ] }, true));
} else if (requestedAudio && !requestedVideo) {
audioOnlyError = err;
@ -949,9 +950,9 @@ export default {
isParticipantModerator(id) {
const user = room.getParticipantById(id);
return user && user.isModerator();
},
get membersCount() {
return room.getParticipants().length + 1;
},
@ -1084,7 +1085,6 @@ export default {
getParticipantConnectionStatus(id) {
const participant = this.getParticipantById(id);
return participant ? participant.getConnectionStatus() : null;
},
@ -1109,12 +1109,10 @@ export default {
}
return interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;
},
getMyUserId() {
return this._room
&& this._room.myUserId();
return this._room && this._room.myUserId();
},
/**
@ -1287,15 +1285,15 @@ export default {
const options = config;
if (config.enableRecording && !config.recordingType) {
options.recordingType = config.hosts
&& (typeof config.hosts.jirecon !== 'undefined')
? 'jirecon' : 'colibri';
options.recordingType
= config.hosts && (typeof config.hosts.jirecon !== 'undefined')
? 'jirecon'
: 'colibri';
}
return options;
},
/**
* Start using provided video stream.
* Stops previous video stream.
@ -1484,7 +1482,6 @@ export default {
}
return this._untoggleScreenSharing();
},
/**
@ -1595,34 +1592,34 @@ export default {
this.videoSwitchInProgress = true;
return this._createDesktopTrack(options)
.then(stream => this.useVideoStream(stream))
.then(() => {
this.videoSwitchInProgress = false;
sendEvent('conference.sharingDesktop.start');
logger.log('sharing local desktop');
})
.catch(error => {
this.videoSwitchInProgress = false;
// Pawel: With this call I'm trying to preserve the original
// behaviour although it is not clear why would we "untoggle"
// on failure. I suppose it was to restore video in case there
// was some problem during "this.useVideoStream(desktopStream)".
// It's important to note that the handler will not be available
// if we fail early on trying to get desktop media (which makes
// sense, because the camera video is still being used, so
// nothing to "untoggle").
if (this._untoggleScreenSharing) {
this._untoggleScreenSharing();
}
.then(stream => this.useVideoStream(stream))
.then(() => {
this.videoSwitchInProgress = false;
sendEvent('conference.sharingDesktop.start');
logger.log('sharing local desktop');
})
.catch(error => {
this.videoSwitchInProgress = false;
// Pawel: With this call I'm trying to preserve the original
// behaviour although it is not clear why would we "untoggle"
// on failure. I suppose it was to restore video in case there
// was some problem during "this.useVideoStream(desktopStream)".
// It's important to note that the handler will not be available
// if we fail early on trying to get desktop media (which makes
// sense, because the camera video is still being used, so
// nothing to "untoggle").
if (this._untoggleScreenSharing) {
this._untoggleScreenSharing();
}
// FIXME the code inside of _handleScreenSharingError is
// asynchronous, but does not return a Promise and is not part
// of the current Promise chain.
this._handleScreenSharingError(error);
// FIXME the code inside of _handleScreenSharingError is
// asynchronous, but does not return a Promise and is not part
// of the current Promise chain.
this._handleScreenSharingError(error);
return Promise.reject(error);
});
return Promise.reject(error);
});
},
/**

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

@ -35,8 +35,10 @@ function checkForAttachParametersAndConnect(id, password, connection) {
// If the connection optimization is deployed and enabled and there is
// a failure the value will be window.XMPPAttachInfo.status = "error"
if (window.XMPPAttachInfo.status === 'error') {
connection.connect({ id,
password });
connection.connect({
id,
password
});
return;
}
@ -47,13 +49,17 @@ function checkForAttachParametersAndConnect(id, password, connection) {
connection.attach(attachOptions);
delete window.XMPPAttachInfo.data;
} else {
connection.connect({ id,
password });
connection.connect({
id,
password
});
}
} else {
APP.connect.status = 'ready';
APP.connect.handler = checkForAttachParametersAndConnect.bind(null,
id, password, connection);
APP.connect.handler
= checkForAttachParametersAndConnect.bind(
null,
id, password, connection);
}
}

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

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

@ -122,9 +122,7 @@ const UIListeners = new Map([
() => UI.toggleContactList()
], [
UIEvents.TOGGLE_PROFILE,
() => {
UI.toggleSidePanel('profile_container');
}
() => UI.toggleSidePanel('profile_container')
], [
UIEvents.TOGGLE_FILMSTRIP,
() => UI.handleToggleFilmstrip()
@ -139,9 +137,7 @@ const UIListeners = new Map([
* (a.k.a. presentation mode in Chrome).
*/
UI.toggleFullScreen = function() {
UIUtil.isFullScreen()
? UIUtil.exitFullScreen()
: UIUtil.enterFullScreen();
UIUtil.isFullScreen() ? UIUtil.exitFullScreen() : UIUtil.enterFullScreen();
};
/**
@ -158,9 +154,13 @@ UI.notifyGracefulShutdown = function() {
* Notify user that reservation error happened.
*/
UI.notifyReservationError = function(code, msg) {
const message = APP.translation.generateTranslationHTML(
'dialog.reservationErrorMsg', { code,
msg });
const message
= APP.translation.generateTranslationHTML(
'dialog.reservationErrorMsg',
{
code,
msg
});
messageHandler.openDialog(
'dialog.reservationError', message, true, {}, () => false);
@ -171,8 +171,8 @@ UI.notifyReservationError = function(code, msg) {
*/
UI.notifyKicked = function() {
messageHandler.openMessageDialog(
'dialog.sessTerminated',
'dialog.kickMessage');
'dialog.sessTerminated',
'dialog.kickMessage');
};
/**
@ -192,10 +192,9 @@ UI.notifyConferenceDestroyed = function(reason) {
* @param msg
*/
UI.showChatError = function(err, msg) {
if (interfaceConfig.filmStripOnly) {
return;
if (!interfaceConfig.filmStripOnly) {
Chat.chatAddError(err, msg);
}
Chat.chatAddError(err, msg);
};
/**
@ -229,8 +228,11 @@ UI.showLocalConnectionInterrupted = function(isInterrupted) {
UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
VideoLayout.setRaisedHandStatus(participant.getId(), raisedHandStatus);
if (raisedHandStatus) {
messageHandler.participantNotification(participant.getDisplayName(),
'notify.somebody', 'connected', 'notify.raisedHand');
messageHandler.participantNotification(
participant.getDisplayName(),
'notify.somebody',
'connected',
'notify.raisedHand');
}
};
@ -313,7 +315,6 @@ UI.start = function() {
// Set the defaults for prompt dialogs.
$.prompt.setDefaults({ persistent: false });
SideContainerToggler.init(eventEmitter);
Filmstrip.init(eventEmitter);
@ -471,8 +472,7 @@ UI.addUser = function(user) {
const displayName = user.getDisplayName();
messageHandler.participantNotification(
displayName, 'notify.somebody', 'connected', 'notify.connected'
);
displayName, 'notify.somebody', 'connected', 'notify.connected');
if (!config.startAudioMuted
|| config.startAudioMuted > APP.conference.membersCount) {
@ -498,11 +498,10 @@ UI.addUser = function(user) {
*/
UI.removeUser = function(id, displayName) {
messageHandler.participantNotification(
displayName, 'notify.somebody', 'disconnected', 'notify.disconnected'
);
displayName, 'notify.somebody', 'disconnected', 'notify.disconnected');
if (!config.startAudioMuted
|| config.startAudioMuted > APP.conference.membersCount) {
|| config.startAudioMuted > APP.conference.membersCount) {
UIUtil.playSoundNotification('userLeft');
}
@ -558,15 +557,17 @@ UI.updateUserRole = user => {
if (displayName) {
messageHandler.participantNotification(
displayName, 'notify.somebody',
'connected', 'notify.grantedTo', {
to: UIUtil.escapeHtml(displayName)
}
);
displayName,
'notify.somebody',
'connected',
'notify.grantedTo',
{ to: UIUtil.escapeHtml(displayName) });
} else {
messageHandler.participantNotification(
'', 'notify.somebody',
'connected', 'notify.grantedToUnknown');
'',
'notify.somebody',
'connected',
'notify.grantedToUnknown');
}
};
@ -584,10 +585,11 @@ UI.updateUserStatus = (user, status) => {
const displayName = user.getDisplayName();
messageHandler.participantNotification(
displayName, '', 'connected', 'dialOut.statusMessage',
{
status: UIUtil.escapeHtml(status)
});
displayName,
'',
'connected',
'dialOut.statusMessage',
{ status: UIUtil.escapeHtml(status) });
};
/**
@ -648,9 +650,10 @@ UI.inputDisplayNameHandler = function(newDisplayName) {
*/
// eslint-disable-next-line max-params
UI.showCustomToolbarPopup = function(buttonName, popupID, show, timeout) {
const action = show
? setButtonPopupTimeout(buttonName, popupID, timeout)
: clearButtonPopup(buttonName);
const action
= show
? setButtonPopupTimeout(buttonName, popupID, timeout)
: clearButtonPopup(buttonName);
APP.store.dispatch(action);
};
@ -681,10 +684,8 @@ UI.showLoginPopup = function(callback) {
// eslint-disable-next-line max-params
const submitFunction = (e, v, m, f) => {
if (v) {
if (f.username && f.password) {
callback(f.username, f.password);
}
if (v && f.username && f.password) {
callback(f.username, f.password);
}
};

@ -64,6 +64,7 @@ const config = {
rules: [ {
// Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
// as well.
exclude: node_modules, // eslint-disable-line camelcase
loader: 'babel-loader',
options: {
@ -210,11 +211,10 @@ function devServerProxyBypass({ path }) {
const configs = module.exports;
/* eslint-disable indent */
let formattedPath = path;
/* eslint-disable array-callback-return, indent */
if ((Array.isArray(configs) ? configs : Array(configs)).some(c => {
if (formattedPath.startsWith(c.output.publicPath)) {
if (path.startsWith(c.output.publicPath)) {
if (!minimize) {
// Since webpack-dev-server is serving non-minimized
// artifacts, serve them even if the minimized ones are
@ -222,24 +222,20 @@ function devServerProxyBypass({ path }) {
Object.keys(c.entry).some(e => {
const name = `${e}.min.js`;
if (formattedPath.indexOf(name) !== -1) {
formattedPath
= formattedPath.replace(name, `${e}.js`);
if (path.indexOf(name) !== -1) {
// eslint-disable-next-line no-param-reassign
path = path.replace(name, `${e}.js`);
return true;
}
return false;
});
}
return true;
}
return false;
})) {
return formattedPath;
return path;
}
/* eslint-enable indent */
/* eslint-enable array-callback-return, indent */
}

Loading…
Cancel
Save