From 92e1a60c8dcb9a19ee57c7309e67b585167140db Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 5 Jan 2015 11:21:57 +0200 Subject: [PATCH] Lint more stuff. --- .jshintrc | 1 + scripts/generate-identifier-data.js | 3 +++ src/jshint.js | 2 +- tests/cli.js | 15 ++++++++++----- tests/helpers/fixture.js | 4 +++- tests/helpers/testhelper.js | 9 ++++++--- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.jshintrc b/.jshintrc index a5973b342e..ec9baa042c 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,6 +1,7 @@ { "boss": true, "node": true, + "eqeqeq": true, "strict": true, "newcap": false, "undef": true, diff --git a/scripts/generate-identifier-data.js b/scripts/generate-identifier-data.js index 2f8cd01de0..9912dc8b57 100644 --- a/scripts/generate-identifier-data.js +++ b/scripts/generate-identifier-data.js @@ -1,4 +1,7 @@ // Based on https://gist.github.com/mathiasbynens/6334847 by @mathias + +'use strict'; + var regenerate = require('regenerate'); // Which Unicode version should be used? diff --git a/src/jshint.js b/src/jshint.js index 9b5d543d08..84e883121d 100644 --- a/src/jshint.js +++ b/src/jshint.js @@ -1499,7 +1499,7 @@ var JSHINT = (function() { do { t = peek(i); i += 1; - } while (t.id != "(end)" && t.id === "(comment)"); + } while (t.id !== "(end)" && t.id === "(comment)"); if (t.reach) { return; diff --git a/tests/cli.js b/tests/cli.js index 26ad2f9621..f49f1fc143 100644 --- a/tests/cli.js +++ b/tests/cli.js @@ -41,11 +41,16 @@ exports.group = { this.sinon.stub(shjs, "cat") .withArgs(sinon.match(/file\.js$/)).returns("var a = function () {}; a();") .withArgs(sinon.match(/file1\.json$/)).returns("wat") - .withArgs(sinon.match(/file2\.json$/)).returns("{\"node\":true,\"globals\":{\"foo\":true,\"bar\":true}}") - .withArgs(sinon.match(/file4\.json$/)).returns("{\"extends\":\"file3.json\"}") - .withArgs(sinon.match(/file5\.json$/)).returns("{\"extends\":\"file2.json\"}") - .withArgs(sinon.match(/file6\.json$/)).returns("{\"extends\":\"file2.json\",\"node\":false}") - .withArgs(sinon.match(/file7\.json$/)).returns("{\"extends\":\"file2.json\",\"globals\":{\"bar\":false,\"baz\":true}}"); + .withArgs(sinon.match(/file2\.json$/)) + .returns("{\"node\":true,\"globals\":{\"foo\":true,\"bar\":true}}") + .withArgs(sinon.match(/file4\.json$/)) + .returns("{\"extends\":\"file3.json\"}") + .withArgs(sinon.match(/file5\.json$/)) + .returns("{\"extends\":\"file2.json\"}") + .withArgs(sinon.match(/file6\.json$/)) + .returns("{\"extends\":\"file2.json\",\"node\":false}") + .withArgs(sinon.match(/file7\.json$/)) + .returns("{\"extends\":\"file2.json\",\"globals\":{\"bar\":false,\"baz\":true}}"); this.sinon.stub(shjs, "test") .withArgs("-e", sinon.match(/file\.js$/)).returns(true) diff --git a/tests/helpers/fixture.js b/tests/helpers/fixture.js index 698c5148a0..72d448ffd6 100644 --- a/tests/helpers/fixture.js +++ b/tests/helpers/fixture.js @@ -1,4 +1,6 @@ -/*jshint node:true, undef:true, maxlen:100 */ +/*jshint node:true */ + +'use strict'; var fs = require('fs'); diff --git a/tests/helpers/testhelper.js b/tests/helpers/testhelper.js index c26cfcff4f..da5bf7b498 100644 --- a/tests/helpers/testhelper.js +++ b/tests/helpers/testhelper.js @@ -28,6 +28,8 @@ /*jshint node: true, eqnull: true*/ +'use strict'; + var JSHINT = require('../../src/jshint.js').JSHINT; if (exports.setup === undefined || exports.setup === null) { @@ -35,7 +37,7 @@ if (exports.setup === undefined || exports.setup === null) { } exports.setup.testRun = function (test, name) { - var initCounter = 0, runCounter = 0, seq = 0, checked = [], definedErrors = []; + var definedErrors = []; var helperObj = { addError: function (line, message, extras) { @@ -125,9 +127,10 @@ exports.setup.testRun = function (test, name) { }); test.ok( - undefinedErrors.length === 0 && unthrownErrors.length === 0 && wrongLineNumbers.length === 0, + undefinedErrors.length === 0 + && unthrownErrors.length === 0 && wrongLineNumbers.length === 0, - (name == null ? "" : "\n TestRun: [bold]{" + name + "}") + + (name === null ? "" : "\n TestRun: [bold]{" + name + "}") + unthrownErrors.map(function (el, idx) { return (idx === 0 ? "\n [yellow]{Errors defined, but not thrown by JSHINT}\n" : "") + " [bold]{Line " + el.line + ", Char " + el.character + "} " + el.message;