From 0302a84fa682809860cd73e001ea6473cf08fc18 Mon Sep 17 00:00:00 2001 From: Jesse Schwartzentruber Date: Wed, 26 Apr 2017 18:01:48 -0400 Subject: [PATCH] Linter changes * Override remaining eslint errors from standard * Run standard with grunt instead of separately --- Gruntfile.js | 21 ++++++++++++++------- lib/logging/console.js | 2 +- lib/make/init.js | 2 +- lib/random/mersennetwister.js | 2 +- lib/random/random.js | 2 +- lib/utils/init.js | 2 +- lib/utils/objects.js | 2 +- lib/utils/platform.js | 2 ++ lib/utils/prototypes.js | 1 + package.json | 6 ++++-- 10 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fedfc5d..181b2c6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,8 @@ module.exports = function(grunt) { + let pkg = grunt.file.readJSON('package.json') grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), + pkg: pkg, karma: { unit: { @@ -13,12 +14,18 @@ module.exports = function(grunt) { coverageDir: 'tests/coverage/', force: true } + }, + standard: { + options: pkg.standard, + lib: { + src: ['lib/**/*.js'] + } } - }); + }) - grunt.loadNpmTasks('grunt-karma'); - grunt.loadNpmTasks('grunt-karma-coveralls'); + grunt.loadNpmTasks('grunt-karma') + grunt.loadNpmTasks('grunt-karma-coveralls') + grunt.loadNpmTasks('grunt-standard') - grunt.registerTask('test', ['karma', 'coveralls']); - -}; + grunt.registerTask('test', ['standard', 'karma', 'coveralls']) +} diff --git a/lib/logging/console.js b/lib/logging/console.js index cf1c00e..ee5a682 100644 --- a/lib/logging/console.js +++ b/lib/logging/console.js @@ -4,7 +4,7 @@ var websocket = null -var logger = (function () { +var logger = (function () { // eslint-disable-line no-unused-vars let color = { red: '\u0033[1;31m', green: '\u0033[1;32m', diff --git a/lib/make/init.js b/lib/make/init.js index 6e483bd..3d96dd0 100644 --- a/lib/make/init.js +++ b/lib/make/init.js @@ -1 +1 @@ -var make = {} +var make = {} // eslint-disable-line no-unused-vars diff --git a/lib/random/mersennetwister.js b/lib/random/mersennetwister.js index c9e6541..56dd7df 100644 --- a/lib/random/mersennetwister.js +++ b/lib/random/mersennetwister.js @@ -9,7 +9,7 @@ * */ -function MersenneTwister () { +function MersenneTwister () { // eslint-disable-line no-unused-vars const N = 624 const M = 397 const UPPER_MASK = 0x80000000 diff --git a/lib/random/random.js b/lib/random/random.js index 431039c..1519d62 100644 --- a/lib/random/random.js +++ b/lib/random/random.js @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var random = { +var random = { // eslint-disable-line no-unused-vars twister: null, /** diff --git a/lib/utils/init.js b/lib/utils/init.js index 7121bda..0db5220 100644 --- a/lib/utils/init.js +++ b/lib/utils/init.js @@ -1 +1 @@ -var utils = {} +var utils = {} // eslint-disable-line no-unused-vars diff --git a/lib/utils/objects.js b/lib/utils/objects.js index 61e1581..dc453fe 100644 --- a/lib/utils/objects.js +++ b/lib/utils/objects.js @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var o = null +var o = null // eslint-disable-line no-unused-vars // TODO: https://github.com/MozillaSecurity/octo/issues/7 diff --git a/lib/utils/platform.js b/lib/utils/platform.js index ebe17d5..f5f4690 100644 --- a/lib/utils/platform.js +++ b/lib/utils/platform.js @@ -70,6 +70,7 @@ utils.platform = { platform.SpeechRecognition = platformName(['SpeechRecognition', 'webkitSpeechRecognition']) platform.SpeechGrammarList = platformName(['SpeechGrammarList', 'webkitSpeechGrammarList']) + /* function findWebGLContextName (candidates) { var canvas = document.createElement('canvas') for (var i = 0; i < candidates.length; i++) { @@ -82,6 +83,7 @@ utils.platform = { } return null } + */ platform.WebGL = 'webgl' // findWebGLContextName(["webgl", "experimental-webgl", "webkit-3d"]); platform.WebGL2 = 'webgl2' // findWebGLContextName(["webgl2", "experimental-webgl2"]); diff --git a/lib/utils/prototypes.js b/lib/utils/prototypes.js index 381efb4..016909c 100644 --- a/lib/utils/prototypes.js +++ b/lib/utils/prototypes.js @@ -1,3 +1,4 @@ +/* eslint no-extend-native: ["error", { "exceptions": ["String", "Array"] }] */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/package.json b/package.json index 665ab30..2f8cc9f 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "grunt": "*", "grunt-karma": "*", "grunt-karma-coveralls": "*", + "grunt-standard": "*", "karma": "*", "karma-chrome-launcher": "*", "karma-coverage": "*", @@ -13,9 +14,10 @@ "standard": "*" }, "scripts": { - "test": "standard -v lib/**/*.js && grunt test --verbose" + "test": "grunt test --verbose" }, "standard": { - "globals": ["random", "make", "utils", "logger"] + "globals": ["random", "make", "utils", "logger", "MersenneTwister", "o"], + "envs": ["browser"] } }