Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ESLint

Lyubomir Marinova2b076985a62
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000000..2bd2bb7be3
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,11 @@
+# The build artifacts of the jitsi-meet project.
+build/*
+
+# Third-party source code which we (1) do not want to modify or (2) try to
+# modify as little as possible.
+libs/*
+
+# ESLint will by default ignore its own configuration file. However, there does
+# not seem to be a reason why we will want to risk being inconsistent with our
+# remaining JavaScript source code.
+!.eslintrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000000..bbec37f88a
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,37 @@
+module.exports = {
+ 'env': {
+ 'browser': true,
+ 'commonjs': true,
+ 'es6': true
+ },
+ 'extends': 'eslint:recommended',
+ 'globals': {
+ // The globals that (1) are accessed but not defined within many of our
+ // files, (2) are certainly defined, and (3) we would like to use
+ // without explicitly specifying them (using a comment) inside of our
+ // files.
+ '__filename': false
+ },
+ 'parserOptions': {
+ 'ecmaFeatures': {
+ 'experimentalObjectRestSpread': true
+ },
+ 'sourceType': 'module'
+ },
+ 'rules': {
+ 'new-cap': [
+ 'error',
+ {
+ 'capIsNew': false // Behave like JSHint's newcap.
+ }
+ ],
+ // While it is considered a best practice to avoid using methods on
+ // console in JavaScript that is designed to be executed in the browser
+ // and ESLint includes the rule among its set of recommended rules, (1)
+ // the general practice is to strip such calls before pushing to
+ // production and (2) we prefer to utilize console in lib-jitsi-meet
+ // (and jitsi-meet).
+ 'no-console': 'off',
+ 'semi': 'error'
+ }
+};
diff --git a/analytics.js b/analytics.js
index ebaf3d3329..ff25e85b56 100644
--- a/analytics.js
+++ b/analytics.js
@@ -1,5 +1,9 @@
+/* global ga */
+
(function (ctx) {
function Analytics() {
+ /* eslint-disable */
+
/**
* Google Analytics
*/
@@ -8,6 +12,8 @@
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-319188-14', 'jit.si');
ga('send', 'pageview');
+
+ /* eslint-enable */
}
Analytics.prototype.sendEvent = function (action, data, label, browserName) {
diff --git a/app.js b/app.js
index 627b577028..5a06b4c8d8 100644
--- a/app.js
+++ b/app.js
@@ -1,4 +1,4 @@
-/* global $, JitsiMeetJS, config, getRoomName */
+/* global $, config, getRoomName */
/* application specific logic */
import "babel-polyfill";
diff --git a/conference.js b/conference.js
index ca74ab4499..0cc7726462 100644
--- a/conference.js
+++ b/conference.js
@@ -19,7 +19,6 @@ import {reportError} from './modules/util/helpers';
import UIErrors from './modules/UI/UIErrors';
import UIUtil from './modules/UI/util/UIUtil';
-const ConnectionEvents = JitsiMeetJS.events.connection;
const ConnectionErrors = JitsiMeetJS.errors.connection;
const ConferenceEvents = JitsiMeetJS.events.conference;
@@ -159,29 +158,24 @@ function getDisplayName (id) {
/**
* Mute or unmute local audio stream if it exists.
- * @param {boolean} muted if audio stream should be muted or unmuted.
- * @param {boolean} indicates if this local audio mute was a result of user
- * interaction
- *
+ * @param {boolean} muted - if audio stream should be muted or unmuted.
+ * @param {boolean} userInteraction - indicates if this local audio mute was a
+ * result of user interaction
*/
-function muteLocalAudio (muted, userInteraction) {
- if (!localAudio) {
+function muteLocalAudio (muted) {
+ muteLocalMedia(localAudio, muted, 'Audio');
+}
+
+function muteLocalMedia(localMedia, muted, localMediaTypeString) {
+ if (!localMedia) {
return;
}
- if (muted) {
- localAudio.mute().then(function(value) {},
- function(value) {
- console.warn('Audio Mute was rejected:', value);
- }
- );
- } else {
- localAudio.unmute().then(function(value) {},
- function(value) {
- console.warn('Audio unmute was rejected:', value);
- }
- );
- }
+ const method = muted ? 'mute' : 'unmute';
+
+ localMedia[method]().catch(reason => {
+ console.warn(`${localMediaTypeString} ${method} was rejected:`, reason);
+ });
}
/**
@@ -189,23 +183,7 @@ function muteLocalAudio (muted, userInteraction) {
* @param {boolean} muted if video stream should be muted or unmuted.
*/
function muteLocalVideo (muted) {
- if (!localVideo) {
- return;
- }
-
- if (muted) {
- localVideo.mute().then(function(value) {},
- function(value) {
- console.warn('Video mute was rejected:', value);
- }
- );
- } else {
- localVideo.unmute().then(function(value) {},
- function(value) {
- console.warn('Video unmute was rejected:', value);
- }
- );
- }
+ muteLocalMedia(localVideo, muted, 'Video');
}
/**
@@ -433,7 +411,7 @@ class ConferenceConnector {
room.on(ConferenceEvents.CONFERENCE_ERROR,
this._onConferenceError.bind(this));
}
- _handleConferenceFailed(err, msg) {
+ _handleConferenceFailed(err) {
this._unsubscribe();
this._reject(err);
}
@@ -1284,6 +1262,7 @@ export default {
UIUtil.animateShowElement($("#talkWhileMutedPopup"), true, 5000);
});
+/*
room.on(ConferenceEvents.IN_LAST_N_CHANGED, (inLastN) => {
//FIXME
if (config.muteLocalVideoIfNotInLastN) {
@@ -1292,6 +1271,7 @@ export default {
// APP.UI.markVideoMuted(true/false);
}
});
+*/
room.on(
ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, (ids, enteringIds) => {
APP.UI.handleLastNEndpoints(ids, enteringIds);
diff --git a/config.js b/config.js
index 912b90f236..ba78935f40 100644
--- a/config.js
+++ b/config.js
@@ -1,5 +1,6 @@
-/* jshint -W101 */
-var config = {
+/* jshint maxlen:false */
+
+var config = { // eslint-disable-line no-unused-vars
// configLocation: './config.json', // see ./modules/HttpConfigFetch.js
hosts: {
domain: 'jitsi-meet.example.com',
diff --git a/interface_config.js b/interface_config.js
index 5218f0c56c..41530f6e12 100644
--- a/interface_config.js
+++ b/interface_config.js
@@ -1,4 +1,4 @@
-var interfaceConfig = {
+var interfaceConfig = { // eslint-disable-line no-unused-vars
CANVAS_EXTRA: 104,
CANVAS_RADIUS: 0,
SHADOW_COLOR: '#ffffff',
@@ -44,4 +44,4 @@ var interfaceConfig = {
DISABLE_FOCUS_INDICATOR: false,
AUDIO_LEVEL_PRIMARY_COLOR: "rgba(255,255,255,0.7)",
AUDIO_LEVEL_SECONDARY_COLOR: "rgba(255,255,255,0.4)"
-};
\ No newline at end of file
+};
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index 45251bc441..3074842875 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -336,7 +336,6 @@ JitsiMeetExternalAPI.prototype.removeEventListener = function(event) {
* @param events array with the names of the events.
*/
JitsiMeetExternalAPI.prototype.removeEventListeners = function(events) {
- var eventsArray = [];
for(var i = 0; i < events.length; i++)
this.removeEventListener(events[i]);
};
diff --git a/modules/FollowMe.js b/modules/FollowMe.js
index 8457b8e795..8eb1bf40e0 100644
--- a/modules/FollowMe.js
+++ b/modules/FollowMe.js
@@ -261,25 +261,26 @@ class FollowMe {
* @param newValue the new value
* @private
*/
+ // eslint-disable-next-line no-unused-vars
_localPropertyChange (property, oldValue, newValue) {
// Only a moderator is allowed to send commands.
- var conference = this._conference;
+ const conference = this._conference;
if (!conference.isModerator)
return;
- var commands = conference.commands;
+ const commands = conference.commands;
// XXX The "Follow Me" command represents a snapshot of all states
// which are to be followed so don't forget to removeCommand before
// sendCommand!
commands.removeCommand(_COMMAND);
- var self = this;
+ const local = this._local;
commands.sendCommandOnce(
_COMMAND,
{
attributes: {
- filmStripVisible: self._local.filmStripVisible,
- nextOnStage: self._local.nextOnStage,
- sharedDocumentVisible: self._local.sharedDocumentVisible
+ filmStripVisible: local.filmStripVisible,
+ nextOnStage: local.nextOnStage,
+ sharedDocumentVisible: local.sharedDocumentVisible
}
});
}
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 9a3f68add1..4c8e4f6b1c 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -1,5 +1,4 @@
/* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
-/* jshint -W101 */
var UI = {};
import Chat from "./side_pannels/chat/Chat";
@@ -10,11 +9,11 @@ import Avatar from "./avatar/Avatar";
import SideContainerToggler from "./side_pannels/SideContainerToggler";
import UIUtil from "./util/UIUtil";
import UIEvents from "../../service/UI/UIEvents";
-import CQEvents from '../../service/connectionquality/CQEvents';
import EtherpadManager from './etherpad/Etherpad';
import SharedVideoManager from './shared_video/SharedVideo';
import Recording from "./recording/Recording";
-import GumPermissionsOverlay from './gum_overlay/UserMediaPermissionsGuidanceOverlay';
+import GumPermissionsOverlay
+ from './gum_overlay/UserMediaPermissionsGuidanceOverlay';
import VideoLayout from "./videolayout/VideoLayout";
import FilmStrip from "./videolayout/FilmStrip";
@@ -194,21 +193,16 @@ UI.notifyReservationError = function (code, msg) {
"dialog.reservationError");
var message = APP.translation.generateTranslationHTML(
"dialog.reservationErrorMsg", {code: code, msg: msg});
- messageHandler.openDialog(
- title,
- message,
- true, {},
- function (event, value, message, formVals) {
- return false;
- }
- );
+ messageHandler.openDialog(title, message, true, {}, () => false);
};
/**
* Notify user that he has been kicked from the server.
*/
UI.notifyKicked = function () {
- messageHandler.openMessageDialog("dialog.sessTerminated", "dialog.kickMessage");
+ messageHandler.openMessageDialog(
+ "dialog.sessTerminated",
+ "dialog.kickMessage");
};
/**
@@ -218,13 +212,9 @@ UI.notifyKicked = function () {
UI.notifyConferenceDestroyed = function (reason) {
//FIXME: use Session Terminated from translation, but
// 'reason' text comes from XMPP packet and is not translated
- var title = APP.translation.generateTranslationHTML("dialog.sessTerminated");
- messageHandler.openDialog(
- title, reason, true, {},
- function (event, value, message, formVals) {
- return false;
- }
- );
+ const title
+ = APP.translation.generateTranslationHTML("dialog.sessTerminated");
+ messageHandler.openDialog(title, reason, true, {}, () => false);
};
/**
@@ -287,7 +277,9 @@ UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
* Sets the local "raised hand" status.
*/
UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
- VideoLayout.setRaisedHandStatus(APP.conference.getMyUserId(), raisedHandStatus);
+ VideoLayout.setRaisedHandStatus(
+ APP.conference.getMyUserId(),
+ raisedHandStatus);
};
/**
@@ -579,10 +571,6 @@ UI.removeRemoteStream = function (track) {
VideoLayout.onRemoteStreamRemoved(track);
};
-function chatAddError(errorMessage, originalText) {
- return Chat.chatAddError(errorMessage, originalText);
-}
-
/**
* Update chat subject.
* @param {string} subject new chat subject
@@ -959,9 +947,7 @@ UI.notifyConnectionFailed = function (stropheErrorMsg) {
"dialog.connectError");
}
- messageHandler.openDialog(
- title, message, true, {}, function (e, v, m, f) { return false; }
- );
+ messageHandler.openDialog(title, message, true, {}, () => false);
};
@@ -975,9 +961,7 @@ UI.notifyMaxUsersLimitReached = function () {
var message = APP.translation.generateTranslationHTML(
"dialog.maxUsersLimitReached");
- messageHandler.openDialog(
- title, message, true, {}, function (e, v, m, f) { return false; }
- );
+ messageHandler.openDialog(title, message, true, {}, () => false);
};
/**
@@ -985,8 +969,12 @@ UI.notifyMaxUsersLimitReached = function () {
*/
UI.notifyInitiallyMuted = function () {
messageHandler.notify(
- null, "notify.mutedTitle", "connected", "notify.muted", null, {timeOut: 120000}
- );
+ null,
+ "notify.mutedTitle",
+ "connected",
+ "notify.muted",
+ null,
+ { timeOut: 120000 });
};
/**
@@ -1089,6 +1077,7 @@ UI.addMessage = function (from, displayName, message, stamp) {
Chat.updateChatConversation(from, displayName, message, stamp);
};
+// eslint-disable-next-line no-unused-vars
UI.updateDTMFSupport = function (isDTMFSupported) {
//TODO: enable when the UI is ready
//Toolbar.showDialPadButton(dtmfSupport);
@@ -1105,7 +1094,7 @@ UI.requestFeedback = function () {
else if (Feedback.isEnabled() && Feedback.isSubmitted())
return Promise.resolve();
else
- return new Promise(function (resolve, reject) {
+ return new Promise(function (resolve) {
if (Feedback.isEnabled()) {
// If the user has already entered feedback, we'll show the
// window and immidiately start the conference dispose timeout.
@@ -1272,7 +1261,7 @@ UI.showExtensionExternalInstallationDialog = function (url) {
null,
true,
"dialog.goToStore",
- function(e,v,m,f){
+ function(e,v) {
if (v) {
e.preventDefault();
eventEmitter.emit(UIEvents.OPEN_EXTENSION_STORE, url);
@@ -1407,13 +1396,12 @@ UI.showDeviceErrorDialog = function (micError, cameraError) {
let title = "dialog.error";
if (micError && micError.name === TrackErrors.PERMISSION_DENIED) {
- if (cameraError && cameraError.name === TrackErrors.PERMISSION_DENIED) {
- title = "dialog.permissionDenied";
- } else if (!cameraError) {
+ if (!cameraError
+ || cameraError.name === TrackErrors.PERMISSION_DENIED) {
title = "dialog.permissionDenied";
}
- } else if (cameraError &&
- cameraError.name === TrackErrors.PERMISSION_DENIED) {
+ } else if (cameraError
+ && cameraError.name === TrackErrors.PERMISSION_DENIED) {
title = "dialog.permissionDenied";
}
diff --git a/modules/UI/authentication/AuthHandler.js b/modules/UI/authentication/AuthHandler.js
index a2342fa22b..8ce8246bab 100644
--- a/modules/UI/authentication/AuthHandler.js
+++ b/modules/UI/authentication/AuthHandler.js
@@ -4,7 +4,6 @@ import LoginDialog from './LoginDialog';
import UIUtil from '../util/UIUtil';
import {openConnection} from '../../../connection';
-const ConferenceEvents = JitsiMeetJS.events.conference;
const ConnectionErrors = JitsiMeetJS.errors.connection;
let externalAuthWindow;
@@ -73,7 +72,6 @@ function redirectToTokenAuthService(roomName) {
* @param room the name fo the conference room.
*/
function initJWTTokenListener(room) {
- var self = this;
var listener = function (event) {
if (externalAuthWindow !== event.source) {
console.warn("Ignored message not coming " +
@@ -279,15 +277,12 @@ function showXmppPasswordPrompt(roomName, connect) {
function requestAuth(roomName, connect) {
if (isTokenAuthEnabled) {
// This Promise never resolves as user gets redirected to another URL
- return new Promise(function (resolve, reject) {
- redirectToTokenAuthService(roomName);
- });
+ return new Promise(() => redirectToTokenAuthService(roomName));
} else {
return showXmppPasswordPrompt(roomName, connect);
}
}
-
export default {
authenticate,
requireAuth,
diff --git a/modules/UI/authentication/LoginDialog.js b/modules/UI/authentication/LoginDialog.js
index 1242695248..e730e848ab 100644
--- a/modules/UI/authentication/LoginDialog.js
+++ b/modules/UI/authentication/LoginDialog.js
@@ -1,4 +1,4 @@
-/* global $, APP, config*/
+/* global APP, config */
/**
* Build html for "password required" dialog.
@@ -109,7 +109,7 @@ function LoginDialog(successCallback, cancelCallback) {
html: '<div id="errorMessage"></div>',
buttons: finishedButtons,
defaultButton: 0,
- submit: function (e, v, m, f) {
+ submit: function (e, v) {
e.preventDefault();
if (v === 'retry') {
connDialog.goToState('login');
diff --git a/modules/UI/authentication/RoomLocker.js b/modules/UI/authentication/RoomLocker.js
index 4c05b6dce2..611b1d75c1 100644
--- a/modules/UI/authentication/RoomLocker.js
+++ b/modules/UI/authentication/RoomLocker.js
@@ -51,7 +51,7 @@ function askForPassword () {
APP.UI.messageHandler.openTwoButtonDialog(
null, null, null, msg,
true, "dialog.Ok",
- function (e, v, m, f) {}, null,
+ function () {}, null,
function (e, v, m, f) {
if (v && f.lockKey) {
resolve(UIUtil.escapeHtml(f.lockKey));
diff --git a/modules/UI/etherpad/Etherpad.js b/modules/UI/etherpad/Etherpad.js
index d5c9e7e4a7..4bbfbdc96f 100644
--- a/modules/UI/etherpad/Etherpad.js
+++ b/modules/UI/etherpad/Etherpad.js
@@ -2,7 +2,6 @@
import VideoLayout from "../videolayout/VideoLayout";
import LargeContainer from '../videolayout/LargeContainer';
-import UIUtil from "../util/UIUtil";
import UIEvents from "../../../service/UI/UIEvents";
import FilmStrip from '../videolayout/FilmStrip';
@@ -101,6 +100,7 @@ class Etherpad extends LargeContainer {
return document.getElementById('etherpad');
}
+ // eslint-disable-next-line no-unused-vars
resize (containerWidth, containerHeight, animate) {
let height = containerHeight - FilmStrip.getFilmStripHeight();
let width = containerWidth;
diff --git a/modules/UI/feedback/Feedback.js b/modules/UI/feedback/Feedback.js
index 8fbc29e85b..7e23d1ca9c 100644
--- a/modules/UI/feedback/Feedback.js
+++ b/modules/UI/feedback/Feedback.js
@@ -1,4 +1,4 @@
-/* global $, APP, config, interfaceConfig, JitsiMeetJS */
+/* global $, APP, JitsiMeetJS */
import UIEvents from "../../../service/UI/UIEvents";
import FeedabckWindow from "./FeedbackWindow";
@@ -125,4 +125,4 @@ var Feedback = {
}
};
-module.exports = Feedback;
\ No newline at end of file
+module.exports = Feedback;
diff --git a/modules/UI/feedback/FeedbackWindow.js b/modules/UI/feedback/FeedbackWindow.js
index bededdffa8..3e57993f71 100644
--- a/modules/UI/feedback/FeedbackWindow.js
+++ b/modules/UI/feedback/FeedbackWindow.js
@@ -1,5 +1,4 @@
/* global $, APP, interfaceConfig, AJS */
-/* jshint -W101 */
const selector = '#aui-feedback-dialog';
@@ -9,21 +8,21 @@ const selector = '#aui-feedback-dialog';
*
* @param starCount the number of stars, for which to toggle the css class
*/
-let toggleStars = function(starCount) {
+function toggleStars(starCount) {
$('#stars > a').each(function(index, el) {
if (index <= starCount) {
el.classList.add("starHover");
} else
el.classList.remove("starHover");
});
-};
+}
/**
* Constructs the html for the rated feedback window.
*
* @returns {string} the contructed html string
*/
-let createRateFeedbackHTML = function (Feedback) {
+function createRateFeedbackHTML() {
let rateExperience
= APP.translation.translateString('dialog.rateExperience'),
feedbackHelp = APP.translation.translateString('dialog.feedbackHelp');
@@ -58,17 +57,22 @@ let createRateFeedbackHTML = function (Feedback) {
<p>&nbsp;</p>
<p>${ feedbackHelp }</p>
</div>
- <textarea id="feedbackTextArea" rows="10" cols="40" autofocus></textarea>
+ <textarea id="feedbackTextArea" rows="10" cols="40" autofocus>
+ </textarea>
</form>
<footer class="aui-dialog2-footer feedback__footer">
<div class="aui-dialog2-footer-actions">
- <button id="dialog-close-button" class="aui-button aui-button_close">Close</button>
- <button id="dialog-submit-button" class="aui-button aui-button_submit">Submit</button>
+ <button
+ id="dialog-close-button"
+ class="aui-button aui-button_close">Close</button>
+ <button
+ id="dialog-submit-button"
+ class="aui-button aui-button_submit">Submit</button>
</div>
</footer>
</div>
`;
-};
+}
/**
* Callback for Rate Feedback
diff --git a/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js b/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js
index ef2cfc9c10..db0d977e45 100644
--- a/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js
+++ b/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js
@@ -1,4 +1,4 @@
-/* global $, APP, JitsiMeetJS */
+/* global $, APP */
let $overlay;
@@ -43,4 +43,4 @@ export default {
hide() {
$overlay && $overlay.detach();
}
-};
\ No newline at end of file
+};
diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js
index c37a39eb0a..bfce1a6ab6 100644
--- a/modules/UI/recording/Recording.js
+++ b/modules/UI/recording/Recording.js
@@ -97,7 +97,7 @@ function _requestLiveStreamId() {
],
focus: ':input:first',
defaultButton: 1,
- submit: function (e, v, m, f) {
+ submit: function (e, v) {
e.preventDefault();
if (v === 0) {
reject(APP.UI.messageHandler.CANCEL);
@@ -177,7 +177,7 @@ function _showStopRecordingPrompt (recordingType) {
null,
false,
buttonKey,
- function(e,v,m,f) {
+ function(e,v) {
if (v) {
resolve();
} else {
diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js
index 3d777c6ed4..737cb2eb93 100644
--- a/modules/UI/shared_video/SharedVideo.js
+++ b/modules/UI/shared_video/SharedVideo.js
@@ -729,7 +729,7 @@ function showStopVideoPropmpt() {
null,
false,
"dialog.Remove",
- function(e,v,m,f) {
+ function(e,v) {
if (v) {
resolve();
} else {
@@ -811,7 +811,7 @@ function requestVideoLink() {
],
focus: ':input:first',
defaultButton: 1,
- submit: function (e, v, m, f) {
+ submit: function (e, v) {
e.preventDefault();
if (v === 0) {
reject();
diff --git a/modules/UI/side_pannels/chat/Commands.js b/modules/UI/side_pannels/chat/Commands.js
index 94e225eeb2..9970d60c52 100644
--- a/modules/UI/side_pannels/chat/Commands.js
+++ b/modules/UI/side_pannels/chat/Commands.js
@@ -1,4 +1,3 @@
-/* global APP */
import UIUtil from '../../util/UIUtil';
import UIEvents from '../../../../service/UI/UIEvents';
diff --git a/modules/UI/side_pannels/contactlist/ContactList.js b/modules/UI/side_pannels/contactlist/ContactList.js
index f19bb8d619..b660a2d30b 100644
--- a/modules/UI/side_pannels/contactlist/ContactList.js
+++ b/modules/UI/side_pannels/contactlist/ContactList.js
@@ -4,7 +4,6 @@ import UIEvents from '../../../../service/UI/UIEvents';
import UIUtil from '../../util/UIUtil';
let numberOfContacts = 0;
-let notificationInterval;
/**
* Updates the number of participants in the contact list button and sets
@@ -61,10 +60,6 @@ function getContactEl (id) {
return $(`#contacts>li[id="${id}"]`);
}
-function contactElExists (id) {
- return getContactEl(id).length > 0;
-}
-
/**
* Contact list.
*/
diff --git a/modules/UI/side_pannels/profile/Profile.js b/modules/UI/side_pannels/profile/Profile.js
index cbd4aeeae1..1479e7159a 100644
--- a/modules/UI/side_pannels/profile/Profile.js
+++ b/modules/UI/side_pannels/profile/Profile.js
@@ -1,7 +1,6 @@
-/* global APP, $, JitsiMeetJS */
+/* global $ */
import UIUtil from "../../util/UIUtil";
import UIEvents from "../../../../service/UI/UIEvents";
-import languages from "../../../../service/translation/languages";
import Settings from '../../../settings/Settings';
export default {
@@ -58,4 +57,4 @@ export default {
changeAvatar (avatarUrl) {
$('#avatar').attr('src', avatarUrl);
}
-};
\ No newline at end of file
+};
diff --git a/modules/UI/side_pannels/settings/SettingsMenu.js b/modules/UI/side_pannels/settings/SettingsMenu.js
index 20f9c536ca..3c1e800670 100644
--- a/modules/UI/side_pannels/settings/SettingsMenu.js
+++ b/modules/UI/side_pannels/settings/SettingsMenu.js
@@ -1,4 +1,4 @@
-/* global APP, $, JitsiMeetJS, interfaceConfig */
+/* global APP, $, JitsiMeetJS */
import UIUtil from "../../util/UIUtil";
import UIEvents from "../../../../service/UI/UIEvents";
import languages from "../../../../service/translation/languages";
@@ -268,4 +268,4 @@ export default {
APP.translation.translateElement($('#settings_container option'));
}
-};
\ No newline at end of file
+};
diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js
index ef0d5e0cc5..bcfd02ee55 100644
--- a/modules/UI/toolbars/Toolbar.js
+++ b/modules/UI/toolbars/Toolbar.js
@@ -1,5 +1,4 @@
/* global APP, $, config, interfaceConfig, JitsiMeetJS */
-/* jshint -W101 */
import UIUtil from '../util/UIUtil';
import UIEvents from '../../../service/UI/UIEvents';
import SideContainerToggler from "../side_pannels/SideContainerToggler";
@@ -350,7 +349,11 @@ function showSipNumberInput () {
APP.UI.messageHandler.openTwoButtonDialog(
null, null, null,
`<h2>${sipMsg}</h2>
- <input name="sipNumber" type="text" value="${defaultNumber}" autofocus>`,
+ <input
+ name="sipNumber"
+ type="text"
+ value="${defaultNumber}"
+ autofocus>`,
false, "dialog.Dial",
function (e, v, m, f) {
if (v && f.sipNumber) {
@@ -739,7 +742,7 @@ const Toolbar = {
/**
* Handles the side toolbar toggle.
*/
- _handleSideToolbarContainerToggled(containerId, isVisible) {
+ _handleSideToolbarContainerToggled(containerId) {
Object.keys(defaultToolbarButtons).forEach(
id => {
if (!UIUtil.isButtonEnabled(id))
@@ -819,4 +822,4 @@ const Toolbar = {
}
};
-export default Toolbar;
\ No newline at end of file
+export default Toolbar;
diff --git a/modules/UI/toolbars/ToolbarToggler.js b/modules/UI/toolbars/ToolbarToggler.js
index a15663554c..c353d898ee 100644
--- a/modules/UI/toolbars/ToolbarToggler.js
+++ b/modules/UI/toolbars/ToolbarToggler.js
@@ -3,7 +3,6 @@
import UIUtil from '../util/UIUtil';
import Toolbar from './Toolbar';
import SideContainerToggler from "../side_pannels/SideContainerToggler";
-import FilmStrip from '../videolayout/FilmStrip.js';
let toolbarTimeoutObject;
let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
@@ -27,7 +26,7 @@ function showDesktopSharingButton() {
* @param force {true} to force the hiding of the toolbar without caring about
* the extended toolbar side panels.
*/
-function hideToolbar(force) {
+function hideToolbar(force) { // eslint-disable-line no-unused-vars
if (alwaysVisibleToolbar) {
return;
}
diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js
index 578e0725f7..e4292772d1 100644
--- a/modules/UI/util/MessageHandler.js
+++ b/modules/UI/util/MessageHandler.js
@@ -1,5 +1,4 @@
-/* global $, APP, jQuery, toastr, Impromptu */
-/* jshint -W101 */
+/* global $, APP, toastr, Impromptu */
import UIUtil from './UIUtil';
@@ -274,7 +273,8 @@ var messageHandler = {
displayNameSpan + '<br>' +
'<span class=' + cls + ' data-i18n="' + messageKey + '"' +
(messageArguments?
- " data-i18n-options='" + JSON.stringify(messageArguments) + "'"
+ " data-i18n-options='" + JSON.stringify(messageArguments)
+ + "'"
: "") + ">" +
APP.translation.translateString(messageKey,
messageArguments) +
diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js
index 6cf1fc51a4..b7ff1fb0e5 100644
--- a/modules/UI/util/UIUtil.js
+++ b/modules/UI/util/UIUtil.js
@@ -1,4 +1,4 @@
-/* global $, APP, config, AJS, interfaceConfig */
+/* global $, APP, AJS, interfaceConfig */
import KeyboardShortcut from '../../keyboardshortcut/keyboardshortcut';
diff --git a/modules/UI/videolayout/ConnectionIndicator.js b/modules/UI/videolayout/ConnectionIndicator.js
index ddcd65d4ff..f7056f9d1a 100644
--- a/modules/UI/videolayout/ConnectionIndicator.js
+++ b/modules/UI/videolayout/ConnectionIndicator.js
@@ -416,7 +416,7 @@ ConnectionIndicator.prototype.updateResolutionIndicator = function () {
else if (this.resolution !== null) {
let resolutions = this.resolution || {};
Object.keys(resolutions).map(function (ssrc) {
- let {width, height} = resolutions[ssrc];
+ const { height } = resolutions[ssrc];
if (height >= config.minHDHeight)
showResolutionLabel = true;
});
diff --git a/modules/UI/videolayout/FilmStrip.js b/modules/UI/videolayout/FilmStrip.js
index 10a8366c04..6dcd64aac4 100644
--- a/modules/UI/videolayout/FilmStrip.js
+++ b/modules/UI/videolayout/FilmStrip.js
@@ -1,4 +1,4 @@
-/* global $, APP, interfaceConfig, config*/
+/* global $, interfaceConfig */
import UIEvents from "../../../service/UI/UIEvents";
import UIUtil from "../util/UIUtil";
diff --git a/modules/UI/videolayout/LargeContainer.js b/modules/UI/videolayout/LargeContainer.js
index 0f0dd242d1..73d6beeb68 100644
--- a/modules/UI/videolayout/LargeContainer.js
+++ b/modules/UI/videolayout/LargeContainer.js
@@ -24,19 +24,20 @@ export default class LargeContainer {
* @param {number} containerHeight available height
* @param {boolean} animate if container should animate it's resize process
*/
+ // eslint-disable-next-line no-unused-vars
resize (containerWidth, containerHeight, animate) {
}
/**
* Handler for "hover in" events.
*/
- onHoverIn (e) {
+ onHoverIn (e) { // eslint-disable-line no-unused-vars
}
/**
* Handler for "hover out" events.
*/
- onHoverOut (e) {
+ onHoverOut (e) { // eslint-disable-line no-unused-vars
}
/**
@@ -44,14 +45,14 @@ export default class LargeContainer {
* @param {JitsiTrack?} stream new stream
* @param {string} videoType video type
*/
- setStream (stream, videoType) {
+ setStream (stream, videoType) { // eslint-disable-line no-unused-vars
}
/**
* Show or hide user avatar.
* @param {boolean} show
*/
- showAvatar (show) {
+ showAvatar (show) { // eslint-disable-line no-unused-vars
}
/**
diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js
index e699edc416..895d19b27f 100644
--- a/modules/UI/videolayout/LargeVideoManager.js
+++ b/modules/UI/videolayout/LargeVideoManager.js
@@ -1,13 +1,10 @@
/* global $, APP, interfaceConfig */
-/* jshint -W101 */
import Avatar from "../avatar/Avatar";
import {createDeferred} from '../../util/helpers';
import UIUtil from "../util/UIUtil";
import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer";
-import LargeContainer from "./LargeContainer";
-
import AudioLevels from "../audio_levels/AudioLevels";
/**
diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js
index e6cf690dc8..9cb7456cc3 100644
--- a/modules/UI/videolayout/LocalVideo.js
+++ b/modules/UI/videolayout/LocalVideo.js
@@ -34,26 +34,10 @@ function LocalVideo(VideoLayout, emitter) {
LocalVideo.prototype = Object.create(SmallVideo.prototype);
LocalVideo.prototype.constructor = LocalVideo;
-/**
- * Creates the edit display name button.
- *
- * @returns {object} the edit button
- */
-function createEditDisplayNameButton() {
- var editButton = document.createElement('a');
- editButton.className = 'displayname';
- UIUtil.setTooltip(editButton,
- "videothumbnail.editnickname",
- "left");
- editButton.innerHTML = '<i class="icon-edit"></i>';
-
- return editButton;
-}
-
/**
* Sets the display name for the given video span id.
*/
-LocalVideo.prototype.setDisplayName = function(displayName, key) {
+LocalVideo.prototype.setDisplayName = function(displayName) {
if (!this.container) {
console.warn(
"Unable to set displayName - " + this.videoSpanId +
@@ -138,7 +122,7 @@ LocalVideo.prototype.setDisplayName = function(displayName, key) {
$editDisplayName.focus();
$editDisplayName.select();
- $editDisplayName.one("focusout", function (e) {
+ $editDisplayName.one("focusout", function () {
self.emitter.emit(UIEvents.NICKNAME_CHANGED, this.value);
$editDisplayName.hide();
$localDisplayName.show();
diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js
index 99e29495b4..6749de3afe 100644
--- a/modules/UI/videolayout/RemoteVideo.js
+++ b/modules/UI/videolayout/RemoteVideo.js
@@ -3,7 +3,6 @@
import ConnectionIndicator from './ConnectionIndicator';
import SmallVideo from "./SmallVideo";
-import AudioLevels from "../audio_levels/AudioLevels";
import UIUtils from "../util/UIUtil";
import UIEvents from '../../../service/UI/UIEvents';
import JitsiPopover from "../util/JitsiPopover";
@@ -61,8 +60,7 @@ RemoteVideo.prototype.addRemoteVideoContainer = function() {
this.addRemoteVideoMenu();
}
- let { remoteVideo } = this.VideoLayout.resizeThumbnails(false, true);
- let { thumbHeight, thumbWidth } = remoteVideo;
+ this.VideoLayout.resizeThumbnails(false, true);
this.addAudioLevelIndicator();
@@ -429,7 +427,6 @@ RemoteVideo.prototype.addRemoteStreamElement = function (stream) {
return;
let streamElement = SmallVideo.createStreamElement(stream);
- let newElementId = streamElement.id;
// Put new stream element always in front
UIUtils.prependChild(this.container, streamElement);
diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js
index cde3ffad56..4f96e58535 100644
--- a/modules/UI/videolayout/SmallVideo.js
+++ b/modules/UI/videolayout/SmallVideo.js
@@ -574,7 +574,6 @@ SmallVideo.prototype.getIndicatorSpan = function(id) {
* is added, and will fire a RESOLUTION_CHANGED event.
*/
SmallVideo.prototype.waitForResolutionChange = function() {
- let self = this;
let beforeChange = window.performance.now();
let videos = this.selectVideoElement();
if (!videos || !videos.length || videos.length <= 0)
@@ -582,17 +581,17 @@ SmallVideo.prototype.waitForResolutionChange = function() {
let video = videos[0];
let oldWidth = video.videoWidth;
let oldHeight = video.videoHeight;
- video.onresize = (event) => {
+ video.onresize = () => {
if (video.videoWidth != oldWidth || video.videoHeight != oldHeight) {
// Only run once.
video.onresize = null;
let delay = window.performance.now() - beforeChange;
- let emitter = self.VideoLayout.getEventEmitter();
+ let emitter = this.VideoLayout.getEventEmitter();
if (emitter) {
emitter.emit(
UIEvents.RESOLUTION_CHANGED,
- self.getId(),
+ this.getId(),
oldWidth + "x" + oldHeight,
video.videoWidth + "x" + video.videoHeight,
delay);
diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.js
index 5ebfe979c8..f59e43cc07 100644
--- a/modules/UI/videolayout/VideoContainer.js
+++ b/modules/UI/videolayout/VideoContainer.js
@@ -139,11 +139,7 @@ function getCameraVideoPosition(videoWidth,
* @return an array with 2 elements, the horizontal indent and the vertical
* indent
*/
-function getDesktopVideoPosition(videoWidth,
- videoHeight,
- videoSpaceWidth,
- videoSpaceHeight) {
-
+function getDesktopVideoPosition(videoWidth, videoHeight, videoSpaceWidth) {
let horizontalIndent = (videoSpaceWidth - videoWidth) / 2;
let verticalIndent = 0;// Top aligned
@@ -428,7 +424,6 @@ export class VideoContainer extends LargeContainer {
return Promise.resolve();
}
- let $wrapper = this.$wrapper;
return new Promise((resolve) => {
this.$wrapper.css('visibility', 'visible').fadeTo(
FADE_DURATION_MS,
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 2548425ff7..749dd23ecc 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -1,7 +1,5 @@
-/* global config, APP, $, interfaceConfig, JitsiMeetJS */
-/* jshint -W101 */
+/* global config, APP, $, interfaceConfig */
-import Avatar from "../avatar/Avatar";
import FilmStrip from "./FilmStrip";
import UIEvents from "../../../service/UI/UIEvents";
import UIUtil from "../util/UIUtil";
@@ -9,11 +7,8 @@ import UIUtil from "../util/UIUtil";
import RemoteVideo from "./RemoteVideo";
import LargeVideoManager from "./LargeVideoManager";
import {VIDEO_CONTAINER_TYPE} from "./VideoContainer";
-import {SHARED_VIDEO_CONTAINER_TYPE} from '../shared_video/SharedVideo';
import LocalVideo from "./LocalVideo";
-const RTCUIUtil = JitsiMeetJS.util.RTCUIHelper;
-
var remoteVideos = {};
var localVideoThumbnail = null;
@@ -106,7 +101,7 @@ var VideoLayout = {
localVideoThumbnail.setVideoType(VIDEO_CONTAINER_TYPE);
// if we do not resize the thumbs here, if there is no video device
// the local video thumb maybe one pixel
- let { localVideo } = this.resizeThumbnails(false, true);
+ this.resizeThumbnails(false, true);
emitter.addListener(UIEvents.CONTACT_CLICKED, onContactClicked);
this.lastNCount = config.channelLastN;
@@ -316,7 +311,8 @@ var VideoLayout = {
onRemoteStreamRemoved (stream) {
let id = stream.getParticipantId();
let remoteVideo = remoteVideos[id];
- if (remoteVideo) { // remote stream may be removed after participant left the conference
+ // Remote stream may be removed after participant left the conference.
+ if (remoteVideo) {
remoteVideo.removeRemoteStreamElement(stream);
}
},
@@ -519,12 +515,9 @@ var VideoLayout = {
resizeThumbnails ( animate = false,
forceUpdate = false,
onComplete = null) {
-
- let { localVideo, remoteVideo }
+ const { localVideo, remoteVideo }
= FilmStrip.calculateThumbnailSize();
- let {thumbWidth, thumbHeight} = remoteVideo;
-
FilmStrip.resizeThumbnails(localVideo, remoteVideo,
animate, forceUpdate)
.then(function () {
@@ -653,6 +646,7 @@ var VideoLayout = {
* @param {boolean} isActive true if the connection is ok or false when
* the user is having connectivity issues.
*/
+ // eslint-disable-next-line no-unused-vars
onParticipantConnectionStatusChanged (id, isActive) {
// Show/hide warning on the large video
if (this.isCurrentlyOnLarge(id)) {
diff --git a/modules/UI/welcome_page/WelcomePage.js b/modules/UI/welcome_page/WelcomePage.js
index 6ea3cb08f0..d722ebcf3b 100644
--- a/modules/UI/welcome_page/WelcomePage.js
+++ b/modules/UI/welcome_page/WelcomePage.js
@@ -75,8 +75,6 @@ function setupWelcomePage() {
});
if (interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE !== false) {
- var updateTimeout;
- var animateTimeout;
var selector = $("#reload_roomname");
selector.click(function () {
clearTimeout(updateTimeout);
diff --git a/modules/config/HttpConfigFetch.js b/modules/config/HttpConfigFetch.js
index d7f4cf59ad..c65607e432 100644
--- a/modules/config/HttpConfigFetch.js
+++ b/modules/config/HttpConfigFetch.js
@@ -32,7 +32,7 @@ var HttpConfig = {
var error = "Get config response status: " + textStatus;
complete(false, error);
},
- success: function(data, textStatus, jqXHR) {
+ success: function(data) {
try {
configUtil.overrideConfigJSON(
config, interfaceConfig, data);
@@ -48,4 +48,4 @@ var HttpConfig = {
}
};
-module.exports = HttpConfig;
\ No newline at end of file
+module.exports = HttpConfig;
diff --git a/modules/config/URLProcessor.js b/modules/config/URLProcessor.js
index 5ab19f9661..5befe603eb 100644
--- a/modules/config/URLProcessor.js
+++ b/modules/config/URLProcessor.js
@@ -1,4 +1,4 @@
-/* global $, $iq, config, interfaceConfig, getConfigParamsFromUrl */
+/* global config, interfaceConfig, getConfigParamsFromUrl */
var configUtils = require('./Util');
var params = {};
diff --git a/modules/config/Util.js b/modules/config/Util.js
index 1488f5ccb2..6267e4fdbf 100644
--- a/modules/config/Util.js
+++ b/modules/config/Util.js
@@ -1,4 +1,3 @@
-/* global $ */
var ConfigUtil = {
/**
* Method overrides JSON properties in <tt>config</tt> and
@@ -42,4 +41,4 @@ var ConfigUtil = {
}
};
-module.exports = ConfigUtil;
\ No newline at end of file
+module.exports = ConfigUtil;
diff --git a/modules/connectionquality/connectionquality.js b/modules/connectionquality/connectionquality.js
index 16aa155145..1b1c17bd58 100644
--- a/modules/connectionquality/connectionquality.js
+++ b/modules/connectionquality/connectionquality.js
@@ -1,5 +1,3 @@
-/* global APP, require */
-/* jshint -W101 */
import EventEmitter from "events";
import CQEvents from "../../service/connectionquality/CQEvents";
diff --git a/modules/devices/mediaDeviceHelper.js b/modules/devices/mediaDeviceHelper.js
index 3392fe0975..77fd6a1b07 100644
--- a/modules/devices/mediaDeviceHelper.js
+++ b/modules/devices/mediaDeviceHelper.js
@@ -1,4 +1,4 @@
-/* global $, APP, JitsiMeetJS, config, interfaceConfig */
+/* global APP, JitsiMeetJS */
let currentAudioInputDevices,
currentVideoInputDevices,
@@ -243,4 +243,4 @@ export default {
});
}
}
-};
\ No newline at end of file
+};
diff --git a/modules/recorder/Recorder.js b/modules/recorder/Recorder.js
index 2bc527c15f..3c531df399 100644
--- a/modules/recorder/Recorder.js
+++ b/modules/recorder/Recorder.js
@@ -1,4 +1,4 @@
-/* global APP, $, config */
+/* global APP, config */
/**
* The (name of the) command which transports the recorder info.
@@ -26,7 +26,6 @@ class Recorder {
// which are to be followed so don't forget to removeCommand before
// sendCommand!
commands.removeCommand(_USER_INFO_COMMAND);
- var self = this;
commands.sendCommand(
_USER_INFO_COMMAND,
{
@@ -38,4 +37,4 @@ class Recorder {
}
}
-export default Recorder;
\ No newline at end of file
+export default Recorder;
diff --git a/modules/translation/translation.js b/modules/translation/translation.js
index 0f3a6761df..b799e50864 100644
--- a/modules/translation/translation.js
+++ b/modules/translation/translation.js
@@ -3,11 +3,9 @@ var i18n = require("i18next-client");
var languages = require("../../service/translation/languages");
var DEFAULT_LANG = languages.EN;
-i18n.addPostProcessor("resolveAppName", function(value, key, options) {
- return value.replace("__app__", interfaceConfig.APP_NAME);
-});
-
-
+i18n.addPostProcessor(
+ "resolveAppName",
+ value => value.replace("__app__", interfaceConfig.APP_NAME));
var defaultOptions = {
detectLngQS: "lang",
@@ -34,7 +32,7 @@ var defaultOptions = {
{ lng: lng, ns: ns });
i18n.functions.ajax({
url: url,
- success: function(data, status, xhr) {
+ success: function(data) {
i18n.functions.log('loaded: ' + url);
done(null, data);
},
@@ -63,7 +61,7 @@ var defaultOptions = {
// localStorageExpirationTime: 86400000 // in ms, default 1 week
};
-function initCompleted(t) {
+function initCompleted() {
$("[data-i18n]").i18n();
}
diff --git a/package.json b/package.json
index abbbaa910a..f8e1369c04 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"babel-register": "*",
"clean-css": "*",
"css-loader": "*",
+ "eslint": "*",
"expose-loader": "*",
"file-loader": "*",
"imports-loader": "*",
@@ -56,7 +57,7 @@
},
"license": "Apache-2.0",
"scripts": {
- "lint": "jshint .",
+ "lint": "jshint . && eslint .",
"validate": "npm ls"
},
"pre-commit": [
diff --git a/utils.js b/utils.js
index 11c2eca14f..00192dbefa 100644
--- a/utils.js
+++ b/utils.js
@@ -9,7 +9,7 @@
/**
* Builds and returns the room name.
*/
-function getRoomName () {
+function getRoomName () { // eslint-disable-line no-unused-vars
var path = window.location.pathname;
var roomName;
@@ -42,6 +42,7 @@ function getRoomName () {
* @param dontParse if false or undefined some transformations
* (for parsing the value as JSON) are going to be executed
*/
+// eslint-disable-next-line no-unused-vars
function getConfigParamsFromUrl(source, dontParse) {
var paramStr = (source === "search")? location.search : location.hash;
if (!paramStr)
diff --git a/webpack.config.babel.js b/webpack.config.babel.js
index 21453ecd97..b37b518823 100644
--- a/webpack.config.babel.js
+++ b/webpack.config.babel.js
@@ -1,5 +1,6 @@
+/* global __dirname */
+
import process from 'process';
-import webpack from 'webpack';
const aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
const minimize