Skip to content

Commit

Permalink
Lint more stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Mar 7, 2015
1 parent 6bf7653 commit 92e1a60
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"boss": true,
"node": true,
"eqeqeq": true,
"strict": true,
"newcap": false,
"undef": true,
Expand Down
3 changes: 3 additions & 0 deletions scripts/generate-identifier-data.js
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
2 changes: 1 addition & 1 deletion src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 10 additions & 5 deletions tests/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion tests/helpers/fixture.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*jshint node:true, undef:true, maxlen:100 */
/*jshint node:true */

'use strict';

var fs = require('fs');

Expand Down
9 changes: 6 additions & 3 deletions tests/helpers/testhelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@

/*jshint node: true, eqnull: true*/

'use strict';

var JSHINT = require('../../src/jshint.js').JSHINT;

if (exports.setup === undefined || exports.setup === null) {
exports.setup = {};
}

exports.setup.testRun = function (test, name) {
var initCounter = 0, runCounter = 0, seq = 0, checked = [], definedErrors = [];
var definedErrors = [];

var helperObj = {
addError: function (line, message, extras) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 92e1a60

Please sign in to comment.