Bladeren bron

ESLint

Our JSHint configuration is not extensive and we have excluded multiple
files from linting. Additionally, we have seen JSHint to be unable to
parse newer ECMAScript features such as the object spread operator
(proposal).

On the other hand, we have seen ESLint to beautifully work on React and
React Native source code in addition to ES2015 and later. Introduce
ESLint alongside JSHint as an intermediate step to eventually switching
from JSHint to ESLint.

As our source code does not fully follow even the JSHint rules we have,
it is very difficult to introduce ESLint with many rules. At the
beginning, introduce it with as little rules as possible. Morever,
ESLint is able to automatically fix certain rule offenders so once we
have ESLint merged we can incrementally add new rules while keeping our
commits' modification on as little subjects as possible.
master
Lyubomir Marinov 8 jaren geleden
bovenliggende
commit
90ee7e8a54
38 gewijzigde bestanden met toevoegingen van 270 en 214 verwijderingen
  1. 15
    0
      .eslintignore
  2. 34
    0
      .eslintrc.js
  3. 23
    23
      JitsiConference.js
  4. 1
    1
      JitsiConferenceEventManager.js
  5. 7
    8
      JitsiConnection.js
  6. 1
    1
      JitsiMediaDevices.js
  7. 9
    9
      JitsiMeetJS.js
  8. 4
    2
      connection_optimization/external_connect.js
  9. 14
    13
      doc/example/example.js
  10. 5
    9
      modules/RTC/DataChannels.js
  11. 7
    7
      modules/RTC/JitsiLocalTrack.js
  12. 2
    2
      modules/RTC/JitsiRemoteTrack.js
  13. 3
    3
      modules/RTC/JitsiTrack.js
  14. 6
    7
      modules/RTC/RTC.js
  15. 3
    3
      modules/RTC/RTCUIHelper.js
  16. 20
    14
      modules/RTC/RTCUtils.js
  17. 5
    5
      modules/RTC/ScreenObtainer.js
  18. 4
    4
      modules/statistics/AnalyticsAdapter.js
  19. 1
    1
      modules/statistics/CallStats.js
  20. 0
    1
      modules/statistics/LocalStatsCollector.js
  21. 4
    5
      modules/statistics/RTPStatsCollector.js
  22. 4
    3
      modules/transcription/audioRecorder.js
  23. 4
    1
      modules/transcription/transcriptionServices/AbstractTranscriptionService.js
  24. 2
    2
      modules/transcription/transcriptionServices/SphinxTranscriptionService.js
  25. 3
    3
      modules/transcription/word.js
  26. 0
    2
      modules/util/EventEmitterForwarder.js
  27. 19
    22
      modules/xmpp/ChatRoom.js
  28. 5
    0
      modules/xmpp/JingleSession.js
  29. 14
    16
      modules/xmpp/JingleSessionPC.js
  30. 5
    9
      modules/xmpp/SDP.js
  31. 14
    10
      modules/xmpp/TraceablePeerConnection.js
  32. 4
    4
      modules/xmpp/recording.js
  33. 3
    2
      modules/xmpp/strophe.emuc.js
  34. 10
    7
      modules/xmpp/strophe.jingle.js
  35. 4
    4
      modules/xmpp/strophe.ping.js
  36. 4
    3
      modules/xmpp/strophe.rayo.js
  37. 5
    7
      modules/xmpp/xmpp.js
  38. 2
    1
      package.json

+ 15
- 0
.eslintignore Bestand weergeven

@@ -0,0 +1,15 @@
1
+# The build artifacts of the lib-jiti-meet project.
2
+lib-jitsi-meet.js
3
+lib-jitsi-meet.js.map
4
+lib-jitsi-meet.min.js
5
+lib-jitsi-meet.min.map
6
+
7
+# Third-party source code which we (1) do not want to modify or (2) try to
8
+# modify as little as possible.
9
+libs/*
10
+modules/RTC/adapter.screenshare.js
11
+
12
+# ESLint will by default ignore its own configuration file. However, there does
13
+# not seem to be a reason why we will want to risk being inconsistent with our
14
+# remaining JavaScript source code.
15
+!.eslintrc.js

+ 34
- 0
.eslintrc.js Bestand weergeven

@@ -0,0 +1,34 @@
1
+module.exports = {
2
+    'env': {
3
+        'browser': true,
4
+        'commonjs': true,
5
+        'es6': true
6
+    },
7
+    'extends': 'eslint:recommended',
8
+    'globals': {
9
+        // The globals that (1) are accessed but not defined within many of our
10
+        // files, (2) are certainly defined, and (3) we would like to use
11
+        // without explicitly specifying them (using a comment) inside of our
12
+        // files.
13
+        '__filename': false
14
+    },
15
+    'parserOptions': {
16
+        'sourceType': 'module'
17
+    },
18
+    'rules': {
19
+        'new-cap': [
20
+            'error',
21
+            {
22
+                'capIsNew': false // Behave like JSHint's newcap.
23
+            }
24
+        ],
25
+        // While it is considered a best practice to avoid using methods on
26
+        // console in JavaScript that is designed to be executed in the browser
27
+        // and ESLint includes the rule among its set of recommended rules, (1)
28
+        // the general practice is to strip such calls before pushing to
29
+        // production and (2) we prefer to utilize console in lib-jitsi-meet
30
+        // (and jitsi-meet).
31
+        'no-console': 'off',
32
+        'semi': 'error'
33
+    }
34
+};

+ 23
- 23
JitsiConference.js Bestand weergeven

@@ -1,5 +1,5 @@
1 1
 /* global Strophe, $, Promise */
2
-/* jshint -W101 */
2
+
3 3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
4 4
 var RTC = require("./modules/RTC/RTC");
5 5
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
@@ -105,7 +105,6 @@ JitsiConference.prototype._init = function (options) {
105 105
         this.statistics = new Statistics(this.xmpp, {
106 106
             callStatsID: this.options.config.callStatsID,
107 107
             callStatsSecret: this.options.config.callStatsSecret,
108
-            callStatsSecret: this.options.config.callStatsSecret,
109 108
             callStatsCustomScriptUrl:
110 109
                 this.options.config.callStatsCustomScriptUrl,
111 110
             roomName: this.options.name
@@ -123,7 +122,7 @@ JitsiConference.prototype._init = function (options) {
123 122
             this.eventEmitter.emit(JitsiConferenceEvents.TALK_WHILE_MUTED);
124 123
         });
125 124
     }
126
-}
125
+};
127 126
 
128 127
 /**
129 128
  * Joins the conference.
@@ -156,7 +155,8 @@ JitsiConference.prototype._leaveRoomAndRemoveParticipants = function () {
156 155
     }
157 156
 
158 157
     this.room = null;
159
-}
158
+};
159
+
160 160
 /**
161 161
  * Leaves the conference.
162 162
  * @returns {Promise}
@@ -534,7 +534,7 @@ JitsiConference.prototype.onTrackRemoved = function (track) {
534 534
         this.statistics.sendScreenSharingEvent(false);
535 535
 
536 536
     this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
537
-}
537
+};
538 538
 
539 539
 /**
540 540
  * Removes JitsiLocalTrack object to the conference.
@@ -831,7 +831,7 @@ function (jingleSession, jingleOffer, now) {
831 831
         jingleSession.initialize(false /* initiator */,this.room);
832 832
     } catch (error) {
833 833
         GlobalOnErrorHandler.callErrorHandler(error);
834
-    };
834
+    }
835 835
 
836 836
     this.rtc.onIncommingCall(jingleSession);
837 837
     // Add local Tracks to the ChatRoom
@@ -999,14 +999,14 @@ JitsiConference.prototype.isRecordingSupported = function () {
999 999
  */
1000 1000
 JitsiConference.prototype.getRecordingState = function () {
1001 1001
     return (this.room) ? this.room.getRecordingState() : undefined;
1002
-}
1002
+};
1003 1003
 
1004 1004
 /**
1005 1005
  * Returns the url of the recorded video.
1006 1006
  */
1007 1007
 JitsiConference.prototype.getRecordingURL = function () {
1008 1008
     return (this.room) ? this.room.getRecordingURL() : null;
1009
-}
1009
+};
1010 1010
 
1011 1011
 /**
1012 1012
  * Starts/stops the recording
@@ -1020,7 +1020,7 @@ JitsiConference.prototype.toggleRecording = function (options) {
1020 1020
     this.eventEmitter.emit(
1021 1021
         JitsiConferenceEvents.RECORDER_STATE_CHANGED, "error",
1022 1022
         new Error("The conference is not created yet!"));
1023
-}
1023
+};
1024 1024
 
1025 1025
 /**
1026 1026
  * Returns true if the SIP calls are supported and false otherwise
@@ -1029,7 +1029,7 @@ JitsiConference.prototype.isSIPCallingSupported = function () {
1029 1029
     if(this.room)
1030 1030
         return this.room.isSIPCallingSupported();
1031 1031
     return false;
1032
-}
1032
+};
1033 1033
 
1034 1034
 /**
1035 1035
  * Dials a number.
@@ -1039,8 +1039,8 @@ JitsiConference.prototype.dial = function (number) {
1039 1039
     if(this.room)
1040 1040
         return this.room.dial(number);
1041 1041
     return new Promise(function(resolve, reject){
1042
-        reject(new Error("The conference is not created yet!"))});
1043
-}
1042
+        reject(new Error("The conference is not created yet!"));});
1043
+};
1044 1044
 
1045 1045
 /**
1046 1046
  * Hangup an existing call
@@ -1049,8 +1049,8 @@ JitsiConference.prototype.hangup = function () {
1049 1049
     if(this.room)
1050 1050
         return this.room.hangup();
1051 1051
     return new Promise(function(resolve, reject){
1052
-        reject(new Error("The conference is not created yet!"))});
1053
-}
1052
+        reject(new Error("The conference is not created yet!"));});
1053
+};
1054 1054
 
1055 1055
 /**
1056 1056
  * Returns the phone number for joining the conference.
@@ -1059,7 +1059,7 @@ JitsiConference.prototype.getPhoneNumber = function () {
1059 1059
     if(this.room)
1060 1060
         return this.room.getPhoneNumber();
1061 1061
     return null;
1062
-}
1062
+};
1063 1063
 
1064 1064
 /**
1065 1065
  * Returns the pin for joining the conference with phone.
@@ -1068,7 +1068,7 @@ JitsiConference.prototype.getPhonePin = function () {
1068 1068
     if(this.room)
1069 1069
         return this.room.getPhonePin();
1070 1070
     return null;
1071
-}
1071
+};
1072 1072
 
1073 1073
 /**
1074 1074
  * Returns the connection state for the current room. Its ice connection state
@@ -1078,7 +1078,7 @@ JitsiConference.prototype.getConnectionState = function () {
1078 1078
     if(this.room)
1079 1079
         return this.room.getConnectionState();
1080 1080
     return null;
1081
-}
1081
+};
1082 1082
 
1083 1083
 /**
1084 1084
  * Make all new participants mute their audio/video on join.
@@ -1169,7 +1169,7 @@ JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1169 1169
 JitsiConference.prototype.sendFeedback =
1170 1170
 function(overallFeedback, detailedFeedback){
1171 1171
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1172
-}
1172
+};
1173 1173
 
1174 1174
 /**
1175 1175
  * Returns true if the callstats integration is enabled, otherwise returns
@@ -1180,7 +1180,7 @@ function(overallFeedback, detailedFeedback){
1180 1180
  */
1181 1181
 JitsiConference.prototype.isCallstatsEnabled = function () {
1182 1182
     return this.statistics.isCallstatsEnabled();
1183
-}
1183
+};
1184 1184
 
1185 1185
 
1186 1186
 /**
@@ -1196,7 +1196,7 @@ JitsiConference.prototype._onTrackAttach = function(track, container) {
1196 1196
     }
1197 1197
     this.statistics.associateStreamWithVideoTag(
1198 1198
         ssrc, track.isLocal(), track.getUsageLabel(), container.id);
1199
-}
1199
+};
1200 1200
 
1201 1201
 /**
1202 1202
  * Reports detected audio problem with the media stream related to the passed
@@ -1252,7 +1252,7 @@ JitsiConference.prototype._reportAudioProblem = function (ssrc) {
1252 1252
             id: mtrack.id,
1253 1253
             label: mtrack.label,
1254 1254
             muted: mtrack.muted
1255
-        }
1255
+        };
1256 1256
         logger.log("enabled: ", mtrack.enabled);
1257 1257
         logger.log("id: ", mtrack.id);
1258 1258
         logger.log("label: ", mtrack.label);
@@ -1334,7 +1334,7 @@ JitsiConference.prototype._fireIncompatibleVersionsEvent = function () {
1334 1334
  */
1335 1335
 JitsiConference.prototype.sendEndpointMessage = function (to, payload) {
1336 1336
     this.rtc.sendDataChannelMessage(to, payload);
1337
-}
1337
+};
1338 1338
 
1339 1339
 /**
1340 1340
  * Sends broadcast message via the datachannels.
@@ -1343,6 +1343,6 @@ JitsiConference.prototype.sendEndpointMessage = function (to, payload) {
1343 1343
  */
1344 1344
 JitsiConference.prototype.broadcastEndpointMessage = function (payload) {
1345 1345
     this.sendEndpointMessage("", payload);
1346
-}
1346
+};
1347 1347
 
1348 1348
 module.exports = JitsiConference;

+ 1
- 1
JitsiConferenceEventManager.js Bestand weergeven

@@ -158,7 +158,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
158 158
         });
159 159
 
160 160
     chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
161
-        function (pc) {
161
+        function () {
162 162
             chatRoom.eventEmitter.emit(
163 163
                 XMPPEvents.CONFERENCE_SETUP_FAILED,
164 164
                 new Error("ICE fail"));

+ 7
- 8
JitsiConnection.js Bestand weergeven

@@ -1,5 +1,4 @@
1 1
 var JitsiConference = require("./JitsiConference");
2
-import * as JitsiConnectionErrors from "./JitsiConnectionErrors";
3 2
 import * as JitsiConnectionEvents from "./JitsiConnectionEvents";
4 3
 import XMPP from "./modules/xmpp/xmpp";
5 4
 var Statistics = require("./modules/statistics/statistics");
@@ -48,7 +47,7 @@ JitsiConnection.prototype.connect = function (options) {
48 47
         options = {};
49 48
 
50 49
     this.xmpp.connect(options.id, options.password);
51
-}
50
+};
52 51
 
53 52
 /**
54 53
  * Attach to existing connection. Can be used for optimizations. For example:
@@ -59,7 +58,7 @@ JitsiConnection.prototype.connect = function (options) {
59 58
  */
60 59
 JitsiConnection.prototype.attach = function (options) {
61 60
     this.xmpp.attach(options);
62
-}
61
+};
63 62
 
64 63
 /**
65 64
  * Disconnect the client from the server.
@@ -72,7 +71,7 @@ JitsiConnection.prototype.disconnect = function () {
72 71
     var x = this.xmpp;
73 72
 
74 73
     x.disconnect.apply(x, arguments);
75
-}
74
+};
76 75
 
77 76
 /**
78 77
  * This method allows renewal of the tokens if they are expiring.
@@ -80,7 +79,7 @@ JitsiConnection.prototype.disconnect = function () {
80 79
  */
81 80
 JitsiConnection.prototype.setToken = function (token) {
82 81
     this.token = token;
83
-}
82
+};
84 83
 
85 84
 /**
86 85
  * Creates and joins new conference.
@@ -95,7 +94,7 @@ JitsiConnection.prototype.initJitsiConference = function (name, options) {
95 94
         = new JitsiConference({name: name, config: options, connection: this});
96 95
     this.conferences[name] = conference;
97 96
     return conference;
98
-}
97
+};
99 98
 
100 99
 /**
101 100
  * Subscribes the passed listener to the event.
@@ -104,7 +103,7 @@ JitsiConnection.prototype.initJitsiConference = function (name, options) {
104 103
  */
105 104
 JitsiConnection.prototype.addEventListener = function (event, listener) {
106 105
     this.xmpp.addListener(event, listener);
107
-}
106
+};
108 107
 
109 108
 /**
110 109
  * Unsubscribes the passed handler.
@@ -113,7 +112,7 @@ JitsiConnection.prototype.addEventListener = function (event, listener) {
113 112
  */
114 113
 JitsiConnection.prototype.removeEventListener = function (event, listener) {
115 114
     this.xmpp.removeListener(event, listener);
116
-}
115
+};
117 116
 
118 117
 /**
119 118
  * Returns measured connectionTimes.

+ 1
- 1
JitsiMediaDevices.js Bestand weergeven

@@ -130,7 +130,7 @@ var JitsiMediaDevices = {
130 130
      * Emits an event.
131 131
      * @param {string} event - event name
132 132
      */
133
-    emitEvent: function (event) {
133
+    emitEvent: function (event) { // eslint-disable-line no-unused-vars
134 134
         eventEmitter.emit.apply(eventEmitter, arguments);
135 135
     }
136 136
 };

+ 9
- 9
JitsiMeetJS.js Bestand weergeven

@@ -31,7 +31,7 @@ function getLowerResolution(resolution) {
31 31
     var order = Resolutions[resolution].order;
32 32
     var res = null;
33 33
     var resName = null;
34
-    for(var i in Resolutions) {
34
+    for(let i in Resolutions) {
35 35
         var tmp = Resolutions[i];
36 36
         if (!res || (res.order < tmp.order && tmp.order < order)) {
37 37
             resName = i;
@@ -91,7 +91,7 @@ var LibJitsiMeet = {
91 91
     mediaDevices: JitsiMediaDevices,
92 92
     analytics: null,
93 93
     init: function (options) {
94
-        var logObject, attr;
94
+        let logObject, attr;
95 95
         Statistics.init(options);
96 96
         this.analytics = Statistics.analytics;
97 97
 
@@ -119,7 +119,7 @@ var LibJitsiMeet = {
119 119
                 id: "component_version",
120 120
                 component: "lib-jitsi-meet",
121 121
                 version: this.version
122
-            }
122
+            };
123 123
             Statistics.sendLog(JSON.stringify(logObject));
124 124
         }
125 125
 
@@ -203,8 +203,8 @@ var LibJitsiMeet = {
203 203
                     "getUserMedia.success", options), options);
204 204
 
205 205
                 if(!RTC.options.disableAudioLevels)
206
-                    for(var i = 0; i < tracks.length; i++) {
207
-                        var track = tracks[i];
206
+                    for(let i = 0; i < tracks.length; i++) {
207
+                        const track = tracks[i];
208 208
                         var mStream = track.getOriginalStream();
209 209
                         if(track.getType() === MediaType.AUDIO){
210 210
                             Statistics.startLocalStats(mStream,
@@ -221,8 +221,8 @@ var LibJitsiMeet = {
221 221
                 var currentlyAvailableMediaDevices
222 222
                     = RTC.getCurrentlyAvailableMediaDevices();
223 223
                 if (currentlyAvailableMediaDevices) {
224
-                    for(var i = 0; i < tracks.length; i++) {
225
-                        var track = tracks[i];
224
+                    for(let i = 0; i < tracks.length; i++) {
225
+                        const track = tracks[i];
226 226
                         track._setRealDeviceIdFromDeviceList(
227 227
                             currentlyAvailableMediaDevices);
228 228
                     }
@@ -254,7 +254,7 @@ var LibJitsiMeet = {
254 254
                     // User cancelled action is not really an error, so only
255 255
                     // log it as an event to avoid having conference classified
256 256
                     // as partially failed
257
-                    var logObject = {
257
+                    const logObject = {
258 258
                         id: "chrome_extension_user_canceled",
259 259
                         message: error.message
260 260
                     };
@@ -263,7 +263,7 @@ var LibJitsiMeet = {
263 263
                         "getUserMedia.userCancel.extensionInstall");
264 264
                 } else if (JitsiTrackErrors.NOT_FOUND === error.name) {
265 265
                     // logs not found devices with just application log to cs
266
-                    var logObject = {
266
+                    const logObject = {
267 267
                         id: "usermedia_missing_device",
268 268
                         status: error.gum.devices
269 269
                     };

+ 4
- 2
connection_optimization/external_connect.js Bestand weergeven

@@ -20,8 +20,10 @@
20 20
  * callback is going to receive one parameter which is going to be JS error
21 21
  * object with a reason for failure in it.
22 22
  */
23
-function createConnectionExternally(webserviceUrl, success_callback,
24
-    error_callback) {
23
+function createConnectionExternally( // eslint-disable-line no-unused-vars
24
+        webserviceUrl,
25
+        success_callback,
26
+        error_callback) {
25 27
     if (!window.XMLHttpRequest) {
26 28
         error_callback(new Error("XMLHttpRequest is not supported!"));
27 29
         return;

+ 14
- 13
doc/example/example.js Bestand weergeven

@@ -1,3 +1,5 @@
1
+/* global $, JitsiMeetJS */
2
+
1 3
 var options = {
2 4
     hosts: {
3 5
         domain: 'jitsi-meet.example.com',
@@ -5,12 +7,11 @@ var options = {
5 7
     },
6 8
     bosh: '//jitsi-meet.example.com/http-bind', // FIXME: use xep-0156 for that
7 9
     clientNode: 'http://jitsi.org/jitsimeet', // The name of client node advertised in XEP-0115 'c' stanza
8
-}
10
+};
9 11
 
10 12
 var confOptions = {
11 13
     openSctp: true
12
-}
13
-
14
+};
14 15
 
15 16
 var isJoined = false;
16 17
 
@@ -103,7 +104,7 @@ function onUserLeft(id) {
103 104
         return;
104 105
     var tracks = remoteTracks[id];
105 106
     for(var i = 0; i< tracks.length; i++)
106
-        tracks[i].detach($("#" + id + tracks[i].getType()))
107
+        tracks[i].detach($("#" + id + tracks[i].getType()));
107 108
 }
108 109
 
109 110
 /**
@@ -139,12 +140,14 @@ function onConnectionSuccess(){
139 140
             room.getPhonePin());
140 141
     });
141 142
     room.join();
142
-};
143
+}
143 144
 
144 145
 /**
145 146
  * This function is called when the connection fail.
146 147
  */
147
-function onConnectionFailed(){console.error("Connection Failed!")};
148
+function onConnectionFailed() {
149
+    console.error("Connection Failed!");
150
+}
148 151
 
149 152
 /**
150 153
  * This function is called when the connection fail.
@@ -169,8 +172,9 @@ function unload() {
169 172
     room.leave();
170 173
     connection.disconnect();
171 174
 }
175
+
172 176
 var isVideo = true;
173
-function switchVideo() {
177
+function switchVideo() { // eslint-disable-line no-unused-vars
174 178
     isVideo = !isVideo;
175 179
     if(localTracks[1]) {
176 180
         localTracks[1].dispose();
@@ -194,15 +198,13 @@ function switchVideo() {
194 198
         });
195 199
 }
196 200
 
197
-function changeAudioOutput(selected) {
201
+function changeAudioOutput(selected) { // eslint-disable-line no-unused-vars
198 202
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(selected.value);
199 203
 }
200 204
 
201 205
 $(window).bind('beforeunload', unload);
202 206
 $(window).bind('unload', unload);
203 207
 
204
-
205
-
206 208
 // JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
207 209
 var initOptions = {
208 210
     disableAudioLevels: true,
@@ -229,7 +231,7 @@ var initOptions = {
229 231
     desktopSharingFirefoxMaxVersionExtRequired: -1,
230 232
     // The URL to the Firefox extension for desktop sharing.
231 233
     desktopSharingFirefoxExtensionURL: null
232
-}
234
+};
233 235
 JitsiMeetJS.init(initOptions).then(function(){
234 236
     connection = new JitsiMeetJS.JitsiConnection(null, null, options);
235 237
 
@@ -248,7 +250,6 @@ JitsiMeetJS.init(initOptions).then(function(){
248 250
     console.log(error);
249 251
 });
250 252
 
251
-
252 253
 if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
253 254
     JitsiMeetJS.mediaDevices.enumerateDevices(function(devices) {
254 255
         var audioOutputDevices = devices.filter(function(d) { return d.kind === 'audiooutput'; });
@@ -262,7 +263,7 @@ if (JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
262 263
 
263 264
             $('#audioOutputSelectWrapper').show();
264 265
         }
265
-    })
266
+    });
266 267
 }
267 268
 
268 269
 var connection = null;

+ 5
- 9
modules/RTC/DataChannels.js Bestand weergeven

@@ -1,5 +1,3 @@
1
-/* global config, APP, Strophe */
2
-
3 1
 // cache datachannels to avoid garbage collection
4 2
 // https://code.google.com/p/chromium/issues/detail?id=405545
5 3
 
@@ -7,7 +5,6 @@ var logger = require("jitsi-meet-logger").getLogger(__filename);
7 5
 var RTCEvents = require("../../service/RTC/RTCEvents");
8 6
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
9 7
 
10
-
11 8
 /**
12 9
  * Binds "ondatachannel" event listener to given PeerConnection instance.
13 10
  * @param peerConnection WebRTC peer connection instance.
@@ -40,8 +37,7 @@ function DataChannels(peerConnection, emitter) {
40 37
      var msgData = event.data;
41 38
      logger.info("Got My Data Channel Message:", msgData, dataChannel);
42 39
      };*/
43
-};
44
-
40
+}
45 41
 
46 42
 /**
47 43
  * Callback triggered by PeerConnection when new data channel is opened
@@ -65,11 +61,11 @@ DataChannels.prototype.onDataChannel = function (event) {
65 61
     };
66 62
 
67 63
     dataChannel.onerror = function (error) {
68
-        var e = new Error("Data Channel Error:" + error);
69 64
         // FIXME: this one seems to be generated a bit too often right now
70 65
         // so we are temporarily commenting it before we have more clarity
71 66
         // on which of the errors we absolutely need to report
72
-        //GlobalOnErrorHandler.callErrorHandler(e);
67
+        //GlobalOnErrorHandler.callErrorHandler(
68
+        //        new Error("Data Channel Error:" + error));
73 69
         logger.error("Data Channel Error:", error, dataChannel);
74 70
     };
75 71
 
@@ -267,7 +263,7 @@ DataChannels.prototype.send = function (jsonObject) {
267 263
     })) {
268 264
         throw new Error("No opened data channels found!");
269 265
     }
270
-}
266
+};
271 267
 
272 268
 /**
273 269
  * Sends message via the datachannels.
@@ -284,6 +280,6 @@ DataChannels.prototype.sendDataChannelMessage = function (to, payload) {
284 280
         to: to,
285 281
         msgPayload: payload
286 282
     });
287
-}
283
+};
288 284
 
289 285
 module.exports = DataChannels;

+ 7
- 7
modules/RTC/JitsiLocalTrack.js Bestand weergeven

@@ -164,7 +164,7 @@ JitsiLocalTrack.prototype._clearNoDataFromSourceMuteResources = function () {
164 164
         this._noDataFromSourceTimeout = null;
165 165
     }
166 166
     this._setHandler("track_unmute", undefined);
167
-}
167
+};
168 168
 
169 169
 /**
170 170
  * Called when potential camera issue is detected. Clears the handlers and
@@ -175,7 +175,7 @@ JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
175 175
     this._clearNoDataFromSourceMuteResources();
176 176
     if(this._checkForCameraIssues())
177 177
         this._fireNoDataFromSourceEvent();
178
-}
178
+};
179 179
 
180 180
 /**
181 181
  * Fires JitsiTrackEvents.NO_DATA_FROM_SOURCE and logs it to analytics and
@@ -184,7 +184,7 @@ JitsiLocalTrack.prototype._onNoDataFromSourceError = function () {
184 184
 JitsiLocalTrack.prototype._fireNoDataFromSourceEvent = function () {
185 185
     this.eventEmitter.emit(JitsiTrackEvents.NO_DATA_FROM_SOURCE);
186 186
     Statistics.sendEventToAll(this.getType() + ".no_data_from_source");
187
-}
187
+};
188 188
 
189 189
 /**
190 190
  * Sets real device ID by comparing track information with device information.
@@ -545,7 +545,7 @@ JitsiLocalTrack.prototype._setByteSent = function (bytesSent) {
545 545
         }.bind(this), 3000);
546 546
         this._testByteSent = false;
547 547
     }
548
-}
548
+};
549 549
 
550 550
 /**
551 551
  * Returns facing mode for video track from camera. For other cases (e.g. audio
@@ -595,7 +595,7 @@ JitsiLocalTrack.prototype._stopMediaStream = function () {
595 595
     this.stopStreamInProgress = true;
596 596
     RTCUtils.stopMediaStream(this.stream);
597 597
     this.stopStreamInProgress = false;
598
-}
598
+};
599 599
 
600 600
 /**
601 601
  * Detects camera issues on ended and mute events from MediaStreamTrack.
@@ -607,7 +607,7 @@ JitsiLocalTrack.prototype._checkForCameraIssues = function () {
607 607
         return false;
608 608
 
609 609
     return !this._isReceivingData();
610
-}
610
+};
611 611
 
612 612
 /**
613 613
  * Checks whether the attached MediaStream is reveiving data from source or
@@ -631,6 +631,6 @@ JitsiLocalTrack.prototype._isReceivingData = function () {
631 631
     return this.stream.getTracks().some(track =>
632 632
         ((!("readyState" in track) || track.readyState === "live")
633 633
             && (!("muted" in track) || track.muted === false)));
634
-}
634
+};
635 635
 
636 636
 module.exports = JitsiLocalTrack;

+ 2
- 2
modules/RTC/JitsiRemoteTrack.js Bestand weergeven

@@ -1,8 +1,8 @@
1
-/* global __filename, module */
2
-var logger = require("jitsi-meet-logger").getLogger(__filename);
1
+/* global Strophe */
3 2
 
4 3
 var JitsiTrack = require("./JitsiTrack");
5 4
 import * as JitsiTrackEvents from "../../JitsiTrackEvents";
5
+var logger = require("jitsi-meet-logger").getLogger(__filename);
6 6
 var RTCBrowserType = require("./RTCBrowserType");
7 7
 var RTCEvents = require("../../service/RTC/RTCEvents");
8 8
 var Statistics = require("../statistics/statistics");

+ 3
- 3
modules/RTC/JitsiTrack.js Bestand weergeven

@@ -1,7 +1,6 @@
1 1
 /* global __filename, module */
2 2
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3 3
 var RTCBrowserType = require("./RTCBrowserType");
4
-var RTCEvents = require("../../service/RTC/RTCEvents");
5 4
 var RTCUtils = require("./RTCUtils");
6 5
 import * as JitsiTrackEvents from "../../JitsiTrackEvents";
7 6
 var EventEmitter = require("events");
@@ -113,7 +112,7 @@ JitsiTrack.prototype._setHandler = function (type, handler) {
113 112
             track[trackHandler2Prop[type]] = handler;
114 113
         }, this);
115 114
     }
116
-}
115
+};
117 116
 
118 117
 /**
119 118
  * Sets the stream property of JitsiTrack object and sets all stored handlers
@@ -126,7 +125,7 @@ JitsiTrack.prototype._setStream = function (stream) {
126 125
         typeof(this.handlers[type]) === "function" &&
127 126
             this._setHandler(type, this.handlers[type]);
128 127
     }, this);
129
-}
128
+};
130 129
 
131 130
 /**
132 131
  * Returns the type (audio or video) of this track.
@@ -275,6 +274,7 @@ JitsiTrack.prototype.detach = function (container) {
275 274
  *        method has been called previously on video or audio HTML element.
276 275
  * @private
277 276
  */
277
+// eslint-disable-next-line no-unused-vars
278 278
 JitsiTrack.prototype._attachTTFMTracker = function (container) {
279 279
 };
280 280
 

+ 6
- 7
modules/RTC/RTC.js Bestand weergeven

@@ -1,10 +1,9 @@
1
-/* global __filename, APP, module */
1
+/* global Strophe */
2
+
2 3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3 4
 var EventEmitter = require("events");
4
-var RTCBrowserType = require("./RTCBrowserType");
5 5
 var RTCEvents = require("../../service/RTC/RTCEvents.js");
6 6
 var RTCUtils = require("./RTCUtils.js");
7
-var JitsiTrack = require("./JitsiTrack");
8 7
 var JitsiLocalTrack = require("./JitsiLocalTrack.js");
9 8
 import JitsiTrackError from "../../JitsiTrackError";
10 9
 import * as JitsiTrackErrors from "../../JitsiTrackErrors";
@@ -184,7 +183,7 @@ RTC.addListener = function (eventType, listener) {
184 183
 };
185 184
 
186 185
 RTC.removeListener = function (eventType, listener) {
187
-    RTCUtils.removeListener(eventType, listener)
186
+    RTCUtils.removeListener(eventType, listener);
188 187
 };
189 188
 
190 189
 RTC.isRTCReady = function () {
@@ -548,7 +547,7 @@ RTC.prototype.handleRemoteTrackMute = function (type, isMuted, from) {
548 547
     if (track) {
549 548
         track.setMute(isMuted);
550 549
     }
551
-}
550
+};
552 551
 
553 552
 /**
554 553
  * Handles remote track video type events
@@ -560,7 +559,7 @@ RTC.prototype.handleRemoteTrackVideoTypeChanged = function (value, from) {
560 559
     if (videoTrack) {
561 560
         videoTrack._setVideoType(value);
562 561
     }
563
-}
562
+};
564 563
 
565 564
 /**
566 565
  * Sends message via the datachannels.
@@ -576,6 +575,6 @@ RTC.prototype.sendDataChannelMessage = function (to, payload) {
576 575
     } else {
577 576
         throw new Error("Data channels support is disabled!");
578 577
     }
579
-}
578
+};
580 579
 
581 580
 module.exports = RTC;

+ 3
- 3
modules/RTC/RTCUIHelper.js Bestand weergeven

@@ -1,7 +1,7 @@
1
-/* global $, __filename */
1
+/* global $ */
2
+
2 3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3 4
 var RTCBrowserType = require("./RTCBrowserType");
4
-var RTC = require('./RTC');
5 5
 
6 6
 var RTCUIHelper = {
7 7
 
@@ -58,7 +58,7 @@ var RTCUIHelper = {
58 58
      */
59 59
     setAutoPlay: function (streamElement, autoPlay) {
60 60
         if (!RTCBrowserType.isIExplorer()) {
61
-            streamElement.autoplay = true;
61
+            streamElement.autoplay = autoPlay;
62 62
         }
63 63
     }
64 64
 };

+ 20
- 14
modules/RTC/RTCUtils.js Bestand weergeven

@@ -1,9 +1,16 @@
1
-/* global config, require, attachMediaStream, getUserMedia,
2
-   RTCPeerConnection, RTCSessionDescription, RTCIceCandidate, MediaStreamTrack,
3
-   mozRTCPeerConnection, mozRTCSessionDescription, mozRTCIceCandidate,
4
-   webkitRTCPeerConnection, webkitMediaStream, webkitURL
1
+/* global $,
2
+          attachMediaStream,
3
+          MediaStreamTrack,
4
+          RTCIceCandidate,
5
+          RTCPeerConnection,
6
+          RTCSessionDescription,
7
+          mozRTCIceCandidate,
8
+          mozRTCPeerConnection,
9
+          mozRTCSessionDescription,
10
+          webkitMediaStream,
11
+          webkitRTCPeerConnection,
12
+          webkitURL
5 13
 */
6
-/* jshint -W101 */
7 14
 
8 15
 var logger = require("jitsi-meet-logger").getLogger(__filename);
9 16
 var RTCBrowserType = require("./RTCBrowserType");
@@ -14,7 +21,6 @@ var SDPUtil = require("../xmpp/SDPUtil");
14 21
 var EventEmitter = require("events");
15 22
 var screenObtainer = require("./ScreenObtainer");
16 23
 import JitsiTrackError from "../../JitsiTrackError";
17
-import * as JitsiTrackErrors from "../../JitsiTrackErrors";
18 24
 var MediaType = require("../../service/RTC/MediaType");
19 25
 var VideoType = require("../../service/RTC/VideoType");
20 26
 var CameraFacingMode = require("../../service/RTC/CameraFacingMode");
@@ -586,6 +592,7 @@ function handleLocalStream(streams, resolution) {
586 592
         if (audioVideo) {
587 593
             var audioTracks = audioVideo.getAudioTracks();
588 594
             if (audioTracks.length) {
595
+                // eslint-disable-next-line new-cap
589 596
                 audioStream = new webkitMediaStream();
590 597
                 for (var i = 0; i < audioTracks.length; i++) {
591 598
                     audioStream.addTrack(audioTracks[i]);
@@ -594,6 +601,7 @@ function handleLocalStream(streams, resolution) {
594 601
 
595 602
             var videoTracks = audioVideo.getVideoTracks();
596 603
             if (videoTracks.length) {
604
+                // eslint-disable-next-line new-cap
597 605
                 videoStream = new webkitMediaStream();
598 606
                 for (var j = 0; j < videoTracks.length; j++) {
599 607
                     videoStream.addTrack(videoTracks[j]);
@@ -670,7 +678,7 @@ function wrapAttachMediaStream(origAttachMediaStream) {
670 678
         }
671 679
 
672 680
         return res;
673
-    }
681
+    };
674 682
 }
675 683
 
676 684
 /**
@@ -777,8 +785,10 @@ var RTCUtils = {
777 785
                     }
778 786
                     return SDPUtil.filter_special_chars(id);
779 787
                 };
788
+                /* eslint-disable no-native-reassign */
780 789
                 RTCSessionDescription = mozRTCSessionDescription;
781 790
                 RTCIceCandidate = mozRTCIceCandidate;
791
+                /* eslint-enable no-native-reassign */
782 792
             } else if (RTCBrowserType.isChrome() ||
783 793
                     RTCBrowserType.isOpera() ||
784 794
                     RTCBrowserType.isNWJS() ||
@@ -842,7 +852,7 @@ var RTCUtils = {
842 852
                 //AdapterJS.WebRTCPlugin.setLogLevel(
843 853
                 //    AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS.VERBOSE);
844 854
                 var self = this;
845
-                AdapterJS.webRTCReady(function (isPlugin) {
855
+                AdapterJS.webRTCReady(function () {
846 856
 
847 857
                     self.peerconnection = RTCPeerConnection;
848 858
                     self.getUserMedia = window.getUserMedia;
@@ -881,10 +891,7 @@ var RTCUtils = {
881 891
                 });
882 892
             } else {
883 893
                 var errmsg = 'Browser does not appear to be WebRTC-capable';
884
-                try {
885
-                    logger.error(errmsg);
886
-                } catch (e) {
887
-                }
894
+                logger.error(errmsg);
888 895
                 reject(new Error(errmsg));
889 896
                 return;
890 897
             }
@@ -910,7 +917,6 @@ var RTCUtils = {
910 917
     **/
911 918
     getUserMediaWithConstraints: function ( um, success_callback, failure_callback, options) {
912 919
         options = options || {};
913
-        var resolution = options.resolution;
914 920
         var constraints = getConstraints(um, options);
915 921
 
916 922
         logger.info("Get media constraints", constraints);
@@ -1051,7 +1057,7 @@ var RTCUtils = {
1051 1057
                                 // set to not ask for permissions)
1052 1058
                                 self.getUserMediaWithConstraints(
1053 1059
                                     devices,
1054
-                                    function (stream) {
1060
+                                    function () {
1055 1061
                                         // we already failed to obtain this
1056 1062
                                         // media, so we are not supposed in any
1057 1063
                                         // way to receive success for this call

+ 5
- 5
modules/RTC/ScreenObtainer.js Bestand weergeven

@@ -1,5 +1,5 @@
1 1
 /* global chrome, $, alert */
2
-/* jshint -W003 */
2
+
3 3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
4 4
 var RTCBrowserType = require("./RTCBrowserType");
5 5
 var AdapterJS = require("./adapter.screenshare");
@@ -40,14 +40,14 @@ var GUM = null;
40 40
  * The error returned by chrome when trying to start inline installation from
41 41
  * popup.
42 42
  */
43
-var CHROME_EXTENSION_POPUP_ERROR =
44
-    "Inline installs can not be initiated from pop-up windows.";
43
+const CHROME_EXTENSION_POPUP_ERROR
44
+    = "Inline installs can not be initiated from pop-up windows.";
45 45
 
46 46
 /**
47 47
  * The error message returned by chrome when the extension is installed.
48 48
  */
49
-var CHROME_NO_EXTENSION_ERROR_MSG =
50
-    "Could not establish connection. Receiving end does not exist.";
49
+const CHROME_NO_EXTENSION_ERROR_MSG // eslint-disable-line no-unused-vars
50
+    = "Could not establish connection. Receiving end does not exist.";
51 51
 
52 52
 /**
53 53
  * Handles obtaining a stream from a screen capture on different browsers.

+ 4
- 4
modules/statistics/AnalyticsAdapter.js Bestand weergeven

@@ -34,9 +34,9 @@ AnalyticsAdapter.prototype.sendEvent = function (action, data, label) {
34 34
         }
35 35
     }
36 36
     try {
37
-        this.analytics.sendEvent(
38
-            action, data, label, this.browserName);
39
-    } catch (ignored) {}
37
+        this.analytics.sendEvent(action, data, label, this.browserName);
38
+    } catch (ignored) { // eslint-disable-line no-empty
39
+    }
40 40
 };
41 41
 
42 42
 /**
@@ -65,4 +65,4 @@ AnalyticsAdapter.prototype.loaded = function () {
65 65
     }
66 66
 };
67 67
 
68
-module.exports = new AnalyticsAdapter();
68
+module.exports = new AnalyticsAdapter();

+ 1
- 1
modules/statistics/CallStats.js Bestand weergeven

@@ -139,7 +139,7 @@ function _try_catch (f) {
139 139
 var CallStats = _try_catch(function(jingleSession, Settings, options) {
140 140
     try{
141 141
         CallStats.feedbackEnabled = false;
142
-        callStats = new callstats($, io, jsSHA);
142
+        callStats = new callstats($, io, jsSHA); // eslint-disable-line new-cap
143 143
 
144 144
         this.session = jingleSession;
145 145
         this.peerconnection = jingleSession.peerconnection.peerconnection;

+ 0
- 1
modules/statistics/LocalStatsCollector.js Bestand weergeven

@@ -1,4 +1,3 @@
1
-/* global config */
2 1
 /**
3 2
  * Provides statistics for the local stream.
4 3
  */

+ 4
- 5
modules/statistics/RTPStatsCollector.js Bestand weergeven

@@ -1,5 +1,4 @@
1 1
 /* global require */
2
-/* jshint -W101 */
3 2
 
4 3
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
5 4
 var logger = require("jitsi-meet-logger").getLogger(__filename);
@@ -468,7 +467,7 @@ StatsCollector.prototype._defineGetStatValueMethod = function (keys) {
468 467
         // example, if item has a stat property of type function, then it's very
469 468
         // likely that whoever defined it wanted you to call it in order to
470 469
         // retrieve the value associated with a specific key.
471
-        itemStatByKey = function (item, key) { return item.stat(key) };
470
+        itemStatByKey = function (item, key) { return item.stat(key); };
472 471
         break;
473 472
     case RTCBrowserType.RTC_BROWSER_REACT_NATIVE:
474 473
         // The implementation provided by react-native-webrtc follows the
@@ -488,14 +487,14 @@ StatsCollector.prototype._defineGetStatValueMethod = function (keys) {
488 487
         };
489 488
         break;
490 489
     default:
491
-        itemStatByKey = function (item, key) { return item[key] };
490
+        itemStatByKey = function (item, key) { return item[key]; };
492 491
     }
493 492
 
494 493
     // Compose the 2 functions defined above to get a function which retrieves
495 494
     // the value from a specific report returned by RTCPeerConnection#getStats
496 495
     // associated with a specific LibJitsiMeet browser-agnostic name.
497 496
     return function (item, name) {
498
-        return itemStatByKey(item, keyFromName(name))
497
+        return itemStatByKey(item, keyFromName(name));
499 498
     };
500 499
 };
501 500
 
@@ -540,7 +539,7 @@ StatsCollector.prototype.processStatsReport = function () {
540 539
             var conferenceStatsTransport = this.conferenceStats.transport;
541 540
             if(!conferenceStatsTransport.some(function (t) { return (
542 541
                         t.ip == ip && t.type == type && t.localip == localip
543
-                    )})) {
542
+                    );})) {
544 543
                 conferenceStatsTransport.push(
545 544
                     {ip: ip, type: type, localip: localip});
546 545
             }

+ 4
- 3
modules/transcription/audioRecorder.js Bestand weergeven

@@ -1,4 +1,5 @@
1
-/* global APP, MediaRecorder, MediaStream, webkitMediaStream*/
1
+/* global MediaRecorder, MediaStream, webkitMediaStream */
2
+
2 3
 var RecordingResult = require("./recordingResult");
3 4
 
4 5
 /**
@@ -297,7 +298,7 @@ function createEmptyStream() {
297 298
         return new MediaStream();
298 299
     }
299 300
     else if(typeof(webkitMediaStream) !== 'undefined') {
300
-        return new webkitMediaStream();
301
+        return new webkitMediaStream(); // eslint-disable-line new-cap
301 302
     }
302 303
     else {
303 304
         throw new Error("cannot create a clean mediaStream");
@@ -307,4 +308,4 @@ function createEmptyStream() {
307 308
 /**
308 309
  * export the main object audioRecorder
309 310
  */
310
-module.exports = audioRecorder;
311
+module.exports = audioRecorder;

+ 4
- 1
modules/transcription/transcriptionServices/AbstractTranscriptionService.js Bestand weergeven

@@ -41,6 +41,7 @@ TranscriptionService.prototype.send = function send(recordingResult, callback){
41 41
  * @param {function} callback function which will retrieve the answer
42 42
  *                            from the service
43 43
  */
44
+// eslint-disable-next-line no-unused-vars
44 45
 TranscriptionService.prototype.sendRequest = function(audioBlob, callback) {
45 46
     throw new Error("TranscriptionService.sendRequest is abstract");
46 47
 };
@@ -60,6 +61,7 @@ TranscriptionService.prototype.sendRequest = function(audioBlob, callback) {
60 61
  *                 formatted
61 62
  * @return {Array<Word>} an array of Word objects
62 63
  */
64
+// eslint-disable-next-line no-unused-vars
63 65
 TranscriptionService.prototype.formatResponse = function(response){
64 66
     throw new Error("TranscriptionService.format is abstract");
65 67
 };
@@ -70,8 +72,9 @@ TranscriptionService.prototype.formatResponse = function(response){
70 72
  * @param response the response from the server
71 73
  * @return {boolean} true if response is valid, false otherwise
72 74
  */
75
+// eslint-disable-next-line no-unused-vars
73 76
 TranscriptionService.prototype.verify = function(response){
74 77
       throw new Error("TranscriptionService.verify is abstract");
75 78
 };
76 79
 
77
-module.exports = TranscriptionService;
80
+module.exports = TranscriptionService;

+ 2
- 2
modules/transcription/transcriptionServices/SphinxTranscriptionService.js Bestand weergeven

@@ -1,4 +1,4 @@
1
-/* global config,  XMLHttpRequest, console, APP, JSON */
1
+/* global config */
2 2
 
3 3
 var TranscriptionService = require("./AbstractTranscriptionService");
4 4
 var Word = require( "../word");
@@ -127,4 +127,4 @@ function getURL() {
127 127
     }
128 128
 }
129 129
 
130
-module.exports = SphinxService;
130
+module.exports = SphinxService;

+ 3
- 3
modules/transcription/word.js Bestand weergeven

@@ -2,9 +2,9 @@
2 2
  * An object representing a transcribed word, with some additional information
3 3
  * @param word the word 
4 4
  * @param begin the time the word was started being uttered
5
- * @param end the tome the word stopped being uttered
5
+ * @param end the time the word stopped being uttered
6 6
  */
7
-var Word = function (word, begin, end, name) {
7
+var Word = function (word, begin, end) {
8 8
     this.word = word;
9 9
     this.begin = begin;
10 10
     this.end = end;
@@ -34,4 +34,4 @@ Word.prototype.getEndTime = function () {
34 34
     return this.end;
35 35
 };
36 36
 
37
-module.exports = Word;
37
+module.exports = Word;

+ 0
- 2
modules/util/EventEmitterForwarder.js Bestand weergeven

@@ -1,5 +1,3 @@
1
-var EventEmitter = require("events");
2
-
3 1
 /**
4 2
  * Implements utility to forward events from one eventEmitter to another.
5 3
  * @param src {object} instance of EventEmitter or another class that implements

+ 19
- 22
modules/xmpp/ChatRoom.js Bestand weergeven

@@ -1,5 +1,5 @@
1 1
 /* global Strophe, $, $pres, $iq, $msg */
2
-/* jshint -W101,-W069 */
2
+
3 3
 import {getLogger} from "jitsi-meet-logger";
4 4
 const logger = getLogger(__filename);
5 5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
@@ -9,14 +9,12 @@ var EventEmitter = require("events");
9 9
 var Recorder = require("./recording");
10 10
 var GlobalOnErrorHandler = require("../util/GlobalOnErrorHandler");
11 11
 
12
-var JIBRI_XMLNS = 'http://jitsi.org/protocol/jibri';
13
-
14 12
 var parser = {
15 13
     packet2JSON: function (packet, nodes) {
16 14
         var self = this;
17
-        $(packet).children().each(function (index) {
15
+        $(packet).children().each(function () {
18 16
             var tagName = $(this).prop("tagName");
19
-            var node = {
17
+            const node = {
20 18
                 tagName: tagName
21 19
             };
22 20
             node.attributes = {};
@@ -33,8 +31,8 @@ var parser = {
33 31
         });
34 32
     },
35 33
     JSON2packet: function (nodes, packet) {
36
-        for(var i = 0; i < nodes.length; i++) {
37
-            var node = nodes[i];
34
+        for(let i = 0; i < nodes.length; i++) {
35
+            const node = nodes[i];
38 36
             if(!node || node === null){
39 37
                 continue;
40 38
             }
@@ -56,7 +54,7 @@ var parser = {
56 54
  */
57 55
 function filterNodeFromPresenceJSON(pres, nodeName){
58 56
     var res = [];
59
-    for(var i = 0; i < pres.length; i++)
57
+    for(let i = 0; i < pres.length; i++)
60 58
         if(pres[i].tagName === nodeName)
61 59
             res.push(pres[i]);
62 60
 
@@ -83,7 +81,6 @@ function ChatRoom(connection, jid, password, XMPP, options, settings) {
83 81
         settings, {connection: this.xmpp.options, conference: this.options});
84 82
     this.initPresenceMap();
85 83
     this.session = null;
86
-    var self = this;
87 84
     this.lastPresences = {};
88 85
     this.phoneNumber = null;
89 86
     this.phonePin = null;
@@ -276,18 +273,18 @@ ChatRoom.prototype.onPresence = function (pres) {
276 273
     member.isHiddenDomain
277 274
         = jid && jid.indexOf("@") > 0
278 275
             && this.options.hiddenDomain
279
-                === jid.substring(jid.indexOf("@") + 1, jid.indexOf("/"))
276
+                === jid.substring(jid.indexOf("@") + 1, jid.indexOf("/"));
280 277
 
281 278
     $(pres).find(">x").remove();
282 279
     var nodes = [];
283 280
     parser.packet2JSON(pres, nodes);
284 281
     this.lastPresences[from] = nodes;
285
-    var jibri = null;
282
+    let jibri = null;
286 283
     // process nodes to extract data needed for MUC_JOINED and MUC_MEMBER_JOINED
287 284
     // events
288
-    for(var i = 0; i < nodes.length; i++)
285
+    for(let i = 0; i < nodes.length; i++)
289 286
     {
290
-        var node = nodes[i];
287
+        const node = nodes[i];
291 288
         switch(node.tagName)
292 289
         {
293 290
             case "nick":
@@ -353,9 +350,9 @@ ChatRoom.prototype.onPresence = function (pres) {
353 350
 
354 351
     // after we had fired member or room joined events, lets fire events
355 352
     // for the rest info we got in presence
356
-    for(var i = 0; i < nodes.length; i++)
353
+    for(let i = 0; i < nodes.length; i++)
357 354
     {
358
-        var node = nodes[i];
355
+        const node = nodes[i];
359 356
         switch(node.tagName)
360 357
         {
361 358
             case "nick":
@@ -376,7 +373,7 @@ ChatRoom.prototype.onPresence = function (pres) {
376 373
                 }
377 374
                 break;
378 375
             case "jibri-recording-status":
379
-                var jibri = node;
376
+                jibri = node;
380 377
                 break;
381 378
             case "call-control":
382 379
                 var att = node.attributes;
@@ -419,7 +416,7 @@ ChatRoom.prototype._initFocus = function (from, mucJid) {
419 416
             this.recording.handleJibriPresence(this.lastJibri);
420 417
     }
421 418
     logger.info("Ignore focus: " + from + ", real JID: " + mucJid);
422
-}
419
+};
423 420
 
424 421
 /**
425 422
  * Sets the special listener to be used for "command"s whose name starts with
@@ -515,8 +512,8 @@ ChatRoom.prototype.onPresenceUnavailable = function (pres, from) {
515 512
     // If the status code is 110 this means we're leaving and we would like
516 513
     // to remove everyone else from our view, so we trigger the event.
517 514
     else if (Object.keys(this.members).length > 0) {
518
-        for (var i in this.members) {
519
-            var member = this.members[i];
515
+        for (const i in this.members) {
516
+            const member = this.members[i];
520 517
             delete this.members[i];
521 518
             this.onParticipantLeft(i, member.isFocus);
522 519
         }
@@ -752,7 +749,7 @@ ChatRoom.prototype.generateNewStreamSSRCInfo = function () {
752 749
     return this.session.generateNewStreamSSRCInfo();
753 750
 };
754 751
 
755
-ChatRoom.prototype.setVideoMute = function (mute, callback, options) {
752
+ChatRoom.prototype.setVideoMute = function (mute, callback) {
756 753
     this.sendVideoInfoPresence(mute);
757 754
     if(callback)
758 755
         callback(mute);
@@ -848,14 +845,14 @@ ChatRoom.prototype.isRecordingSupported = function () {
848 845
  */
849 846
 ChatRoom.prototype.getRecordingState = function () {
850 847
     return (this.recording) ? this.recording.getState() : undefined;
851
-}
848
+};
852 849
 
853 850
 /**
854 851
  * Returns the url of the recorded video.
855 852
  */
856 853
 ChatRoom.prototype.getRecordingURL = function () {
857 854
     return (this.recording) ? this.recording.getURL() : null;
858
-}
855
+};
859 856
 
860 857
 /**
861 858
  * Starts/stops the recording

+ 5
- 0
modules/xmpp/JingleSession.js Bestand weergeven

@@ -92,6 +92,7 @@ JingleSession.prototype.doInitialize = function() {};
92 92
  * Adds the ICE candidates found in the 'contents' array as remote candidates?
93 93
  * Note: currently only used on transport-info
94 94
  */
95
+// eslint-disable-next-line no-unused-vars
95 96
 JingleSession.prototype.addIceCandidates = function(contents) {};
96 97
 
97 98
 /**
@@ -109,6 +110,7 @@ JingleSession.prototype.active = function () {
109 110
  *
110 111
  * @param contents an array of Jingle 'content' elements.
111 112
  */
113
+// eslint-disable-next-line no-unused-vars
112 114
 JingleSession.prototype.addSources = function(contents) {};
113 115
 
114 116
 /**
@@ -116,6 +118,7 @@ JingleSession.prototype.addSources = function(contents) {};
116 118
  *
117 119
  * @param contents an array of Jingle 'content' elements.
118 120
  */
121
+// eslint-disable-next-line no-unused-vars
119 122
 JingleSession.prototype.removeSources = function(contents) {};
120 123
 
121 124
 /**
@@ -123,6 +126,7 @@ JingleSession.prototype.removeSources = function(contents) {};
123 126
  * @param reason XMPP Jingle error condition
124 127
  * @param text some meaningful error message
125 128
  */
129
+// eslint-disable-next-line no-unused-vars
126 130
 JingleSession.prototype.terminate = function(reason, text) {};
127 131
 
128 132
 /**
@@ -133,6 +137,7 @@ JingleSession.prototype.terminate = function(reason, text) {};
133 137
  *        object with details(which is meant more to be printed to the logger
134 138
  *        than analysed in the code, as the error is unrecoverable anyway)
135 139
  */
140
+// eslint-disable-next-line no-unused-vars
136 141
 JingleSession.prototype.acceptOffer = function(jingle, success, failure) {};
137 142
 
138 143
 module.exports = JingleSession;

+ 14
- 16
modules/xmpp/JingleSessionPC.js Bestand weergeven

@@ -1,9 +1,9 @@
1
-/* jshint -W117 */
1
+/* global $, $iq */
2
+
2 3
 import {getLogger} from "jitsi-meet-logger";
3 4
 const logger = getLogger(__filename);
4 5
 var JingleSession = require("./JingleSession");
5 6
 var TraceablePeerConnection = require("./TraceablePeerConnection");
6
-var MediaType = require("../../service/RTC/MediaType");
7 7
 var SDPDiffer = require("./SDPDiffer");
8 8
 var SDPUtil = require("./SDPUtil");
9 9
 var SDP = require("./SDP");
@@ -113,20 +113,19 @@ JingleSessionPC.prototype.doInitialize = function () {
113 113
     this.peerconnection.onremovestream = function (event) {
114 114
         self.remoteStreamRemoved(event.stream);
115 115
     };
116
-    this.peerconnection.onsignalingstatechange = function (event) {
116
+    this.peerconnection.onsignalingstatechange = function () {
117 117
         if (!(self && self.peerconnection)) return;
118 118
         if (self.peerconnection.signalingState === 'stable') {
119 119
             self.wasstable = true;
120 120
         }
121 121
     };
122 122
     /**
123
-     * The oniceconnectionstatechange event handler contains the code to execute when the iceconnectionstatechange event,
124
-     * of type Event, is received by this RTCPeerConnection. Such an event is sent when the value of
123
+     * The oniceconnectionstatechange event handler contains the code to execute
124
+     * when the iceconnectionstatechange event, of type Event, is received by
125
+     * this RTCPeerConnection. Such an event is sent when the value of
125 126
      * RTCPeerConnection.iceConnectionState changes.
126
-     *
127
-     * @param event the event containing information about the change
128 127
      */
129
-    this.peerconnection.oniceconnectionstatechange = function (event) {
128
+    this.peerconnection.oniceconnectionstatechange = function () {
130 129
         if (!(self && self.peerconnection)) return;
131 130
         var now = window.performance.now();
132 131
         self.room.connectionTimes["ice.state." +
@@ -158,7 +157,7 @@ JingleSessionPC.prototype.doInitialize = function () {
158 157
                 break;
159 158
         }
160 159
     };
161
-    this.peerconnection.onnegotiationneeded = function (event) {
160
+    this.peerconnection.onnegotiationneeded = function () {
162 161
         self.room.eventEmitter.emit(XMPPEvents.PEERCONNECTION_READY, self);
163 162
     };
164 163
 };
@@ -244,8 +243,6 @@ JingleSessionPC.prototype.sendIceCandidates = function (candidates) {
244 243
 JingleSessionPC.prototype.readSsrcInfo = function (contents) {
245 244
     var self = this;
246 245
     $(contents).each(function (idx, content) {
247
-        var name = $(content).attr('name');
248
-        var mediaType = this.getAttribute('name');
249 246
         var ssrcs = $(content).find('description>source[xmlns="urn:xmpp:jingle:apps:rtp:ssma:0"]');
250 247
         ssrcs.each(function () {
251 248
             var ssrc = this.getAttribute('ssrc');
@@ -578,7 +575,7 @@ JingleSessionPC.prototype.addSource = function (elem) {
578 575
     // FIXME: dirty waiting
579 576
     if (!this.peerconnection.localDescription)
580 577
     {
581
-        logger.warn("addSource - localDescription not ready yet")
578
+        logger.warn("addSource - localDescription not ready yet");
582 579
         setTimeout(function()
583 580
             {
584 581
                 self.addSource(elem);
@@ -787,6 +784,7 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
787 784
     this.removessrc = [];
788 785
 
789 786
     sdp.raw = sdp.session + sdp.media.join('');
787
+
790 788
     /**
791 789
      * Implements a failure callback which reports an error message and an
792 790
      * optional error through (1) logger, (2) GlobalOnErrorHandler, and (3)
@@ -805,7 +803,7 @@ JingleSessionPC.prototype._modifySources = function (successCallback, queueCallb
805 803
         }
806 804
         GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
807 805
         queueCallback(err);
808
-    };
806
+    }
809 807
 
810 808
     var ufrag = getUfrag(sdp.raw);
811 809
     if (ufrag != self.remoteUfrag) {
@@ -915,7 +913,7 @@ JingleSessionPC.prototype.addStream = function (stream, callback, errorCallback,
915 913
             errorCallback(error);
916 914
         }
917 915
     });
918
-}
916
+};
919 917
 
920 918
 /**
921 919
  * Generate ssrc info object for a stream with the following properties:
@@ -1019,7 +1017,7 @@ JingleSessionPC.prototype.removeStream = function (stream, callback, errorCallba
1019 1017
             errorCallback(error);
1020 1018
         }
1021 1019
     });
1022
-}
1020
+};
1023 1021
 
1024 1022
 /**
1025 1023
  * Figures out added/removed ssrcs and send update IQs.
@@ -1484,7 +1482,7 @@ function getUfrag(sdp) {
1484 1482
     var ufragLines = sdp.split('\n').filter(function(line) {
1485 1483
         return line.startsWith("a=ice-ufrag:");});
1486 1484
     if (ufragLines.length > 0) {
1487
-        return ufragLines[0].substr("a=ice-ufrag:".length)
1485
+        return ufragLines[0].substr("a=ice-ufrag:".length);
1488 1486
     }
1489 1487
 }
1490 1488
 

+ 5
- 9
modules/xmpp/SDP.js Bestand weergeven

@@ -1,6 +1,5 @@
1
-/* jshint -W117 */
2
-import {getLogger} from "jitsi-meet-logger";
3
-const logger = getLogger(__filename);
1
+/* global $, APP */
2
+
4 3
 var SDPUtil = require("./SDPUtil");
5 4
 
6 5
 // SDP STUFF
@@ -128,7 +127,7 @@ SDP.prototype.removeSessionLines = function(prefix) {
128 127
     });
129 128
     this.raw = this.session + this.media.join('');
130 129
     return lines;
131
-}
130
+};
132 131
 // remove lines matching prefix from a media section specified by mediaindex
133 132
 // TODO: non-numeric mediaindex could match mid
134 133
 SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
@@ -139,12 +138,10 @@ SDP.prototype.removeMediaLines = function(mediaindex, prefix) {
139 138
     });
140 139
     this.raw = this.session + this.media.join('');
141 140
     return lines;
142
-}
141
+};
143 142
 
144 143
 // add content's to a jingle element
145 144
 SDP.prototype.toJingle = function (elem, thecreator) {
146
-//    logger.log("SSRC" + ssrcs["audio"] + " - " + ssrcs["video"]);
147
-    var self = this;
148 145
     var i, j, k, mline, ssrc, rtpmap, tmp, lines;
149 146
     // new bundle plan
150 147
     lines = SDPUtil.find_lines(this.session, 'a=group:');
@@ -400,7 +397,7 @@ SDP.prototype.transportToJingle = function (mediaindex, elem) {
400 397
         }
401 398
     }
402 399
     elem.up(); // end of transport
403
-}
400
+};
404 401
 
405 402
 SDP.prototype.rtcpFbToJingle = function (mediaindex, elem, payloadtype) { // XEP-0293
406 403
     var lines = SDPUtil.find_lines(this.media[mediaindex], 'a=rtcp-fb:' + payloadtype);
@@ -482,7 +479,6 @@ SDP.prototype.fromJingle = function (jingle) {
482 479
 SDP.prototype.jingle2media = function (content) {
483 480
     var media = '',
484 481
         desc = content.find('description'),
485
-        ssrc = desc.attr('ssrc'),
486 482
         self = this,
487 483
         tmp;
488 484
     var sctp = content.find(

+ 14
- 10
modules/xmpp/TraceablePeerConnection.js Bestand weergeven

@@ -1,5 +1,6 @@
1
-/* global $ */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global mozRTCPeerConnection, webkitRTCPeerConnection */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3 4
 const logger = getLogger(__filename);
4 5
 var RTC = require('../RTC/RTC');
5 6
 var RTCBrowserType = require("../RTC/RTCBrowserType.js");
@@ -187,7 +188,7 @@ TraceablePeerConnection.prototype.ssrcReplacement = function (desc) {
187 188
             var ssrcOperation = SSRCs[0];
188 189
             switch(ssrcOperation.type) {
189 190
                 case "mute":
190
-                case "addMuted":
191
+                case "addMuted": {
191 192
                 //FIXME: If we want to support multiple streams we have to add
192 193
                 // recv-only ssrcs for the
193 194
                 // muted streams on every change until the stream is unmuted
@@ -195,8 +196,8 @@ TraceablePeerConnection.prototype.ssrcReplacement = function (desc) {
195 196
                 // in the SDP
196 197
                     if(!bLine.ssrcs)
197 198
                         bLine.ssrcs = [];
198
-                    var groups = ssrcOperation.ssrc.groups;
199
-                    var ssrc = null;
199
+                    const groups = ssrcOperation.ssrc.groups;
200
+                    let ssrc = null;
200 201
                     if(groups && groups.length) {
201 202
                         ssrc = groups[0].primarySSRC;
202 203
                     } else if(ssrcOperation.ssrc.ssrcs &&
@@ -219,14 +220,15 @@ TraceablePeerConnection.prototype.ssrcReplacement = function (desc) {
219 220
                     // only 1 video stream that is muted.
220 221
                     this.recvOnlySSRCs[bLine.type] = ssrc;
221 222
                     break;
222
-                case "unmute":
223
+                }
224
+                case "unmute": {
223 225
                     if(!ssrcOperation.ssrc || !ssrcOperation.ssrc.ssrcs ||
224 226
                         !ssrcOperation.ssrc.ssrcs.length)
225 227
                         break;
226 228
                     var ssrcMap = {};
227 229
                     var ssrcLastIdx = ssrcOperation.ssrc.ssrcs.length - 1;
228 230
                     for(var i = 0; i < bLine.ssrcs.length; i++) {
229
-                        var ssrc = bLine.ssrcs[i];
231
+                        const ssrc = bLine.ssrcs[i];
230 232
                         if (ssrc.attribute !== 'msid' &&
231 233
                             ssrc.value !== ssrcOperation.msid) {
232 234
                             continue;
@@ -237,7 +239,7 @@ TraceablePeerConnection.prototype.ssrcReplacement = function (desc) {
237 239
                         if(ssrcLastIdx < 0)
238 240
                             break;
239 241
                     }
240
-                    var groups = ssrcOperation.ssrc.groups;
242
+                    const groups = ssrcOperation.ssrc.groups;
241 243
                     if (typeof bLine.ssrcGroups !== 'undefined' &&
242 244
                         Array.isArray(bLine.ssrcGroups) && groups &&
243 245
                         groups.length) {
@@ -278,8 +280,9 @@ TraceablePeerConnection.prototype.ssrcReplacement = function (desc) {
278 280
                     // Storing the unmuted SSRCs.
279 281
                     permSSRCs.push(ssrcOperation);
280 282
                     break;
283
+                }
281 284
                 default:
282
-                break;
285
+                    break;
283 286
             }
284 287
             SSRCs = this.replaceSSRCs[bLine.type].splice(0,1);
285 288
         }
@@ -288,7 +291,7 @@ TraceablePeerConnection.prototype.ssrcReplacement = function (desc) {
288 291
 
289 292
         if (!Array.isArray(bLine.ssrcs) || bLine.ssrcs.length === 0)
290 293
         {
291
-            var ssrc = this.recvOnlySSRCs[bLine.type]
294
+            const ssrc = this.recvOnlySSRCs[bLine.type]
292 295
                 = this.recvOnlySSRCs[bLine.type] ||
293 296
                     RandomUtil.randomInt(1, 0xffffffff);
294 297
             bLine.ssrcs = [{
@@ -636,6 +639,7 @@ TraceablePeerConnection.prototype.createAnswer
636 639
 };
637 640
 
638 641
 TraceablePeerConnection.prototype.addIceCandidate
642
+        // eslint-disable-next-line no-unused-vars
639 643
         = function (candidate, successCallback, failureCallback) {
640 644
     //var self = this;
641 645
     this.trace('addIceCandidate', JSON.stringify(candidate, null, ' '));

+ 4
- 4
modules/xmpp/recording.js Bestand weergeven

@@ -1,6 +1,6 @@
1
-/* global $, $iq, config, connection, focusMucJid, messageHandler,
2
-   Toolbar, Util, Promise */
3
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $iq */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
4 4
 const logger = getLogger(__filename);
5 5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
6 6
 var JitsiRecorderErrors = require("../../JitsiRecorderErrors");
@@ -116,7 +116,7 @@ Recording.prototype.setRecordingJibri
116 116
 };
117 117
 
118 118
 Recording.prototype.setRecordingJirecon =
119
-    function (state, callback, errCallback, options) {
119
+    function (state, callback, errCallback) {
120 120
 
121 121
     if (state == this.state){
122 122
         errCallback(new Error("Invalid state!"));

+ 3
- 2
modules/xmpp/strophe.emuc.js Bestand weergeven

@@ -1,7 +1,9 @@
1
-/* jshint -W117 */
2 1
 /* a simple MUC connection plugin
3 2
  * can only handle a single MUC room
4 3
  */
4
+
5
+/* global $, Strophe */
6
+
5 7
 import {getLogger} from "jitsi-meet-logger";
6 8
 const logger = getLogger(__filename);
7 9
 import ChatRoom from "./ChatRoom";
@@ -35,7 +37,6 @@ class MucConnectionPlugin extends ConnectionPlugin {
35 37
             const errmsg = "You are already in the room!";
36 38
             logger.error(errmsg);
37 39
             throw new Error(errmsg);
38
-            return;
39 40
         }
40 41
         this.rooms[roomJid] = new ChatRoom(this.connection, jid,
41 42
             password, this.xmpp, options, settings);

+ 10
- 7
modules/xmpp/strophe.jingle.js Bestand weergeven

@@ -1,9 +1,9 @@
1
-/* jshint -W117 */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $iq, Strophe */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3 4
 const logger = getLogger(__filename);
4 5
 import JingleSession from "./JingleSessionPC";
5 6
 import XMPPEvents from "../../service/xmpp/XMPPEvents";
6
-import RTCBrowserType from "../RTC/RTCBrowserType";
7 7
 import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
8 8
 import Statistics from "../statistics/statistics";
9 9
 import ConnectionPlugin from "./ConnectionPlugin";
@@ -76,7 +76,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
76 76
         const now = window.performance.now();
77 77
         // see http://xmpp.org/extensions/xep-0166.html#concepts-session
78 78
         switch (action) {
79
-            case 'session-initiate':
79
+            case 'session-initiate': {
80 80
                 logger.log("(TIME) received session-initiate:\t", now);
81 81
                 const startMuted = $(iq).find('jingle>startmuted');
82 82
                 if (startMuted && startMuted.length > 0) {
@@ -112,7 +112,8 @@ class JingleConnectionPlugin extends ConnectionPlugin {
112 112
                 Statistics.analytics.sendEvent(
113 113
                     'xmpp.session-initiate', now);
114 114
                 break;
115
-            case 'session-terminate':
115
+            }
116
+            case 'session-terminate': {
116 117
                 logger.log('terminating...', sess.sid);
117 118
                 let reasonCondition = null;
118 119
                 let reasonText = null;
@@ -125,6 +126,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
125 126
                 this.eventEmitter.emit(XMPPEvents.CALL_ENDED,
126 127
                     sess, reasonCondition, reasonText);
127 128
                 break;
129
+            }
128 130
             case 'transport-replace':
129 131
                 logger.info("(TIME) Start transport replace", now);
130 132
                 Statistics.analytics.sendEvent(
@@ -203,7 +205,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
203 205
                             iceservers.push(dict);
204 206
                             break;
205 207
                         case 'turn':
206
-                        case 'turns':
208
+                        case 'turns': {
207 209
                             dict.url = type + ':';
208 210
                             const username = el.attr('username');
209 211
                             // https://code.google.com/p/webrtc/issues/detail?id=1508
@@ -234,6 +236,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
234 236
                                 || dict.credential;
235 237
                             iceservers.push(dict);
236 238
                             break;
239
+                        }
237 240
                     }
238 241
                 });
239 242
                 self.ice_config.iceServers = iceservers;
@@ -251,7 +254,7 @@ class JingleConnectionPlugin extends ConnectionPlugin {
251 254
         const data = {};
252 255
         Object.keys(this.sessions).forEach((sid) => {
253 256
             const session = self.sessions[sid];
254
-            const pc = session.peerconnection
257
+            const pc = session.peerconnection;
255 258
             if (pc && pc.updateLog) {
256 259
                 // FIXME: should probably be a .dump call
257 260
                 data["jingle_" + sid] = {

+ 4
- 4
modules/xmpp/strophe.ping.js Bestand weergeven

@@ -1,9 +1,9 @@
1 1
 /* global $, $iq, Strophe */
2
-import {getLogger} from "jitsi-meet-logger";
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3 4
 const logger = getLogger(__filename);
4
-import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
5
-import XMPPEvents from "../../service/xmpp/XMPPEvents";
6 5
 import ConnectionPlugin from "./ConnectionPlugin";
6
+import GlobalOnErrorHandler from "../util/GlobalOnErrorHandler";
7 7
 
8 8
 /**
9 9
  * Ping every 10 sec
@@ -103,7 +103,7 @@ class PingConnectionPlugin extends ConnectionPlugin {
103 103
             return;
104 104
         }
105 105
         this.intervalId = window.setInterval(() => {
106
-            this.ping(remoteJid, (result) => {
106
+            this.ping(remoteJid, () => {
107 107
                 this.failedPings = 0;
108 108
             }, (error) => {
109 109
                 this.failedPings += 1;

+ 4
- 3
modules/xmpp/strophe.rayo.js Bestand weergeven

@@ -1,5 +1,6 @@
1
-/* jshint -W117 */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $iq, Strophe */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3 4
 const logger = getLogger(__filename);
4 5
 import ConnectionPlugin from "./ConnectionPlugin";
5 6
 
@@ -32,7 +33,7 @@ class RayoConnectionPlugin extends ConnectionPlugin {
32 33
                 to: focusMucJid
33 34
             });
34 35
             req.c('dial', {
35
-                xmlns: self.RAYO_XMLNS,
36
+                xmlns: RAYO_XMLNS,
36 37
                 to: to,
37 38
                 from: from
38 39
             });

+ 5
- 7
modules/xmpp/xmpp.js Bestand weergeven

@@ -1,14 +1,12 @@
1
-/* global $, APP, config, Strophe */
2
-import {getLogger} from "jitsi-meet-logger";
1
+/* global $, $msg, Base64, Strophe */
2
+
3
+import { getLogger } from "jitsi-meet-logger";
3 4
 const logger = getLogger(__filename);
4 5
 import EventEmitter from "events";
5 6
 import Pako from "pako";
6 7
 import RandomUtil from "../util/RandomUtil";
7
-import RTCEvents from "../../service/RTC/RTCEvents";
8
-import XMPPEvents from "../../service/xmpp/XMPPEvents";
9 8
 import * as JitsiConnectionErrors from "../../JitsiConnectionErrors";
10 9
 import * as JitsiConnectionEvents from "../../JitsiConnectionEvents";
11
-import RTC from "../RTC/RTC";
12 10
 import RTCBrowserType from "../RTC/RTCBrowserType";
13 11
 import initEmuc from "./strophe.emuc";
14 12
 import initJingle from "./strophe.jingle";
@@ -24,7 +22,7 @@ function createConnection(token, bosh = '/http-bind') {
24 22
     }
25 23
 
26 24
     return new Strophe.Connection(bosh);
27
-};
25
+}
28 26
 
29 27
 export default class XMPP {
30 28
     constructor(options, token) {
@@ -273,7 +271,7 @@ export default class XMPP {
273 271
 
274 272
     removeListener (type, listener) {
275 273
         this.eventEmitter.removeListener(type, listener);
276
-    };
274
+    }
277 275
 
278 276
     /**
279 277
      * Sends 'data' as a log message to the focus. Returns true iff a message

+ 2
- 1
package.json Bestand weergeven

@@ -35,6 +35,7 @@
35 35
     "babel-polyfill": "*",
36 36
     "babel-preset-es2015": "*",
37 37
     "babel-register": "*",
38
+    "eslint": "*",
38 39
     "jshint": "^2.8.0",
39 40
     "precommit-hook": "^3.0.0",
40 41
     "string-replace-loader": "*",
@@ -42,7 +43,7 @@
42 43
   },
43 44
   "scripts": {
44 45
     "install": "webpack -p",
45
-    "lint": "jshint .",
46
+    "lint": "jshint . && eslint .",
46 47
     "validate": "npm ls"
47 48
   },
48 49
   "pre-commit": [

Laden…
Annuleren
Opslaan