Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from JSHint and JSCS to ESLint #655

Merged
merged 6 commits into from
Oct 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
79 changes: 79 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"rules": {
"array-bracket-spacing": 2,
"block-spacing": [2, "never"],
"brace-style": [2, "1tbs", { "allowSingleLine": false }],
"camelcase": [2, {"properties": "always"}],
"curly": 2,
"default-case": 2,
"dot-notation": 2,
"eqeqeq": 2,
"indent": [
2,
2
],
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
"max-len": [2, 80, 2, {"ignoreUrls": true}],
"new-cap": 2,
"no-console": 0,
"no-else-return": 2,
"no-eval": 2,
"no-multi-spaces": 2,
"no-multiple-empty-lines": [2, {"max": 2}],
"no-shadow": 2,
"no-trailing-spaces": 2,
"no-unused-expressions": 2,
"object-curly-spacing": [2, "never"],
"padded-blocks": [2, "never"],
"quotes": [
2,
"single"
],
"semi": [
2,
"always"
],
"space-after-keywords": 2,
"space-before-blocks": 2,
"space-before-function-paren": [2, "never"],
"spaced-comment": 2,
"valid-typeof": 2
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"addExplicitTest": true,
"addTest": true,
"arrayAverage": true,
"arrayMax": true,
"arrayMin": true,
"audioContext": true,
"AudioContext": true,
"Call": true,
"chrome": true,
"createLineChart": true,
"expectEquals": true,
"ga": true,
"MediaStreamTrack": true,
"report": true,
"reportBug": true,
"reportError": true,
"reportFatal": true,
"reportInfo": true,
"reportSuccess": true,
"RTCIceCandidate": true,
"RTCPeerConnection": true,
"RTCSessionDescription": true,
"setTestProgress": true,
"setTimeoutWithProgressBar": true,
"Ssim": true,
"StatisticsAggregate": true,
"testFinished": true,
"trace": true,
"webrtcDetectedBrowser": true,
"webrtcDetectedVersion": true
}}
52 changes: 14 additions & 38 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@
/* globals module */

module.exports = function(grunt) {

// configure project
grunt.initConfig({
// make node configurations available
pkg: grunt.file.readJSON('package.json'),
csslint: {
options: {
csslintrc: 'src/.csslintrc'
csslintrc: '.csslintrc'
},
strict: {
options: {
import: 2
},
src: ['src/content/**/*.css',
'!src/content/**/*_nolint.css'
]
src: ['src/content/**/*.css', '!src/content/**/*_nolint.css']
},
lax: {
options: {
import: false
},
src: ['src/content/**/*.css',
'!src/content/**/*_nolint.css'
]
src: ['src/content/**/*.css', '!src/content/**/*_nolint.css']
}
},
eslint: {
options: {
configFile: '.eslintrc'
},
target: ['src/content/**/*.js', 'test/*.js']
},
githooks: {
all: {
'pre-commit': 'csslint htmlhint jscs jshint'
'pre-commit': 'csslint htmlhint eslint'
}
},
htmlhint: {
Expand All @@ -43,30 +44,6 @@ module.exports = function(grunt) {
]
}
},
jscs: {
src: [
'src/content/**/*.js',
'test/*.js'
],
options: {
config: 'src/.jscsrc',
'excludeFiles': []
}
},
jshint: {
options: {
ignores: [],
// use default .jshintrc files
jshintrc: true
},
// files to validate
// can choose more than one name + array of paths
// usage with this name: grunt jshint:files
files: [
'src/content/**/*.js',
'test/*.js'
]
},
// Leaving this as a manual step as the extension is not updated regularly.
compress: {
main: {
Expand All @@ -88,15 +65,14 @@ module.exports = function(grunt) {
});

// enable plugins
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-githooks');
grunt.loadNpmTasks('grunt-htmlhint');

// set default tasks to run when grunt is called without parameters
grunt.registerTask('default', ['csslint', 'htmlhint', 'jscs', 'jshint']);
grunt.registerTask('default', ['csslint', 'htmlhint', 'eslint']);
// also possible to call JavaScript directly in registerTask()
// or to call external tasks with grunt.loadTasks()
};
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@
"grunt-cli": ">=0.1.9",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-csslint": ">=0.3.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-eslint": "^17.2.0",
"grunt-githooks": "^0.3.1",
"grunt-htmlhint": ">=0.4.1",
"grunt-jscs": ">=0.8.1",
"pem": "^1.8.1",
"selenium-webdriver": "^2.46.0",
"tape": "^4.0.0",
Expand Down
3 changes: 0 additions & 3 deletions src/.jscsrc

This file was deleted.

6 changes: 4 additions & 2 deletions src/content/datachannel/basic/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ function createConnection() {
// SCTP is supported from Chrome 31 and is supported in FF.
// No need to pass DTLS constraint as it is on by default in Chrome 31.
// For SCTP, reliable and ordered is true by default.
// Add localConnection to global scope to make it visible from the browser console.
// Add localConnection to global scope to make it visible
// from the browser console.
window.localConnection = localConnection =
new RTCPeerConnection(servers, pcConstraint);
trace('Created local peer connection object localConnection');
Expand All @@ -54,7 +55,8 @@ function createConnection() {
sendChannel.onopen = onSendChannelStateChange;
sendChannel.onclose = onSendChannelStateChange;

// Add remoteConnection to global scope to make it visible from the browser console.
// Add remoteConnection to global scope to make it visible
// from the browser console.
window.remoteConnection = remoteConnection =
new RTCPeerConnection(servers, pcConstraint);
trace('Created remote peer connection object remoteConnection');
Expand Down
1 change: 0 additions & 1 deletion src/content/datachannel/basic/js/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
// This is a basic test file for use with testling.
// The test script language comes from tape.
/* jshint node: true */
var test = require('tape');

var webdriver = require('selenium-webdriver');
Expand Down
9 changes: 4 additions & 5 deletions src/content/datachannel/datatransfer/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ var receiveProgress = document.querySelector('progress#receiveProgress');
var receivedSize = 0;
var bytesToSend = 0;

var bitrateMax = 0;

sendButton.onclick = createConnection;

function createConnection() {
Expand All @@ -33,7 +31,8 @@ function createConnection() {

bytesToSend = megsToSend.value * 1024 * 1024;

// Add localConnection to global scope to make it visible from the browser console.
// Add localConnection to global scope to make it visible
// from the browser console.
window.localConnection = localConnection = new RTCPeerConnection(servers,
pcConstraint);
trace('Created local peer connection object localConnection');
Expand All @@ -54,7 +53,8 @@ function createConnection() {

localConnection.createOffer(gotDescription1, onCreateSessionDescriptionError);

// Add remoteConnection to global scope to make it visible from the browser console.
// Add remoteConnection to global scope to make it visible
// from the browser console.
window.remoteConnection = remoteConnection = new RTCPeerConnection(servers,
pcConstraint);
trace('Created remote peer connection object remoteConnection');
Expand Down Expand Up @@ -183,7 +183,6 @@ function receiveChannelCallback(event) {
receiveChannel.onmessage = onReceiveMessageCallback;

receivedSize = 0;
bitrateMax = 0;
}

function onReceiveMessageCallback(event) {
Expand Down
1 change: 0 additions & 1 deletion src/content/datachannel/datatransfer/js/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
// This is a basic test file for use with testling.
// The test script language comes from tape.
/* jshint node: true */
var test = require('tape');

var webdriver = require('selenium-webdriver');
Expand Down
8 changes: 5 additions & 3 deletions src/content/datachannel/filetransfer/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function createConnection() {
var servers = null;
pcConstraint = null;

// Add localConnection to global scope to make it visible from the browser console.
// Add localConnection to global scope to make it visible
// from the browser console.
window.localConnection = localConnection = new RTCPeerConnection(servers,
pcConstraint);
trace('Created local peer connection object localConnection');
Expand All @@ -48,7 +49,8 @@ function createConnection() {
localConnection.onicecandidate = iceCallback1;

localConnection.createOffer(gotDescription1, onCreateSessionDescriptionError);
// Add remoteConnection to global scope to make it visible from the browser console.
// Add remoteConnection to global scope to make it visible
// from the browser console.
window.remoteConnection = remoteConnection = new RTCPeerConnection(servers,
pcConstraint);
trace('Created remote peer connection object remoteConnection');
Expand Down Expand Up @@ -162,7 +164,7 @@ function receiveChannelCallback(event) {
}

function onReceiveMessageCallback(event) {
//trace('Received Message ' + event.data.byteLength);
// trace('Received Message ' + event.data.byteLength);
receiveBuffer.push(event.data);
receivedSize += event.data.byteLength;

Expand Down
1 change: 0 additions & 1 deletion src/content/datachannel/filetransfer/js/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
// This is a basic test file for use with testling.
// The test script language comes from tape.
/* jshint node: true */
var test = require('tape');

var webdriver = require('selenium-webdriver');
Expand Down
10 changes: 6 additions & 4 deletions src/content/devices/input-output/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ function gotDevices(deviceInfos) {
console.log('Some other kind of source/device: ', deviceInfo);
}
}
selectors.forEach(function(select, i) {
selectors.forEach(function(select, selectorIndex) {
if (Array.prototype.slice.call(select.childNodes).some(function(n) {
return n.value === values[i];
return n.value === values[selectorIndex];
})) {
select.value = values[i];
select.value = values[selectorIndex];
}
});
}
Expand Down Expand Up @@ -89,7 +89,9 @@ function changeAudioDestination() {

function start() {
if (window.stream) {
window.stream.getTracks().forEach(function(track) { track.stop(); });
window.stream.getTracks().forEach(function(track) {
track.stop();
});
}
var audioSource = audioInputSelect.value;
var videoSource = videoSelect.value;
Expand Down