Skip to content

Commit

Permalink
Use eslint for nuve (lynckia#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Nov 9, 2018
1 parent a7016fb commit e21c150
Show file tree
Hide file tree
Showing 55 changed files with 2,298 additions and 2,235 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nuve/nuveClient/build
nuve/nuveClient/dist
nuve/nuveClient/build/**/*.js
nuve/nuveClient/dist/**/*.js
erizo_controller/erizoClient/**/*.js
spine/**/*.js
extras/basic_example/public/erizo.js
Expand Down
3 changes: 0 additions & 3 deletions .jshintignore

This file was deleted.

60 changes: 0 additions & 60 deletions .jshintrc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var domainsUsed = ['*.dit.upm.es'];
var addonDomains = [];
var allowedDomains = 'media.getusermedia.screensharing.allowedDomains';

function startup(data, reason) { // jshint ignore:line
function startup(data, reason) {
if (reason === APP_STARTUP) {
return;
}
Expand All @@ -26,7 +26,7 @@ function startup(data, reason) { // jshint ignore:line
prefs.setCharPref(allowedDomains, values.join(','));
}

function shutdown(data, reason) { // jshint ignore:line
function shutdown(data, reason) {
if (reason === APP_SHUTDOWN) {
return;
}
Expand All @@ -39,6 +39,6 @@ function shutdown(data, reason) { // jshint ignore:line
prefs.setCharPref(allowedDomains, values.join(','));
}

function install(data, reason) {} // jshint ignore:line
function install(data, reason) {}

function uninstall(data, reason) {} // jshint ignore:line
function uninstall(data, reason) {}
14 changes: 6 additions & 8 deletions erizo_controller/erizoController/erizoController.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ global.config.erizoController.publicIP = global.config.erizoController.publicIP
global.config.erizoController.hostname = global.config.erizoController.hostname || '';
global.config.erizoController.port = global.config.erizoController.port || 8080;
global.config.erizoController.ssl = global.config.erizoController.ssl || false;
// jshint ignore:start
global.config.erizoController.ssl_key =
global.config.erizoController.ssl_key || '../../cert/key.pem';
global.config.erizoController.ssl_cert =
Expand All @@ -44,7 +43,6 @@ global.config.erizoController.allowSinglePC =
global.config.erizoController.maxErizosUsedByRoom =
global.config.erizoController.maxErizosUsedByRoom || 100;

// jshint ignore:end
global.config.erizoController.roles = global.config.erizoController.roles ||
{ presenter: { publish: true, subscribe: true, record: true },
viewer: { subscribe: true },
Expand Down Expand Up @@ -123,8 +121,8 @@ if (global.config.erizoController.listen_ssl) {
// eslint-disable-next-line global-require
const fs = require('fs');
const options = {
key: fs.readFileSync(config.erizoController.ssl_key).toString(), // jshint ignore:line
cert: fs.readFileSync(config.erizoController.ssl_cert).toString(), // jshint ignore:line
key: fs.readFileSync(config.erizoController.ssl_key).toString(),
cert: fs.readFileSync(config.erizoController.ssl_cert).toString(),
};
if (config.erizoController.sslCaCerts) {
options.ca = [];
Expand All @@ -139,18 +137,18 @@ if (global.config.erizoController.listen_ssl) {
server = http.createServer();
}

server.listen(global.config.erizoController.listen_port); // jshint ignore:line
server.listen(global.config.erizoController.listen_port);
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const io = require('socket.io').listen(server, { log: false });

io.set('transports', ['websocket']);

const EXIT_ON_NUVE_CHECK_FAIL = global.config.erizoController.exitOnNuveCheckFail;
const WARNING_N_ROOMS = global.config.erizoController.warning_n_rooms; // jshint ignore:line
const LIMIT_N_ROOMS = global.config.erizoController.limit_n_rooms; // jshint ignore:line
const WARNING_N_ROOMS = global.config.erizoController.warning_n_rooms;
const LIMIT_N_ROOMS = global.config.erizoController.limit_n_rooms;

const INTERVAL_TIME_KEEPALIVE =
global.config.erizoController.interval_time_keepAlive; // jshint ignore:line
global.config.erizoController.interval_time_keepAlive;

const BINDED_INTERFACE_NAME = global.config.erizoController.networkInterface;

Expand Down
24 changes: 12 additions & 12 deletions erizo_controller/erizoController/models/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class Client extends events.EventEmitter {
let url = sdp;
if (options.state === 'recording') {
const recordingId = sdp;
if (global.config.erizoController.recording_path) { // jshint ignore:line
url = `${global.config.erizoController.recording_path + recordingId}.mkv`; // jshint ignore:line
if (global.config.erizoController.recording_path) {
url = `${global.config.erizoController.recording_path + recordingId}.mkv`;
} else {
url = `/tmp/${recordingId}.mkv`;
}
Expand Down Expand Up @@ -204,7 +204,7 @@ class Client extends events.EventEmitter {
`clientId: ${this.id}, ` +
`streamId: ${id}`);

if (global.config.erizoController.report.session_events) { // jshint ignore:line
if (global.config.erizoController.report.session_events) {
const timeStamp = new Date();
this.room.amqper.broadcast('event', { room: this.room.id,
user: this.id,
Expand Down Expand Up @@ -299,7 +299,7 @@ class Client extends events.EventEmitter {
`clientId: ${this.id}, ` +
`streamId: ${options.streamId}`);
callback(true, signMess.erizoId);
if (global.config.erizoController.report.session_events) { // jshint ignore:line
if (global.config.erizoController.report.session_events) {
const timeStamp = new Date();
this.room.amqper.broadcast('event', { room: this.room.id,
user: this.id,
Expand Down Expand Up @@ -353,8 +353,8 @@ class Client extends events.EventEmitter {
const recordingId = Math.random() * 1000000000000000000;
let url;

if (global.config.erizoController.recording_path) { // jshint ignore:line
url = `${global.config.erizoController.recording_path + recordingId}.mkv`; // jshint ignore:line
if (global.config.erizoController.recording_path) {
url = `${global.config.erizoController.recording_path + recordingId}.mkv`;
} else {
url = `/tmp/${recordingId}.mkv`;
}
Expand Down Expand Up @@ -405,8 +405,8 @@ class Client extends events.EventEmitter {
const recordingId = options.id;
let url;

if (global.config.erizoController.recording_path) { // jshint ignore:line
url = `${global.config.erizoController.recording_path + recordingId}.mkv`; // jshint ignore:line
if (global.config.erizoController.recording_path) {
url = `${global.config.erizoController.recording_path + recordingId}.mkv`;
} else {
url = `/tmp/${recordingId}.mkv`;
}
Expand Down Expand Up @@ -434,7 +434,7 @@ class Client extends events.EventEmitter {
this.state = 'sleeping';
if (!this.room.p2p) {
this.room.controller.removePublisher(this.id, streamId, () => {
if (global.config.erizoController.report.session_events) { // jshint ignore:line
if (global.config.erizoController.report.session_events) {
const timeStamp = new Date();
this.room.amqper.broadcast('event', { room: this.room.id,
user: this.id,
Expand Down Expand Up @@ -481,7 +481,7 @@ class Client extends events.EventEmitter {
callback(true);
} else {
this.room.controller.removeSubscriber(this.id, to, (result) => {
if (global.config.erizoController.report.session_events) { // jshint ignore:line
if (global.config.erizoController.report.session_events) {
const timeStamp = new Date();
this.room.amqper.broadcast('event', { room: this.room.id,
user: this.id,
Expand Down Expand Up @@ -527,7 +527,7 @@ class Client extends events.EventEmitter {
if (!this.room.p2p) {
log.info('message: Unpublishing stream, streamId:', streamId);
this.room.controller.removePublisher(this.id, streamId);
if (global.config.erizoController.report.session_events) { // jshint ignore:line
if (global.config.erizoController.report.session_events) {
this.room.amqper.broadcast('event', { room: this.room.id,
user: this.id,
type: 'unpublish',
Expand All @@ -541,7 +541,7 @@ class Client extends events.EventEmitter {
});

if (!this.room.p2p &&
global.config.erizoController.report.session_events) { // jshint ignore:line
global.config.erizoController.report.session_events) {
this.room.amqper.broadcast('event', { room: this.room.id,
user: this.id,
type: 'user_disconnection',
Expand Down
2 changes: 1 addition & 1 deletion erizo_controller/erizoJS/models/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Node extends EventEmitter {
monitorMinVideoBw(mediaStream, this._onMonitorMinVideoBWCallback.bind(this), this.clientId);
}

if (global.config.erizoController.report.rtcp_stats) { // jshint ignore:line
if (global.config.erizoController.report.rtcp_stats) {
log.debug('message: RTCP Stat collection is active');
mediaStream.getPeriodicStats((newStats) => {
this.emit('periodic_stats', newStats);
Expand Down
1 change: 0 additions & 1 deletion erizo_controller/erizoJS/models/SessionDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ function getMediaInfoFromDescription(info, sdp, mediaType) {
});

if (isSimulcast) {
/* jshint camelcase: false */
simulcast.setSimulcastPlainString(`${ridDirection} rid=${ridsData.join(';')}`);
media.simulcast_03 = simulcast;
}
Expand Down
6 changes: 3 additions & 3 deletions erizo_controller/test/erizoController/erizoController.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ describe('Erizo Controller / Erizo Controller', () => {
});

it('should have a known API', () => {
expect(controller.getUsersInRoom).not.to.be.undefined; // jshint ignore:line
expect(controller.deleteUser).not.to.be.undefined; // jshint ignore:line
expect(controller.deleteRoom).not.to.be.undefined; // jshint ignore:line
expect(controller.getUsersInRoom).not.to.be.undefined;
expect(controller.deleteUser).not.to.be.undefined;
expect(controller.deleteRoom).not.to.be.undefined;
});

it('should be added to Nuve', () => {
Expand Down
18 changes: 9 additions & 9 deletions erizo_controller/test/erizoController/roomController.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('Erizo Controller / Room Controller', () => {
});

it('should have a known API', () => {
expect(controller.addEventListener).not.to.be.undefined; // jshint ignore:line
expect(controller.addExternalInput).not.to.be.undefined; // jshint ignore:line
expect(controller.addExternalOutput).not.to.be.undefined; // jshint ignore:line
expect(controller.processSignaling).not.to.be.undefined; // jshint ignore:line
expect(controller.addPublisher).not.to.be.undefined; // jshint ignore:line
expect(controller.addSubscriber).not.to.be.undefined; // jshint ignore:line
expect(controller.removePublisher).not.to.be.undefined; // jshint ignore:line
expect(controller.removeSubscriber).not.to.be.undefined; // jshint ignore:line
expect(controller.removeSubscriptions).not.to.be.undefined; // jshint ignore:line
expect(controller.addEventListener).not.to.be.undefined;
expect(controller.addExternalInput).not.to.be.undefined;
expect(controller.addExternalOutput).not.to.be.undefined;
expect(controller.processSignaling).not.to.be.undefined;
expect(controller.addPublisher).not.to.be.undefined;
expect(controller.addSubscriber).not.to.be.undefined;
expect(controller.removePublisher).not.to.be.undefined;
expect(controller.removeSubscriber).not.to.be.undefined;
expect(controller.removeSubscriptions).not.to.be.undefined;
});

describe('External Input', () => {
Expand Down
4 changes: 2 additions & 2 deletions erizo_controller/test/erizoJS/erizoJSController.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ describe('Erizo JS Controller', () => {
} });

expect(mocks.MediaStream.setSlideShowMode.callCount).to.equal(1);
expect(mocks.MediaStream.setSlideShowMode.args[0][0]).to.be.true; // jshint ignore:line
expect(mocks.MediaStream.setSlideShowMode.args[0][0]).to.be.true;
});

it('should set slide show mode to false', () => {
Expand All @@ -441,7 +441,7 @@ describe('Erizo JS Controller', () => {
slideShowMode: false,
} });

expect(mocks.MediaStream.setSlideShowMode.args[0][0]).to.be.false; // jshint ignore:line
expect(mocks.MediaStream.setSlideShowMode.args[0][0]).to.be.false;
});
});

Expand Down
Loading

0 comments on commit e21c150

Please sign in to comment.