Comparing version 0.6.3 to 0.7.0
var fs = require('fs'), | ||
path = require('path'), | ||
argsparser = require('argsparser'), | ||
cli = require('cli').enable('glob', 'help'), | ||
hint = require('./hint'); | ||
var rootPath = path.resolve("/"); | ||
function existsSync() { | ||
@@ -13,10 +11,2 @@ var obj = fs.existsSync ? fs : path; | ||
function _help() { | ||
process.stdout.write(fs.readFileSync(__dirname + "/../HELP", "utf-8")); | ||
} | ||
function _version() { | ||
process.stdout.write(JSON.parse(fs.readFileSync(__dirname + "/../package.json", "utf-8")).version + "\n"); | ||
} | ||
function _removeJsComments(str) { | ||
@@ -45,3 +35,4 @@ str = str || ''; | ||
var filename = path.normalize(path.join(dir, name)); | ||
var filename = path.normalize(path.join(dir, name)), | ||
parent = path.resolve(dir, ".."); | ||
@@ -52,4 +43,3 @@ if (existsSync(filename)) { | ||
return dir === rootPath ? | ||
null : _searchFile(name, path.normalize(path.join(dir, ".."))); | ||
return dir === parent ? null : _searchFile(name, parent); | ||
} | ||
@@ -94,43 +84,38 @@ | ||
interpret: function (args) { | ||
var config, reporter, | ||
options = argsparser.parse(args), | ||
customConfig = options["--config"], | ||
customReporter = options["--reporter"] ? path.resolve(process.cwd(), options["--reporter"]) : null, | ||
targets = options.node, | ||
extraExtensionList = options["--extra-ext"], | ||
ignoreFile, ignores; | ||
var config, reporter, options, | ||
customConfig, customReporter, | ||
ignoreFile, ignores, extraExtensionList; | ||
//could be on Windows which we are looking for an attribute ending in 'node.exe' | ||
if (targets === undefined) { | ||
(function () { | ||
var arg; | ||
cli.setArgv(args); | ||
cli.options = {}; | ||
options = cli.parse({ | ||
'version': ['v', 'display package version', 'boolean', false], | ||
'config': ['config', 'custom config file', 'string', false], | ||
'reporter': ['reporter', 'custom reporter', 'string', undefined], | ||
'jslint-reporter': ['jslint-reporter', 'use a jslint compatible xml reporter'], | ||
'show-non-errors': ['show-non-errors', 'show additional data generated by jshint'], | ||
'extra-ext': ['extra-ext', 'comma-separated list of file extensions to use (.js is default)', 'string', ''] | ||
}); | ||
for (arg in options) { | ||
if (path.basename(arg) === 'node.exe') { | ||
targets = options[arg]; | ||
break; | ||
} | ||
} | ||
}()); | ||
} | ||
customConfig = options.config; | ||
customReporter = options.reporter ? path.resolve(process.cwd(), options.reporter) : null; | ||
extraExtensionList = options["extra-ext"]; | ||
targets = typeof targets === "string" ? null : targets.slice(1); | ||
extraExtensionList = typeof extraExtensionList === "string" ? extraExtensionList : ""; | ||
if (options["--version"]) { | ||
_version(); | ||
if (options.version) { | ||
cli.setApp(path.resolve(__dirname + "/../package.json")); | ||
process.stdout.write(cli.version + "\n"); | ||
return; | ||
} | ||
if (!targets || options["--help"]) { | ||
_help(); | ||
if (options.help || !cli.args.length) { | ||
cli.getUsage(); | ||
process.exit(); | ||
return; | ||
} | ||
if (options["--jslint-reporter"]) { | ||
if (options['jslint-reporter']) { | ||
customReporter = "./reporters/jslint_xml.js"; | ||
} | ||
if (options["--show-non-errors"]) { | ||
if (options['show-non-errors']) { | ||
customReporter = "./reporters/non_error.js"; | ||
@@ -163,4 +148,4 @@ } | ||
_print(hint.hint(targets, config, reporter, ignores, extraExtensionList)); | ||
_print(hint.hint(cli.args, config, reporter, ignores, extraExtensionList)); | ||
} | ||
}; |
{ | ||
"name": "jshint", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"description": "A CLI for JSHint", | ||
@@ -27,3 +27,3 @@ "homepage": "http://github.com/jshint/node-jshint", | ||
"dependencies": { | ||
"argsparser": "0.0.x", | ||
"cli": "0.4.3", | ||
"minimatch": "0.0.x" | ||
@@ -30,0 +30,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
181802
12
4421
+ Addedcli@0.4.3
+ Added@isaacs/cliui@8.0.2(transitive)
+ Addedansi-regex@5.0.16.1.0(transitive)
+ Addedansi-styles@4.3.06.2.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcli@0.4.3(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@8.0.09.2.2(transitive)
+ Addedforeground-child@3.3.0(transitive)
+ Addedglob@11.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjackspeak@4.0.2(transitive)
+ Addedlru-cache@11.0.2(transitive)
+ Addedminimatch@10.0.1(transitive)
+ Addedminipass@7.1.2(transitive)
+ Addedpackage-json-from-dist@1.0.1(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpath-scurry@2.0.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstring-width@4.2.35.1.2(transitive)
+ Addedstrip-ansi@6.0.17.1.0(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwrap-ansi@7.0.08.1.0(transitive)
- Removedargsparser@0.0.x
- Removedargsparser@0.0.7(transitive)