jslint-node
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -23,3 +23,3 @@ #!/usr/bin/env node | ||
var cliFlags = [ | ||
"color", "terse", "version", "quiet", "update", "watch" | ||
"color", "terse", "version", "quiet", "update", "watch", "fudge", "devel" | ||
]; | ||
@@ -82,3 +82,3 @@ var allFlags = cliFlags; | ||
.then(function (program) { | ||
var result = jslint(preprocessScript(program), {fudge: true}); | ||
var result = jslint(preprocessScript(program), options.jslint); | ||
reporter.report(path, result, options); | ||
@@ -91,2 +91,6 @@ return result; | ||
options = parseArgs(options || process.argv); | ||
options.jslint = { | ||
fudge: options.fudge !== false, | ||
devel: options.devel | ||
}; | ||
if (options.update) { | ||
@@ -97,4 +101,3 @@ console.log("Downloading JSLint from github..."); | ||
.then(function (jslinter) { | ||
var jslint = jslinter.jslint; | ||
var lintFile = _.partial(jslintFile, jslint, options); | ||
var lintFile = _.partial(jslintFile, jslinter.jslint, options); | ||
if (options.version) { | ||
@@ -101,0 +104,0 @@ var edition = "JSLint: " + jslinter.edition; |
@@ -25,7 +25,6 @@ /*jslint | ||
program: program, | ||
options: options, | ||
options: Object.assign({}, options), | ||
globals: globals | ||
}; | ||
var context = vm.createContext(sandbox); | ||
vmInstance.runInContext(context, {timeout: 1000}); | ||
vmInstance.runInNewContext(sandbox, {timeout: 1000}); | ||
return sandbox.result; | ||
@@ -32,0 +31,0 @@ }; |
@@ -21,2 +21,3 @@ /*jslint | ||
var terse = options.terse; | ||
var fudge = (lint.option && lint.option.fudge) || 0; | ||
@@ -37,5 +38,6 @@ function c(format, str) { | ||
if (!lint.ok) { | ||
console.log(lint.option); | ||
if (terse) { | ||
lint.warnings.forEach(function (e) { | ||
logger.log(file + ":" + e.line + ":" + e.column + ": " + e.message); | ||
logger.log(file + ":" + (e.line + fudge) + ":" + (e.column + fudge) + ": " + e.message); | ||
}); | ||
@@ -45,3 +47,3 @@ } else { | ||
lint.warnings.forEach(function (e, i) { | ||
var line = " // Line " + e.line + ", Pos " + e.column; | ||
var line = " // Line " + (e.line + fudge) + ", Pos " + (e.column + fudge); | ||
@@ -48,0 +50,0 @@ logger.log(_.pad("#" + String(i + 1), 3) + " " + c("yellow", e.message)); |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"author": "Nikos Kalogridis", | ||
@@ -16,0 +16,0 @@ "bin": { |
@@ -40,10 +40,16 @@ ## jslint-node | ||
``` | ||
CLI tool options: | ||
-u, --update - Update jslint.js file from | ||
https://raw.githubusercontent.com/douglascrockford/JSLint/master/jslint.js | ||
-v, --version - print the version of this module and also the current edition of JSLint and exit | ||
-w, --watch - watch for file changes and run jslint only those changed files. Script never ends | ||
-w, --watch - watch for file changes and run jslint only on changed files. Script never ends | ||
-q, --quiet - produce output only on errors | ||
-t, --terse - produce terse output | ||
-c, --color - use ansi colors on terminal output (default is true), to disable enter -c=false, | ||
--color=false --no-color | ||
--color=false, --no-color or -no-c | ||
JSLint options: | ||
-f, --fudge - report lines/columns starting from 1 instead of 0 (default is true), to disable | ||
use --no-fudge, --fudge=false, -f=false or --no-f | ||
-d, --devel - assume development mode | ||
``` | ||
@@ -53,5 +59,5 @@ | ||
**Notice** that there are no command line options that you can pass to the jslint function. You should add all the required flags, globals, etc. on each of the files that you want to jslint. It is the best place for this | ||
**Notice** that the only command line options passed to jslint are the fudge and devel options. The rest should be placed inside your source files that you want to jslint. It is the right place for these. | ||
Also note that it is your responsibility to call this script with an update flag regulary to benefit from the latest version of JSLint. | ||
Also note that it is your responsibility to call this script with an update flag regulary to benefit from the latest version of JSLint. As a rule of thumb always update/jslint *before* commiting your code changes. | ||
@@ -58,0 +64,0 @@ ### Through your node code |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177233
4749
96