Comparing version 2.5.3 to 2.5.4
{ | ||
"name": "jshint", | ||
"version": "2.5.3", | ||
"version": "2.5.4", | ||
"homepage": "http://jshint.com/", | ||
@@ -5,0 +5,0 @@ "description": "Static analysis tool for JavaScript", |
@@ -94,15 +94,17 @@ "use strict"; | ||
function getHomeDir() { | ||
var homePath = ""; | ||
var environment = global.process.env; | ||
var paths = [environment.HOME, | ||
environment.USERPROFILE, | ||
environment.HOMEPATH, | ||
environment.HOMEDRIVE + environment.HOMEPATH]; | ||
var paths = [ | ||
environment.USERPROFILE, | ||
environment.HOME, | ||
environment.HOMEPATH, | ||
environment.HOMEDRIVE + environment.HOMEPATH | ||
]; | ||
for (var homeIndex in paths) | ||
if (paths.hasOwnProperty(homeIndex)) { | ||
var homePath = paths[homeIndex]; | ||
if (homePath && fs.existsSync(homePath)) | ||
return homePath; | ||
while (paths.length) { | ||
homePath = paths.shift(); | ||
if (fs.existsSync(homePath)) { | ||
return homePath; | ||
} | ||
} | ||
} | ||
@@ -163,6 +165,6 @@ | ||
*/ | ||
function findFile(name, dir) { | ||
dir = dir || process.cwd(); | ||
function findFile(name, cwd) { | ||
cwd = cwd || process.cwd(); | ||
var filename = path.normalize(path.join(dir, name)); | ||
var filename = path.normalize(path.join(cwd, name)); | ||
if (findFileResults[filename] !== undefined) { | ||
@@ -172,3 +174,3 @@ return findFileResults[filename]; | ||
var parent = path.resolve(dir, "../"); | ||
var parent = path.resolve(cwd, "../"); | ||
@@ -180,3 +182,3 @@ if (shjs.test("-e", filename)) { | ||
if (dir === parent) { | ||
if (cwd === parent) { | ||
findFileResults[filename] = null; | ||
@@ -195,6 +197,6 @@ return null; | ||
*/ | ||
function loadIgnores(exclude, excludePath) { | ||
var file = findFile(excludePath || ".jshintignore"); | ||
function loadIgnores(params) { | ||
var file = findFile(params.excludePath || ".jshintignore", params.cwd); | ||
if (!file && !exclude) { | ||
if (!file && !params.exclude) { | ||
return []; | ||
@@ -204,3 +206,3 @@ } | ||
var lines = (file ? shjs.cat(file) : "").split("\n"); | ||
lines.unshift(exclude || ""); | ||
lines.unshift(params.exclude || ""); | ||
@@ -472,3 +474,3 @@ return lines | ||
_.each(config.overrides, function (options, pattern) { | ||
if (minimatch(file, pattern, { nocase: true, matchBase: true })) { | ||
if (minimatch(path.normalize(file), pattern, { nocase: true, matchBase: true })) { | ||
if (options.globals) { | ||
@@ -568,5 +570,6 @@ globals = _.extend(globals || {}, options.globals); | ||
var ignores = !opts.ignores ? loadIgnores() : opts.ignores.map(function (target) { | ||
return path.resolve(target); | ||
}); | ||
var ignores = !opts.ignores ? loadIgnores({cwd: opts.cwd}) : | ||
opts.ignores.map(function (target) { | ||
return path.resolve(target); | ||
}); | ||
@@ -729,3 +732,3 @@ opts.args.forEach(function (target) { | ||
reporter: reporter, | ||
ignores: loadIgnores(options.exclude, options["exclude-path"]), | ||
ignores: loadIgnores({exclude: options.exclude, excludePath: options["exclude-path"]}), | ||
extensions: options["extra-ext"], | ||
@@ -732,0 +735,0 @@ verbose: options.verbose, |
@@ -326,9 +326,6 @@ /* | ||
// Special case: /=. We need to make sure that this is an | ||
// operator and not a regular expression. | ||
// Special case: /=. | ||
if (ch1 === "/") { | ||
if (ch2 === "=" && /\/=(?!(\S*\/[gim]?))/.test(this.input)) { | ||
// /= is not a part of a regular expression, return it as a | ||
// punctuator. | ||
if (ch2 === "=") { | ||
return { | ||
@@ -929,3 +926,4 @@ type: Token.Punctuator, | ||
value: value, | ||
isUnclosed: false | ||
isUnclosed: false, | ||
quote: "`" | ||
}; | ||
@@ -1316,3 +1314,3 @@ }, | ||
/* | ||
* Scan for any occurence of non-breaking spaces. Non-breaking spaces | ||
* Scan for any occurrence of non-breaking spaces. Non-breaking spaces | ||
* can be mistakenly typed on OS X with option-space. Non UTF-8 web | ||
@@ -1459,3 +1457,3 @@ * pages with non-breaking pages produce syntax errors. | ||
* Produce the next token. This function is called by advance() to get | ||
* the next token. It retuns a token in a JSLint-compatible format. | ||
* the next token. It returns a token in a JSLint-compatible format. | ||
*/ | ||
@@ -1462,0 +1460,0 @@ token: function () { |
@@ -59,2 +59,3 @@ "use strict"; | ||
var quotmark = linter.getOption("quotmark"); | ||
var esnext = linter.getOption("esnext"); | ||
var code; | ||
@@ -66,2 +67,7 @@ | ||
// If quotmark is enabled, return if this is a template literal. | ||
if (esnext && data.quote === "`") { | ||
return; | ||
} | ||
// If quotmark is set to 'single' warn about all double-quotes. | ||
@@ -68,0 +74,0 @@ |
@@ -28,5 +28,8 @@ // jshint -W001 | ||
JSON : false, | ||
Map : false, | ||
Math : false, | ||
Number : false, | ||
Object : false, | ||
Proxy : false, | ||
Promise : false, | ||
parseInt : false, | ||
@@ -37,2 +40,3 @@ parseFloat : false, | ||
RegExp : false, | ||
Set : false, | ||
String : false, | ||
@@ -42,2 +46,4 @@ SyntaxError : false, | ||
URIError : false, | ||
WeakMap : false, | ||
WeakSet : false | ||
}; | ||
@@ -44,0 +50,0 @@ |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1724854
29588
2