simplebuild-jshint
Advanced tools
Comparing version
{ | ||
"name": "simplebuild-jshint", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"engines": { | ||
@@ -29,2 +29,3 @@ "node": ">=0.10" | ||
"expect.js": "~0.2.0", | ||
"gaze": "^0.5.1", | ||
"jake": "~0.7.6", | ||
@@ -31,0 +32,0 @@ "jshint": "^2.8.0", |
@@ -142,5 +142,7 @@ # Simplebuild-JSHint | ||
__1.0.1:__ Fix: doesn't try to report non-existent error codes (they're not present in old versions of JSHint) | ||
__1.0.0:__ Reports warning codes (and error codes) so they can be disabled more easily. | ||
__0.3.1:__ Fixed crash caused by error objects with no evidence (first seen in JSHint 2.8.0). | ||
__0.3.1:__ Fix: crashed when error objects had no evidence (first seen in JSHint 2.8.0). | ||
@@ -162,3 +164,3 @@ __0.3.0:__ Added `jshint` as a peer dependency. It no longer needs to be installed separately. | ||
1. Update version history in readme | ||
1. Update version history in readme and check in | ||
2. Ensure clean build: `./jake.sh` | ||
@@ -165,0 +167,0 @@ 3. Update npm version: `npm version [major|minor|patch]` |
@@ -155,38 +155,3 @@ /* Copyright (c) 2012-2015 James Shore - See README.txt for license */ | ||
it("should report all errors", function() { | ||
stdout.inspectSync(function(output) { | ||
lint.validateSource("foo;\nbar()"); | ||
expect(output).to.eql([ | ||
"\nfailed\n", | ||
"1: foo;\n", | ||
" Expected an assignment or function call and instead saw an expression. (W030)\n", | ||
"2: bar()\n", | ||
" Missing semicolon. (W033)\n" | ||
]); | ||
}); | ||
}); | ||
it("should trim whitespace from source code", function() { | ||
stdout.inspectSync(function(output) { | ||
lint.validateSource(" foo()\t \n"); | ||
expect(output[1]).to.eql("1: foo()\n"); | ||
}); | ||
}); | ||
it("should handle poorly-formatted error objects (introduced in JSHint 2.8.0)", function() { | ||
stdout.inspectSync(function(output) { | ||
lint.validateSource("a?"); | ||
expect(output).to.eql([ | ||
"\nfailed\n", | ||
"1: a?\n", | ||
" Unexpected early end of program. (E006)\n", | ||
"1\n", | ||
" Unrecoverable syntax error. (100% scanned). (E041)\n" | ||
]); | ||
}); | ||
}); | ||
// To do: An edge case that I don't know how to trigger, so haven't tested or supported: | ||
// 1. undefined line number; may not occur in current version | ||
}); | ||
}); |
// Copyright (c) 2014 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file. | ||
"use strict"; | ||
/* Provide simplebuild API */ | ||
var simplebuild = require("simplebuild"); | ||
@@ -5,0 +7,0 @@ var jshint = require("./jshint_runner.js"); |
/* Copyright (c) 2012-2015 James Shore - See README.txt for license */ | ||
"use strict"; | ||
/* Run JSHint */ | ||
var jshint = require("jshint").JSHINT; | ||
var fs = require("fs"); | ||
var errorTranslator = require("./error_translator.js"); | ||
@@ -33,10 +37,5 @@ exports.validateSource = function(sourceCode, options, globals, name) { | ||
console.log("\n" + name + "failed"); | ||
jshint.errors.forEach(function(error) { | ||
if (error === null) return; | ||
var evidence = (error.evidence !== undefined) ? ": " + error.evidence.trim() : ""; | ||
console.log(error.line + evidence); | ||
console.log(" " + error.reason + " (" + error.code + ")"); | ||
errorTranslator.translate(jshint.errors).forEach(function(errorLine) { | ||
console.log(errorLine); | ||
}); | ||
} | ||
} |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
33899
10.46%17
21.43%738
20%194
1.04%6
20%1
Infinity%