Skip to content
Browse files

Update to jshint@2.4.1

  • Loading branch information...
1 parent 1bd6350 commit a6773af63cce195ed41a8ad91dfc44a21393c621 @Gozala Gozala committed Jan 8, 2014
Showing with 888 additions and 680 deletions.
  1. +8 −8 node_modules/jshint/bin/build
  2. +5 −0 node_modules/jshint/node_modules/cli/node_modules/glob/glob.js
  3. +4 −0 node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json
  4. +6 −2 node_modules/jshint/node_modules/cli/node_modules/glob/package.json
  5. +1 −0 node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json
  6. +0 −1 node_modules/jshint/node_modules/cli/package.json
  7. +38 −38 node_modules/jshint/node_modules/minimatch/README.md
  8. +62 −86 node_modules/jshint/node_modules/minimatch/minimatch.js
  9. +0 −8 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/AUTHORS
  10. +0 −25 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/bench.js
  11. +189 −200 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js
  12. +6 −32 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json
  13. +40 −0 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js
  14. +4 −0 node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json
  15. +8 −4 node_modules/jshint/node_modules/minimatch/package.json
  16. +3 −0 node_modules/jshint/node_modules/shelljs/package.json
  17. +3 −0 node_modules/jshint/node_modules/underscore/package.json
  18. +6 −9 node_modules/jshint/package.json
  19. +91 −12 node_modules/jshint/src/cli.js
  20. +357 −223 node_modules/jshint/src/jshint.js
  21. +27 −14 node_modules/jshint/src/lex.js
  22. +9 −8 node_modules/jshint/src/messages.js
  23. +4 −0 node_modules/jshint/src/reg.js
  24. +17 −10 node_modules/jshint/src/vars.js
View
16 node_modules/jshint/bin/build
@@ -17,14 +17,14 @@ bundle.bundle({}, function (err, src) {
var rhino = "./dist/jshint-rhino.js";
[ "// " + version,
- "var JSHINT;",
- "var window;",
- "if (typeof window === 'undefined') window = {};",
- "(function () {",
- "var require;",
- src,
- "JSHINT = require('jshint').JSHINT;",
- "}());"
+ "var JSHINT;",
+ "if (typeof window === 'undefined') window = {};",
+ "(function () {",
+ "var require;",
+ src,
+ "JSHINT = require('jshint').JSHINT;",
+ "if (typeof exports === 'object' && exports) exports.JSHINT = JSHINT;",
+ "}());"
].join("\n").to(web);
("#!/usr/bin/env rhino\nvar window = {};\n" + cat(web, "./src/platforms/rhino.js")).to(rhino);
View
5 node_modules/jshint/node_modules/cli/node_modules/glob/glob.js
@@ -84,6 +84,11 @@ function Glob (pattern, options, cb) {
return new Glob(pattern, options, cb)
}
+ if (typeof options === "function") {
+ cb = options
+ options = null
+ }
+
if (typeof cb === "function") {
this.on("error", cb)
this.on("end", function (matches) {
View
4 node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json
@@ -24,6 +24,10 @@
},
"readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/inherits/issues"
+ },
+ "homepage": "https://github.com/isaacs/inherits",
"_id": "inherits@2.0.1",
"_from": "inherits@2"
}
View
8 node_modules/jshint/node_modules/cli/node_modules/glob/package.json
@@ -6,7 +6,7 @@
},
"name": "glob",
"description": "a little globber",
- "version": "3.2.6",
+ "version": "3.2.7",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
@@ -30,6 +30,10 @@
"license": "BSD",
"readme": "# Glob\n\nMatch files using the patterns the shell uses, like stars and stuff.\n\nThis is a glob implementation in JavaScript. It uses the `minimatch`\nlibrary to do its matching.\n\n## Attention: node-glob users!\n\nThe API has changed dramatically between 2.x and 3.x. This library is\nnow 100% JavaScript, and the integer flags have been replaced with an\noptions object.\n\nAlso, there's an event emitter class, proper tests, and all the other\nthings you've come to expect from node modules.\n\nAnd best of all, no compilation!\n\n## Usage\n\n```javascript\nvar glob = require(\"glob\")\n\n// options is optional\nglob(\"**/*.js\", options, function (er, files) {\n // files is an array of filenames.\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"]\n // er is an error object or null.\n})\n```\n\n## Features\n\nPlease see the [minimatch\ndocumentation](https://github.com/isaacs/minimatch) for more details.\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n* [minimatch documentation](https://github.com/isaacs/minimatch)\n\n## glob(pattern, [options], cb)\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* `cb` {Function}\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nPerform an asynchronous glob search.\n\n## glob.sync(pattern, [options])\n\n* `pattern` {String} Pattern to be matched\n* `options` {Object}\n* return: {Array<String>} filenames found matching the pattern\n\nPerform a synchronous glob search.\n\n## Class: glob.Glob\n\nCreate a Glob object by instanting the `glob.Glob` class.\n\n```javascript\nvar Glob = require(\"glob\").Glob\nvar mg = new Glob(pattern, options, cb)\n```\n\nIt's an EventEmitter, and starts walking the filesystem to find matches\nimmediately.\n\n### new glob.Glob(pattern, [options], [cb])\n\n* `pattern` {String} pattern to search for\n* `options` {Object}\n* `cb` {Function} Called when an error occurs, or matches are found\n * `err` {Error | null}\n * `matches` {Array<String>} filenames found matching the pattern\n\nNote that if the `sync` flag is set in the options, then matches will\nbe immediately available on the `g.found` member.\n\n### Properties\n\n* `minimatch` The minimatch object that the glob uses.\n* `options` The options object passed in.\n* `error` The error encountered. When an error is encountered, the\n glob object is in an undefined state, and should be discarded.\n* `aborted` Boolean which is set to true when calling `abort()`. There\n is no way at this time to continue a glob search after aborting, but\n you can re-use the statCache to avoid having to duplicate syscalls.\n* `statCache` Collection of all the stat results the glob search\n performed.\n* `cache` Convenience object. Each field has the following possible\n values:\n * `false` - Path does not exist\n * `true` - Path exists\n * `1` - Path exists, and is not a directory\n * `2` - Path exists, and is a directory\n * `[file, entries, ...]` - Path exists, is a directory, and the\n array value is the results of `fs.readdir`\n\n### Events\n\n* `end` When the matching is finished, this is emitted with all the\n matches found. If the `nonull` option is set, and no match was found,\n then the `matches` list contains the original pattern. The matches\n are sorted, unless the `nosort` flag is set.\n* `match` Every time a match is found, this is emitted with the matched.\n* `error` Emitted when an unexpected error is encountered, or whenever\n any fs error occurs if `options.strict` is set.\n* `abort` When `abort()` is called, this event is raised.\n\n### Methods\n\n* `abort` Stop the search.\n\n### Options\n\nAll the options that can be passed to Minimatch can also be passed to\nGlob to change pattern matching behavior. Also, some have been added,\nor have glob-specific ramifications.\n\nAll options are false by default, unless otherwise noted.\n\nAll options are added to the glob object, as well.\n\n* `cwd` The current working directory in which to search. Defaults\n to `process.cwd()`.\n* `root` The place where patterns starting with `/` will be mounted\n onto. Defaults to `path.resolve(options.cwd, \"/\")` (`/` on Unix\n systems, and `C:\\` or some such on Windows.)\n* `dot` Include `.dot` files in normal matches and `globstar` matches.\n Note that an explicit dot in a portion of the pattern will always\n match dot files.\n* `nomount` By default, a pattern starting with a forward-slash will be\n \"mounted\" onto the root setting, so that a valid filesystem path is\n returned. Set this flag to disable that behavior.\n* `mark` Add a `/` character to directory matches. Note that this\n requires additional stat calls.\n* `nosort` Don't sort the results.\n* `stat` Set to true to stat *all* results. This reduces performance\n somewhat, and is completely unnecessary, unless `readdir` is presumed\n to be an untrustworthy indicator of file existence. It will cause\n ELOOP to be triggered one level sooner in the case of cyclical\n symbolic links.\n* `silent` When an unusual error is encountered\n when attempting to read a directory, a warning will be printed to\n stderr. Set the `silent` option to true to suppress these warnings.\n* `strict` When an unusual error is encountered\n when attempting to read a directory, the process will just continue on\n in search of other matches. Set the `strict` option to raise an error\n in these cases.\n* `cache` See `cache` property above. Pass in a previously generated\n cache object to save some fs calls.\n* `statCache` A cache of results of filesystem information, to prevent\n unnecessary stat calls. While it should not normally be necessary to\n set this, you may pass the statCache from one glob() call to the\n options object of another, if you know that the filesystem will not\n change between calls. (See \"Race Conditions\" below.)\n* `sync` Perform a synchronous glob search.\n* `nounique` In some cases, brace-expanded patterns can result in the\n same file showing up multiple times in the result set. By default,\n this implementation prevents duplicates in the result set.\n Set this flag to disable that behavior.\n* `nonull` Set to never return an empty set, instead returning a set\n containing the pattern itself. This is the default in glob(3).\n* `nocase` Perform a case-insensitive match. Note that case-insensitive\n filesystems will sometimes result in glob returning results that are\n case-insensitively matched anyway, since readdir and stat will not\n raise an error.\n* `debug` Set to enable debug logging in minimatch and glob.\n* `globDebug` Set to enable debug logging in glob, but not minimatch.\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between node-glob and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen glob returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`glob.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n## Windows\n\n**Please only use forward-slashes in glob expressions.**\n\nThough windows uses either `/` or `\\` as its path separator, only `/`\ncharacters are used by this glob implementation. You must use\nforward-slashes **only** in glob expressions. Back-slashes will always\nbe interpreted as escape characters, not path separators.\n\nResults from absolute patterns such as `/foo/*` are mounted onto the\nroot setting using `path.join`. On windows, this will by default result\nin `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## Race Conditions\n\nGlob searching, by its very nature, is susceptible to race conditions,\nsince it relies on directory walking and such.\n\nAs a result, it is possible that a file that exists when glob looks for\nit may have been deleted or modified by the time it returns the result.\n\nAs part of its internal implementation, this program caches all stat\nand readdir calls that it makes, in order to cut down on system\noverhead. However, this also makes it even more susceptible to races,\nespecially if the cache or statCache objects are reused between glob\ncalls.\n\nUsers are thus advised not to use a glob result as a guarantee of\nfilesystem state in the face of rapid changes. For the vast majority\nof operations, this is never a problem.\n",
"readmeFilename": "README.md",
- "_id": "glob@3.2.6",
+ "bugs": {
+ "url": "https://github.com/isaacs/node-glob/issues"
+ },
+ "homepage": "https://github.com/isaacs/node-glob",
+ "_id": "glob@3.2.7",
"_from": "glob@>= 3.1.4"
}
View
1 node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json
@@ -295,6 +295,7 @@
"./test/cwd-test.js",
"./test/globstar-match.js",
"./test/mark.js",
+ "./test/new-glob-optional-options.js",
"./test/nocase-nomagic.js",
"./test/pause-resume.js",
"./test/root-nomount.js",
View
1 node_modules/jshint/node_modules/cli/package.json
@@ -24,7 +24,6 @@
},
"main": "cli.js",
"bugs": {
- "mail": "cohara87@gmail.com",
"url": "http://github.com/chriso/cli/issues"
},
"repository": {
View
76 node_modules/jshint/node_modules/minimatch/README.md
@@ -19,6 +19,7 @@ var minimatch = require("minimatch")
minimatch("bar.foo", "*.foo") // true!
minimatch("bar.foo", "*.bar") // false!
+minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
```
## Features
@@ -36,44 +37,6 @@ See:
* `man 3 fnmatch`
* `man 5 gitignore`
-### Comparisons to other fnmatch/glob implementations
-
-While strict compliance with the existing standards is a worthwhile
-goal, some discrepancies exist between minimatch and other
-implementations, and are intentional.
-
-If the pattern starts with a `!` character, then it is negated. Set the
-`nonegate` flag to suppress this behavior, and treat leading `!`
-characters normally. This is perhaps relevant if you wish to start the
-pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
-characters at the start of a pattern will negate the pattern multiple
-times.
-
-If a pattern starts with `#`, then it is treated as a comment, and
-will not match anything. Use `\#` to match a literal `#` at the
-start of a line, or set the `nocomment` flag to suppress this behavior.
-
-The double-star character `**` is supported by default, unless the
-`noglobstar` flag is set. This is supported in the manner of bsdglob
-and bash 4.1, where `**` only has special significance if it is the only
-thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not. **Note that this is different from the way that `**` is
-handled by ruby's `Dir` class.**
-
-If an escaped pattern has no matches, and the `nonull` flag is set,
-then minimatch.match returns the pattern as-provided, rather than
-interpreting the character escapes. For example,
-`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
-`"*a?"`. This is akin to setting the `nullglob` option in bash, except
-that it does not resolve escaped pattern characters.
-
-If brace expansion is not disabled, then it is performed before any
-other interpretation of the glob pattern. Thus, a pattern like
-`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
-**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
-checked for validity. Since those two are valid, matching proceeds.
-
-
## Minimatch Class
Create a minimatch object by instanting the `minimatch.Minimatch` class.
@@ -216,3 +179,40 @@ Suppress the behavior of treating a leading `!` character as negation.
Returns from negate expressions the same as if they were not negated.
(Ie, true on a hit, false on a miss.)
+
+
+## Comparisons to other fnmatch/glob implementations
+
+While strict compliance with the existing standards is a worthwhile
+goal, some discrepancies exist between minimatch and other
+implementations, and are intentional.
+
+If the pattern starts with a `!` character, then it is negated. Set the
+`nonegate` flag to suppress this behavior, and treat leading `!`
+characters normally. This is perhaps relevant if you wish to start the
+pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
+characters at the start of a pattern will negate the pattern multiple
+times.
+
+If a pattern starts with `#`, then it is treated as a comment, and
+will not match anything. Use `\#` to match a literal `#` at the
+start of a line, or set the `nocomment` flag to suppress this behavior.
+
+The double-star character `**` is supported by default, unless the
+`noglobstar` flag is set. This is supported in the manner of bsdglob
+and bash 4.1, where `**` only has special significance if it is the only
+thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
+`a/**b` will not.
+
+If an escaped pattern has no matches, and the `nonull` flag is set,
+then minimatch.match returns the pattern as-provided, rather than
+interpreting the character escapes. For example,
+`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
+`"*a?"`. This is akin to setting the `nullglob` option in bash, except
+that it does not resolve escaped pattern characters.
+
+If brace expansion is not disabled, then it is performed before any
+other interpretation of the glob pattern. Thus, a pattern like
+`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
+**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
+checked for validity. Since those two are valid, matching proceeds.
View
148 node_modules/jshint/node_modules/minimatch/minimatch.js
@@ -68,17 +68,6 @@ function charSet (s) {
// normalizes slashes.
var slashSplit = /\/+/
-minimatch.monkeyPatch = monkeyPatch
-function monkeyPatch () {
- var desc = Object.getOwnPropertyDescriptor(String.prototype, "match")
- var orig = desc.value
- desc.value = function (p) {
- if (p instanceof Minimatch) return p.match(this)
- return orig.call(this, p)
- }
- Object.defineProperty(String.prototype, desc)
-}
-
minimatch.filter = filter
function filter (pattern, options) {
options = options || {}
@@ -178,6 +167,8 @@ function Minimatch (pattern, options) {
this.make()
}
+Minimatch.prototype.debug = function() {}
+
Minimatch.prototype.make = make
function make () {
// don't do it more than once.
@@ -202,7 +193,9 @@ function make () {
// step 2: expand braces
var set = this.globSet = this.braceExpand()
- if (options.debug) console.error(this.pattern, set)
+ if (options.debug) this.debug = console.error
+
+ this.debug(this.pattern, set)
// step 3: now we have a set, so turn each one into a series of path-portion
// matching patterns.
@@ -213,21 +206,21 @@ function make () {
return s.split(slashSplit)
})
- if (options.debug) console.error(this.pattern, set)
+ this.debug(this.pattern, set)
// glob --> regexps
set = set.map(function (s, si, set) {
return s.map(this.parse, this)
}, this)
- if (options.debug) console.error(this.pattern, set)
+ this.debug(this.pattern, set)
// filter out everything that didn't compile properly.
set = set.filter(function (s) {
return -1 === s.indexOf(false)
})
- if (options.debug) console.error(this.pattern, set)
+ this.debug(this.pattern, set)
this.set = set
}
@@ -302,11 +295,11 @@ function braceExpand (pattern, options) {
// So, we pluck that off, and work with the rest,
// and then prepend it to everything we find.
if (pattern.charAt(0) !== "{") {
- // console.error(pattern)
+ this.debug(pattern)
var prefix = null
for (var i = 0, l = pattern.length; i < l; i ++) {
var c = pattern.charAt(i)
- // console.error(i, c)
+ this.debug(i, c)
if (c === "\\") {
escaping = !escaping
} else if (c === "{" && !escaping) {
@@ -317,11 +310,11 @@ function braceExpand (pattern, options) {
// actually no sets, all { were escaped.
if (prefix === null) {
- // console.error("no sets")
+ this.debug("no sets")
return [pattern]
}
- var tail = braceExpand(pattern.substr(i), options)
+ var tail = braceExpand.call(this, pattern.substr(i), options)
return tail.map(function (t) {
return prefix + t
})
@@ -336,8 +329,8 @@ function braceExpand (pattern, options) {
// first, handle numeric sets, since they're easier
var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/)
if (numset) {
- // console.error("numset", numset[1], numset[2])
- var suf = braceExpand(pattern.substr(numset[0].length), options)
+ this.debug("numset", numset[1], numset[2])
+ var suf = braceExpand.call(this, pattern.substr(numset[0].length), options)
, start = +numset[1]
, end = +numset[2]
, inc = start > end ? -1 : 1
@@ -369,10 +362,10 @@ function braceExpand (pattern, options) {
member = ""
}
- // console.error("Entering for")
+ this.debug("Entering for")
FOR: for (i = 1, l = pattern.length; i < l; i ++) {
var c = pattern.charAt(i)
- // console.error("", i, c)
+ this.debug("", i, c)
if (escaping) {
escaping = false
@@ -420,22 +413,22 @@ function braceExpand (pattern, options) {
// pattern.substr(i), or we have *not* closed the set,
// and need to escape the leading brace
if (depth !== 0) {
- // console.error("didn't close", pattern)
- return braceExpand("\\" + pattern, options)
+ this.debug("didn't close", pattern)
+ return braceExpand.call(this, "\\" + pattern, options)
}
// x{y,z} -> ["xy", "xz"]
- // console.error("set", set)
- // console.error("suffix", pattern.substr(i))
- var suf = braceExpand(pattern.substr(i), options)
+ this.debug("set", set)
+ this.debug("suffix", pattern.substr(i))
+ var suf = braceExpand.call(this, pattern.substr(i), options)
// ["b", "c{d,e}","{f,g}h"] ->
// [["b"], ["cd", "ce"], ["fh", "gh"]]
var addBraces = set.length === 1
- // console.error("set pre-expanded", set)
+ this.debug("set pre-expanded", set)
set = set.map(function (p) {
- return braceExpand(p, options)
- })
- // console.error("set expanded", set)
+ return braceExpand.call(this, p, options)
+ }, this)
+ this.debug("set expanded", set)
// [["b"], ["cd", "ce"], ["fh", "gh"]] ->
@@ -496,6 +489,7 @@ function parse (pattern, isSub) {
// not (start or / followed by . or .. followed by / or end)
: options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))"
: "(?!\\.)"
+ , self = this
function clearStateChar () {
if (stateChar) {
@@ -514,6 +508,7 @@ function parse (pattern, isSub) {
re += "\\"+stateChar
break
}
+ self.debug('clearStateChar %j %j', stateChar, re)
stateChar = false
}
}
@@ -522,9 +517,7 @@ function parse (pattern, isSub) {
; (i < len) && (c = pattern.charAt(i))
; i ++ ) {
- if (options.debug) {
- console.error("%s\t%s %s %j", pattern, i, re, c)
- }
+ this.debug("%s\t%s %s %j", pattern, i, re, c)
// skip over any that are escaped.
if (escaping && reSpecials[c]) {
@@ -551,13 +544,12 @@ function parse (pattern, isSub) {
case "+":
case "@":
case "!":
- if (options.debug) {
- console.error("%s\t%s %s %j <-- stateChar", pattern, i, re, c)
- }
+ this.debug("%s\t%s %s %j <-- stateChar", pattern, i, re, c)
// all of those are literals inside a class, except that
// the glob [!a] means [^a] in regexp
if (inClass) {
+ this.debug(' in class')
if (c === "!" && i === classStart + 1) c = "^"
re += c
continue
@@ -566,6 +558,7 @@ function parse (pattern, isSub) {
// if we already have a stateChar, then it means
// that there was something like ** or +? in there.
// Handle the stateChar, then proceed with this one.
+ self.debug('call clearStateChar %j', stateChar)
clearStateChar()
stateChar = c
// if extglob is disabled, then +(asdf|foo) isn't a thing.
@@ -591,6 +584,7 @@ function parse (pattern, isSub) {
, reStart: re.length })
// negation is (?:(?!js)[^/]*)
re += stateChar === "!" ? "(?:(?!" : "(?:"
+ this.debug('plType %j %j', stateChar, re)
stateChar = false
continue
@@ -600,6 +594,7 @@ function parse (pattern, isSub) {
continue
}
+ clearStateChar()
hasMagic = true
re += ")"
plType = patternListStack.pop().type
@@ -623,6 +618,7 @@ function parse (pattern, isSub) {
continue
}
+ clearStateChar()
re += "|"
continue
@@ -715,7 +711,7 @@ function parse (pattern, isSub) {
return $1 + $1 + $2 + "|"
})
- // console.error("tail=%j\n %s", tail, tail)
+ this.debug("tail=%j\n %s", tail, tail)
var t = pl.type === "*" ? star
: pl.type === "?" ? qmark
: "\\" + pl.type
@@ -829,7 +825,7 @@ minimatch.match = function (list, pattern, options) {
Minimatch.prototype.match = match
function match (f, partial) {
- // console.error("match", f, this.pattern)
+ this.debug("match", f, this.pattern)
// short-circuit in the case of busted things.
// comments, etc.
if (this.comment) return false
@@ -847,21 +843,24 @@ function match (f, partial) {
// treat the test path as a set of pathparts.
f = f.split(slashSplit)
- if (options.debug) {
- console.error(this.pattern, "split", f)
- }
+ this.debug(this.pattern, "split", f)
// just ONE of the pattern sets in this.set needs to match
// in order for it to be valid. If negating, then just one
// match means that we have failed.
// Either way, return on the first hit.
var set = this.set
- // console.error(this.pattern, "set", set)
+ this.debug(this.pattern, "set", set)
+
+ var splitFile = path.basename(f.join("/")).split("/")
for (var i = 0, l = set.length; i < l; i ++) {
- var pattern = set[i]
- var hit = this.matchOne(f, pattern, partial)
+ var pattern = set[i], file = f
+ if (options.matchBase && pattern.length === 1) {
+ file = splitFile
+ }
+ var hit = this.matchOne(file, pattern, partial)
if (hit) {
if (options.flipNegate) return true
return !this.negate
@@ -882,20 +881,12 @@ function match (f, partial) {
Minimatch.prototype.matchOne = function (file, pattern, partial) {
var options = this.options
- if (options.debug) {
- console.error("matchOne",
- { "this": this
- , file: file
- , pattern: pattern })
- }
-
- if (options.matchBase && pattern.length === 1) {
- file = path.basename(file.join("/")).split("/")
- }
+ this.debug("matchOne",
+ { "this": this
+ , file: file
+ , pattern: pattern })
- if (options.debug) {
- console.error("matchOne", file.length, pattern.length)
- }
+ this.debug("matchOne", file.length, pattern.length)
for ( var fi = 0
, pi = 0
@@ -904,23 +895,18 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
; (fi < fl) && (pi < pl)
; fi ++, pi ++ ) {
- if (options.debug) {
- console.error("matchOne loop")
- }
+ this.debug("matchOne loop")
var p = pattern[pi]
, f = file[fi]
- if (options.debug) {
- console.error(pattern, p, f)
- }
+ this.debug(pattern, p, f)
// should be impossible.
// some invalid regexp stuff in the set.
if (p === false) return false
if (p === GLOBSTAR) {
- if (options.debug)
- console.error('GLOBSTAR', [pattern, p, f])
+ this.debug('GLOBSTAR', [pattern, p, f])
// "**"
// a/**/b/**/c would match the following:
@@ -947,8 +933,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
var fr = fi
, pr = pi + 1
if (pr === pl) {
- if (options.debug)
- console.error('** at the end')
+ this.debug('** at the end')
// a ** at the end will just swallow the rest.
// We have found a match.
// however, it will not swallow /.x, unless
@@ -966,30 +951,25 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
WHILE: while (fr < fl) {
var swallowee = file[fr]
- if (options.debug) {
- console.error('\nglobstar while',
- file, fr, pattern, pr, swallowee)
- }
+ this.debug('\nglobstar while',
+ file, fr, pattern, pr, swallowee)
// XXX remove this slice. Just pass the start index.
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- if (options.debug)
- console.error('globstar found match!', fr, fl, swallowee)
+ this.debug('globstar found match!', fr, fl, swallowee)
// found a match.
return true
} else {
// can't swallow "." or ".." ever.
// can only swallow ".foo" when explicitly asked.
if (swallowee === "." || swallowee === ".." ||
(!options.dot && swallowee.charAt(0) === ".")) {
- if (options.debug)
- console.error("dot detected!", file, fr, pattern, pr)
+ this.debug("dot detected!", file, fr, pattern, pr)
break WHILE
}
// ** swallows a segment, and continue.
- if (options.debug)
- console.error('globstar swallow a segment, and continue')
+ this.debug('globstar swallow a segment, and continue')
fr ++
}
}
@@ -998,7 +978,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
// If there's more *pattern* left, then
if (partial) {
// ran out of file
- // console.error("\n>>> no match, partial?", file, fr, pattern, pr)
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr)
if (fr === fl) return true
}
return false
@@ -1014,14 +994,10 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
} else {
hit = f === p
}
- if (options.debug) {
- console.error("string match", p, f, hit)
- }
+ this.debug("string match", p, f, hit)
} else {
hit = f.match(p)
- if (options.debug) {
- console.error("pattern match", p, f, hit)
- }
+ this.debug("pattern match", p, f, hit)
}
if (!hit) return false
View
8 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/AUTHORS
@@ -1,8 +0,0 @@
-# Authors, sorted by whether or not they are me
-Isaac Z. Schlueter <i@izs.me>
-Carlos Brito Lage <carlos@carloslage.net>
-Marko Mikulicic <marko.mikulicic@isti.cnr.it>
-Trent Mick <trentm@gmail.com>
-Kevin O'Hara <kevinohara80@gmail.com>
-Marco Rogers <marco.rogers@gmail.com>
-Jesse Dailey <jesse.dailey@gmail.com>
View
25 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/bench.js
@@ -1,25 +0,0 @@
-var LRU = require('lru-cache');
-
-var max = +process.argv[2] || 10240;
-var more = 102400;
-
-var cache = LRU({
- max: max, maxAge: 86400e3
-});
-
-// fill cache
-for (var i = 0; i < max; ++i) {
- cache.set(i, {});
-}
-
-var start = process.hrtime();
-
-// adding more items
-for ( ; i < max+more; ++i) {
- cache.set(i, {});
-}
-
-var end = process.hrtime(start);
-var msecs = end[0] * 1E3 + end[1] / 1E6;
-
-console.log('adding %d items took %d ms', more, msecs.toPrecision(5));
View
389 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js
@@ -14,250 +14,239 @@ function hOP (obj, key) {
function naiveLength () { return 1 }
function LRUCache (options) {
- if (!(this instanceof LRUCache)) {
+ if (!(this instanceof LRUCache))
return new LRUCache(options)
- }
-
- var max
- if (typeof options === 'number') {
- max = options
- options = { max: max }
- }
-
- if (!options) options = {}
-
- max = options.max
-
- var lengthCalculator = options.length || naiveLength
-
- if (typeof lengthCalculator !== "function") {
- lengthCalculator = naiveLength
- }
- if (!max || !(typeof max === "number") || max <= 0 ) {
- // a little bit silly. maybe this should throw?
- max = Infinity
- }
-
- var allowStale = options.stale || false
+ if (typeof options === 'number')
+ options = { max: options }
- var maxAge = options.maxAge || null
+ if (!options)
+ options = {}
- var dispose = options.dispose
+ this._max = options.max
+ // Kind of weird to have a default max of Infinity, but oh well.
+ if (!this._max || !(typeof this._max === "number") || this._max <= 0 )
+ this._max = Infinity
- var cache = Object.create(null) // hash of items by key
- , lruList = Object.create(null) // list of items in order of use recency
- , mru = 0 // most recently used
- , lru = 0 // least recently used
- , length = 0 // number of items in the list
- , itemCount = 0
+ this._lengthCalculator = options.length || naiveLength
+ if (typeof this._lengthCalculator !== "function")
+ this._lengthCalculator = naiveLength
+ this._allowStale = options.stale || false
+ this._maxAge = options.maxAge || null
+ this._dispose = options.dispose
+ this.reset()
+}
- // resize the cache when the max changes.
- Object.defineProperty(this, "max",
- { set : function (mL) {
- if (!mL || !(typeof mL === "number") || mL <= 0 ) mL = Infinity
- max = mL
- // if it gets above double max, trim right away.
- // otherwise, do it whenever it's convenient.
- if (length > max) trim()
- }
- , get : function () { return max }
- , enumerable : true
- })
-
- // resize the cache when the lengthCalculator changes.
- Object.defineProperty(this, "lengthCalculator",
- { set : function (lC) {
- if (typeof lC !== "function") {
- lengthCalculator = naiveLength
- length = itemCount
- for (var key in cache) {
- cache[key].length = 1
- }
- } else {
- lengthCalculator = lC
- length = 0
- for (var key in cache) {
- cache[key].length = lengthCalculator(cache[key].value)
- length += cache[key].length
- }
+// resize the cache when the max changes.
+Object.defineProperty(LRUCache.prototype, "max",
+ { set : function (mL) {
+ if (!mL || !(typeof mL === "number") || mL <= 0 ) mL = Infinity
+ this._max = mL
+ if (this._length > this._max) trim(this)
+ }
+ , get : function () { return this._max }
+ , enumerable : true
+ })
+
+// resize the cache when the lengthCalculator changes.
+Object.defineProperty(LRUCache.prototype, "lengthCalculator",
+ { set : function (lC) {
+ if (typeof lC !== "function") {
+ this._lengthCalculator = naiveLength
+ this._length = this._itemCount
+ for (var key in this._cache) {
+ this._cache[key].length = 1
+ }
+ } else {
+ this._lengthCalculator = lC
+ this._length = 0
+ for (var key in this._cache) {
+ this._cache[key].length = this._lengthCalculator(this._cache[key].value)
+ this._length += this._cache[key].length
}
-
- if (length > max) trim()
- }
- , get : function () { return lengthCalculator }
- , enumerable : true
- })
-
- Object.defineProperty(this, "length",
- { get : function () { return length }
- , enumerable : true
- })
-
-
- Object.defineProperty(this, "itemCount",
- { get : function () { return itemCount }
- , enumerable : true
- })
-
- this.forEach = function (fn, thisp) {
- thisp = thisp || this
- var i = 0;
- for (var k = mru - 1; k >= 0 && i < itemCount; k--) if (lruList[k]) {
- i++
- var hit = lruList[k]
- if (maxAge && (Date.now() - hit.now > maxAge)) {
- del(hit)
- if (!allowStale) hit = undefined
- }
- if (hit) {
- fn.call(thisp, hit.value, hit.key, this)
}
- }
- }
- this.keys = function () {
- var keys = new Array(itemCount)
- var i = 0
- for (var k = mru - 1; k >= 0 && i < itemCount; k--) if (lruList[k]) {
- var hit = lruList[k]
- keys[i++] = hit.key
+ if (this._length > this._max) trim(this)
}
- return keys
- }
-
- this.values = function () {
- var values = new Array(itemCount)
- var i = 0
- for (var k = mru - 1; k >= 0 && i < itemCount; k--) if (lruList[k]) {
- var hit = lruList[k]
- values[i++] = hit.value
+ , get : function () { return this._lengthCalculator }
+ , enumerable : true
+ })
+
+Object.defineProperty(LRUCache.prototype, "length",
+ { get : function () { return this._length }
+ , enumerable : true
+ })
+
+
+Object.defineProperty(LRUCache.prototype, "itemCount",
+ { get : function () { return this._itemCount }
+ , enumerable : true
+ })
+
+LRUCache.prototype.forEach = function (fn, thisp) {
+ thisp = thisp || this
+ var i = 0;
+ for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
+ i++
+ var hit = this._lruList[k]
+ if (this._maxAge && (Date.now() - hit.now > this._maxAge)) {
+ del(this, hit)
+ if (!this._allowStale) hit = undefined
}
- return values
- }
-
- this.reset = function () {
- if (dispose) {
- for (var k in cache) {
- dispose(k, cache[k].value)
- }
+ if (hit) {
+ fn.call(thisp, hit.value, hit.key, this)
}
- cache = {}
- lruList = {}
- lru = 0
- mru = 0
- length = 0
- itemCount = 0
}
+}
- // Provided for debugging/dev purposes only. No promises whatsoever that
- // this API stays stable.
- this.dump = function () {
- return cache
+LRUCache.prototype.keys = function () {
+ var keys = new Array(this._itemCount)
+ var i = 0
+ for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
+ var hit = this._lruList[k]
+ keys[i++] = hit.key
}
+ return keys
+}
- this.dumpLru = function () {
- return lruList
+LRUCache.prototype.values = function () {
+ var values = new Array(this._itemCount)
+ var i = 0
+ for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) {
+ var hit = this._lruList[k]
+ values[i++] = hit.value
}
+ return values
+}
- this.set = function (key, value) {
- if (hOP(cache, key)) {
- // dispose of the old one before overwriting
- if (dispose) dispose(key, cache[key].value)
- if (maxAge) cache[key].now = Date.now()
- cache[key].value = value
- this.get(key)
- return true
+LRUCache.prototype.reset = function () {
+ if (this._dispose && this._cache) {
+ for (var k in this._cache) {
+ this._dispose(k, this._cache[k].value)
}
+ }
- var len = lengthCalculator(value)
- var age = maxAge ? Date.now() : 0
- var hit = new Entry(key, value, mru++, len, age)
+ this._cache = Object.create(null) // hash of items by key
+ this._lruList = Object.create(null) // list of items in order of use recency
+ this._mru = 0 // most recently used
+ this._lru = 0 // least recently used
+ this._length = 0 // number of items in the list
+ this._itemCount = 0
+}
- // oversized objects fall out of cache automatically.
- if (hit.length > max) {
- if (dispose) dispose(key, value)
- return false
- }
+// Provided for debugging/dev purposes only. No promises whatsoever that
+// this API stays stable.
+LRUCache.prototype.dump = function () {
+ return this._cache
+}
- length += hit.length
- lruList[hit.lu] = cache[key] = hit
- itemCount ++
+LRUCache.prototype.dumpLru = function () {
+ return this._lruList
+}
- if (length > max) trim()
+LRUCache.prototype.set = function (key, value) {
+ if (hOP(this._cache, key)) {
+ // dispose of the old one before overwriting
+ if (this._dispose) this._dispose(key, this._cache[key].value)
+ if (this._maxAge) this._cache[key].now = Date.now()
+ this._cache[key].value = value
+ this.get(key)
return true
}
- this.has = function (key) {
- if (!hOP(cache, key)) return false
- var hit = cache[key]
- if (maxAge && (Date.now() - hit.now > maxAge)) {
- return false
- }
- return true
- }
+ var len = this._lengthCalculator(value)
+ var age = this._maxAge ? Date.now() : 0
+ var hit = new Entry(key, value, this._mru++, len, age)
- this.get = function (key) {
- return get(key, true)
+ // oversized objects fall out of cache automatically.
+ if (hit.length > this._max) {
+ if (this._dispose) this._dispose(key, value)
+ return false
}
- this.peek = function (key) {
- return get(key, false)
- }
+ this._length += hit.length
+ this._lruList[hit.lu] = this._cache[key] = hit
+ this._itemCount ++
- function get (key, doUse) {
- var hit = cache[key]
- if (hit) {
- if (maxAge && (Date.now() - hit.now > maxAge)) {
- del(hit)
- if (!allowStale) hit = undefined
- } else {
- if (doUse) use(hit)
- }
- if (hit) hit = hit.value
- }
- return hit
- }
+ if (this._length > this._max) trim(this)
+ return true
+}
- function use (hit) {
- shiftLU(hit)
- hit.lu = mru ++
- lruList[hit.lu] = hit
+LRUCache.prototype.has = function (key) {
+ if (!hOP(this._cache, key)) return false
+ var hit = this._cache[key]
+ if (this._maxAge && (Date.now() - hit.now > this._maxAge)) {
+ return false
}
+ return true
+}
- this.del = function (key) {
- del(cache[key])
- }
+LRUCache.prototype.get = function (key) {
+ return get(this, key, true)
+}
- function trim () {
- while (lru < mru && length > max)
- del(lruList[lru])
- }
+LRUCache.prototype.peek = function (key) {
+ return get(this, key, false)
+}
- function shiftLU(hit) {
- delete lruList[ hit.lu ]
- while (lru < mru && !lruList[lru]) lru ++
- }
+LRUCache.prototype.pop = function () {
+ var hit = this._lruList[this._lru]
+ del(this, hit)
+ return hit || null
+}
- function del(hit) {
- if (hit) {
- if (dispose) dispose(hit.key, hit.value)
- length -= hit.length
- itemCount --
- delete cache[ hit.key ]
- shiftLU(hit)
+LRUCache.prototype.del = function (key) {
+ del(this, this._cache[key])
+}
+
+function get (self, key, doUse) {
+ var hit = self._cache[key]
+ if (hit) {
+ if (self._maxAge && (Date.now() - hit.now > self._maxAge)) {
+ del(self, hit)
+ if (!self._allowStale) hit = undefined
+ } else {
+ if (doUse) use(self, hit)
}
+ if (hit) hit = hit.value
+ }
+ return hit
+}
+
+function use (self, hit) {
+ shiftLU(self, hit)
+ hit.lu = self._mru ++
+ self._lruList[hit.lu] = hit
+}
+
+function trim (self) {
+ while (self._lru < self._mru && self._length > self._max)
+ del(self, self._lruList[self._lru])
+}
+
+function shiftLU (self, hit) {
+ delete self._lruList[ hit.lu ]
+ while (self._lru < self._mru && !self._lruList[self._lru]) self._lru ++
+}
+
+function del (self, hit) {
+ if (hit) {
+ if (self._dispose) self._dispose(hit.key, hit.value)
+ self._length -= hit.length
+ self._itemCount --
+ delete self._cache[ hit.key ]
+ shiftLU(self, hit)
}
}
// classy, since V8 prefers predictable objects.
-function Entry (key, value, mru, len, age) {
+function Entry (key, value, lu, length, now) {
this.key = key
this.value = value
- this.lu = mru
- this.length = len
- this.now = age
+ this.lu = lu
+ this.length = length
+ this.now = now
}
})()
View
38 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json
@@ -1,7 +1,7 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
- "version": "2.3.1",
+ "version": "2.5.0",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
@@ -22,38 +22,12 @@
"type": "MIT",
"url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE"
},
- "contributors": [
- {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me"
- },
- {
- "name": "Carlos Brito Lage",
- "email": "carlos@carloslage.net"
- },
- {
- "name": "Marko Mikulicic",
- "email": "marko.mikulicic@isti.cnr.it"
- },
- {
- "name": "Trent Mick",
- "email": "trentm@gmail.com"
- },
- {
- "name": "Kevin O'Hara",
- "email": "kevinohara80@gmail.com"
- },
- {
- "name": "Marco Rogers",
- "email": "marco.rogers@gmail.com"
- },
- {
- "name": "Jesse Dailey",
- "email": "jesse.dailey@gmail.com"
- }
- ],
"readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n function to all values in the cache. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n stale items out of the cache when you `get(key)`. (That is, it's\n not pre-emptively doing a `setTimeout` or anything.) If you set\n `stale:true`, it'll return the stale value before deleting it. If\n you don't set this, then it'll return `undefined` when you try to\n get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n Both of these will update the \"recently used\"-ness of the key.\n They do what you think.\n\n* `peek(key)`\n\n Returns the key value (or `undefined` if not found) without\n updating the \"recently used\"-ness of the key.\n\n (If you find yourself using this a lot, you *might* be using the\n wrong sort of data structure, but there are some use cases where\n it's handy.)\n\n* `del(key)`\n\n Deletes a key out of the cache.\n\n* `reset()`\n\n Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n Check if a key is in the cache, without updating the recent-ness\n or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n Just like `Array.prototype.forEach`. Iterates over all the keys\n in the cache, in order of recent-ness. (Ie, more recently used\n items are iterated over first.)\n\n* `keys()`\n\n Return an array of the keys in the cache.\n\n* `values()`\n\n Return an array of the values in the cache.\n",
"readmeFilename": "README.md",
- "_id": "lru-cache@2.3.1",
+ "bugs": {
+ "url": "https://github.com/isaacs/node-lru-cache/issues"
+ },
+ "homepage": "https://github.com/isaacs/node-lru-cache",
+ "_id": "lru-cache@2.5.0",
"_from": "lru-cache@2"
}
View
40 node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js
@@ -327,3 +327,43 @@ test("least recently set w/ peek", function (t) {
t.equal(cache.get("a"), undefined)
t.end()
})
+
+test("pop the least used item", function (t) {
+ var cache = new LRU(3)
+ , last
+
+ cache.set("a", "A")
+ cache.set("b", "B")
+ cache.set("c", "C")
+
+ t.equal(cache.length, 3)
+ t.equal(cache.max, 3)
+
+ // Ensure we pop a, c, b
+ cache.get("b", "B")
+
+ last = cache.pop()
+ t.equal(last.key, "a")
+ t.equal(last.value, "A")
+ t.equal(cache.length, 2)
+ t.equal(cache.max, 3)
+
+ last = cache.pop()
+ t.equal(last.key, "c")
+ t.equal(last.value, "C")
+ t.equal(cache.length, 1)
+ t.equal(cache.max, 3)
+
+ last = cache.pop()
+ t.equal(last.key, "b")
+ t.equal(last.value, "B")
+ t.equal(cache.length, 0)
+ t.equal(cache.max, 3)
+
+ last = cache.pop()
+ t.equal(last, null)
+ t.equal(cache.length, 0)
+ t.equal(cache.max, 3)
+
+ t.end()
+})
View
4 node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json
@@ -33,6 +33,10 @@
"license": "BSD",
"readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/isaacs/sigmund/issues"
+ },
+ "homepage": "https://github.com/isaacs/sigmund",
"_id": "sigmund@1.0.0",
"_from": "sigmund@~1.0.0"
}
View
12 node_modules/jshint/node_modules/minimatch/package.json
@@ -6,14 +6,14 @@
},
"name": "minimatch",
"description": "a glob matcher in javascript",
- "version": "0.2.12",
+ "version": "0.2.14",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/minimatch.git"
},
"main": "minimatch.js",
"scripts": {
- "test": "tap test"
+ "test": "tap test/*.js"
},
"engines": {
"node": "*"
@@ -29,8 +29,12 @@
"type": "MIT",
"url": "http://github.com/isaacs/minimatch/raw/master/LICENSE"
},
- "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nEventually, it will replace the C binding in node-glob.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n### Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not. **Note that this is different from the way that `**` is\nhandled by ruby's `Dir` class.**\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n\n## Minimatch Class\n\nCreate a minimatch object by instanting the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n## Functions\n\nThe top-level exported function has a `cache` property, which is an LRU\ncache set to store 100 items. So, calling these methods repeatedly\nwith the same pattern and options will use the same Minimatch object,\nsaving the cost of parsing it multiple times.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself. When set, an empty list is returned if there are\nno matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n",
+ "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nEventually, it will replace the C binding in node-glob.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\nminimatch(\"bar.foo\", \"*.+(bar|foo)\", { debug: true }) // true, and noisy!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n## Minimatch Class\n\nCreate a minimatch object by instanting the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n## Functions\n\nThe top-level exported function has a `cache` property, which is an LRU\ncache set to store 100 items. So, calling these methods repeatedly\nwith the same pattern and options will use the same Minimatch object,\nsaving the cost of parsing it multiple times.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself. When set, an empty list is returned if there are\nno matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n",
"readmeFilename": "README.md",
- "_id": "minimatch@0.2.12",
+ "bugs": {
+ "url": "https://github.com/isaacs/minimatch/issues"
+ },
+ "homepage": "https://github.com/isaacs/minimatch",
+ "_id": "minimatch@0.2.14",
"_from": "minimatch@0.x.x"
}
View
3 node_modules/jshint/node_modules/shelljs/package.json
@@ -36,6 +36,9 @@
},
"readme": "# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)\n\nShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!\n\nThe project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:\n\n+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader\n+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger\n+ [JSHint](http://jshint.com) - Most popular JavaScript linter\n+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers\n+ [Yeoman](http://yeoman.io/) - Web application stack and development tool\n+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation\n\nand [many more](https://npmjs.org/browse/depended/shelljs).\n\n## Installing\n\nVia npm:\n\n```bash\n$ npm install [-g] shelljs\n```\n\nIf the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to\nrun ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:\n\n```bash\n$ shjs my_script\n```\n\nYou can also just copy `shell.js` into your project's directory, and `require()` accordingly.\n\n\n## Examples\n\n### JavaScript\n\n```javascript\nrequire('shelljs/global');\n\nif (!which('git')) {\n echo('Sorry, this script requires git');\n exit(1);\n}\n\n// Copy files to release dir\nmkdir('-p', 'out/Release');\ncp('-R', 'stuff/*', 'out/Release');\n\n// Replace macros in each .js file\ncd('lib');\nls('*.js').forEach(function(file) {\n sed('-i', 'BUILD_VERSION', 'v0.1.2', file);\n sed('-i', /.*REMOVE_THIS_LINE.*\\n/, '', file);\n sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat('macro.js'), file);\n});\ncd('..');\n\n// Run external tool synchronously\nif (exec('git commit -am \"Auto-commit\"').code !== 0) {\n echo('Error: Git commit failed');\n exit(1);\n}\n```\n\n### CoffeeScript\n\n```coffeescript\nrequire 'shelljs/global'\n\nif not which 'git'\n echo 'Sorry, this script requires git'\n exit 1\n\n# Copy files to release dir\nmkdir '-p', 'out/Release'\ncp '-R', 'stuff/*', 'out/Release'\n\n# Replace macros in each .js file\ncd 'lib'\nfor file in ls '*.js'\n sed '-i', 'BUILD_VERSION', 'v0.1.2', file\n sed '-i', /.*REMOVE_THIS_LINE.*\\n/, '', file\n sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat 'macro.js', file\ncd '..'\n\n# Run external tool synchronously\nif (exec 'git commit -am \"Auto-commit\"').code != 0\n echo 'Error: Git commit failed'\n exit 1\n```\n\n## Global vs. Local\n\nThe example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.\n\nExample:\n\n```javascript\nvar shell = require('shelljs');\nshell.echo('hello world');\n```\n\n## Make tool\n\nA convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.\n\nExample (CoffeeScript):\n\n```coffeescript\nrequire 'shelljs/make'\n\ntarget.all = ->\n target.bundle()\n target.docs()\n\ntarget.bundle = ->\n cd __dirname\n mkdir 'build'\n cd 'lib'\n (cat '*.js').to '../build/output.js'\n\ntarget.docs = ->\n cd __dirname\n mkdir 'docs'\n cd 'lib'\n for file in ls '*.js'\n text = grep '//@', file # extract special comments\n text.replace '//@', '' # remove comment tags\n text.to 'docs/my_docs.md'\n```\n\nTo run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.\n\n\n\n<!-- \n\n DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED\n\n-->\n\n\n## Command reference\n\n\nAll commands run synchronously, unless otherwise stated.\n\n\n### cd('dir')\nChanges to directory `dir` for the duration of the script\n\n### pwd()\nReturns the current directory.\n\n### ls([options ,] path [,path ...])\n### ls([options ,] path_array)\nAvailable options:\n\n+ `-R`: recursive\n+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)\n\nExamples:\n\n```javascript\nls('projs/*.js');\nls('-R', '/users/me', '/tmp');\nls('-R', ['/users/me', '/tmp']); // same as above\n```\n\nReturns array of files in the given path, or in current directory if no path provided.\n\n### find(path [,path ...])\n### find(path_array)\nExamples:\n\n```javascript\nfind('src', 'lib');\nfind(['src', 'lib']); // same as above\nfind('.').filter(function(file) { return file.match(/\\.js$/); });\n```\n\nReturns array of all files (however deep) in the given paths.\n\nThe main difference from `ls('-R', path)` is that the resulting file names\ninclude the base directories, e.g. `lib/resources/file1` instead of just `file1`.\n\n### cp([options ,] source [,source ...], dest)\n### cp([options ,] source_array, dest)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\ncp('file1', 'dir1');\ncp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');\ncp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above\n```\n\nCopies files. The wildcard `*` is accepted.\n\n### rm([options ,] file [, file ...])\n### rm([options ,] file_array)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\nrm('-rf', '/tmp/*');\nrm('some_file.txt', 'another_file.txt');\nrm(['some_file.txt', 'another_file.txt']); // same as above\n```\n\nRemoves files. The wildcard `*` is accepted.\n\n### mv(source [, source ...], dest')\n### mv(source_array, dest')\nAvailable options:\n\n+ `f`: force\n\nExamples:\n\n```javascript\nmv('-f', 'file', 'dir/');\nmv('file1', 'file2', 'dir/');\nmv(['file1', 'file2'], 'dir/'); // same as above\n```\n\nMoves files. The wildcard `*` is accepted.\n\n### mkdir([options ,] dir [, dir ...])\n### mkdir([options ,] dir_array)\nAvailable options:\n\n+ `p`: full path (will create intermediate dirs if necessary)\n\nExamples:\n\n```javascript\nmkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');\nmkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above\n```\n\nCreates directories.\n\n### test(expression)\nAvailable expression primaries:\n\n+ `'-b', 'path'`: true if path is a block device\n+ `'-c', 'path'`: true if path is a character device\n+ `'-d', 'path'`: true if path is a directory\n+ `'-e', 'path'`: true if path exists\n+ `'-f', 'path'`: true if path is a regular file\n+ `'-L', 'path'`: true if path is a symboilc link\n+ `'-p', 'path'`: true if path is a pipe (FIFO)\n+ `'-S', 'path'`: true if path is a socket\n\nExamples:\n\n```javascript\nif (test('-d', path)) { /* do something with dir */ };\nif (!test('-f', path)) continue; // skip if it's a regular file\n```\n\nEvaluates expression using the available primaries and returns corresponding value.\n\n### cat(file [, file ...])\n### cat(file_array)\n\nExamples:\n\n```javascript\nvar str = cat('file*.txt');\nvar str = cat('file1', 'file2');\nvar str = cat(['file1', 'file2']); // same as above\n```\n\nReturns a string containing the given file, or a concatenated string\ncontaining the files if more than one file is given (a new line character is\nintroduced between each file). Wildcard `*` accepted.\n\n### 'string'.to(file)\n\nExamples:\n\n```javascript\ncat('input.txt').to('output.txt');\n```\n\nAnalogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as\nthose returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_\n\n### sed([options ,] search_regex, replace_str, file)\nAvailable options:\n\n+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_\n\nExamples:\n\n```javascript\nsed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');\nsed(/.*DELETE_THIS_LINE.*\\n/, '', 'source.js');\n```\n\nReads an input string from `file` and performs a JavaScript `replace()` on the input\nusing the given search regex and replacement string. Returns the new string after replacement.\n\n### grep([options ,] regex_filter, file [, file ...])\n### grep([options ,] regex_filter, file_array)\nAvailable options:\n\n+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.\n\nExamples:\n\n```javascript\ngrep('-v', 'GLOBAL_VARIABLE', '*.js');\ngrep('GLOBAL_VARIABLE', '*.js');\n```\n\nReads input string from given files and returns a string containing all lines of the\nfile that match the given `regex_filter`. Wildcard `*` accepted.\n\n### which(command)\n\nExamples:\n\n```javascript\nvar nodeExec = which('node');\n```\n\nSearches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.\nReturns string containing the absolute path to the command.\n\n### echo(string [,string ...])\n\nExamples:\n\n```javascript\necho('hello world');\nvar str = echo('hello world');\n```\n\nPrints string to stdout, and returns string with additional utility methods\nlike `.to()`.\n\n### dirs([options | '+N' | '-N'])\n\nAvailable options:\n\n+ `-c`: Clears the directory stack by deleting all of the elements.\n\nArguments:\n\n+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.\n+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.\n\nDisplay the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.\n\nSee also: pushd, popd\n\n### pushd([options,] [dir | '-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.\n+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n\nExamples:\n\n```javascript\n// process.cwd() === '/usr'\npushd('/etc'); // Returns /etc /usr\npushd('+1'); // Returns /usr /etc\n```\n\nSave the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.\n\n### popd([options,] ['-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.\n+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.\n\nExamples:\n\n```javascript\necho(process.cwd()); // '/usr'\npushd('/etc'); // '/etc /usr'\necho(process.cwd()); // '/etc'\npopd(); // '/usr'\necho(process.cwd()); // '/usr'\n```\n\nWhen no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.\n\n### exit(code)\nExits the current process with the given exit code.\n\n### env['VAR_NAME']\nObject containing environment variables (both getter and setter). Shortcut to process.env.\n\n### exec(command [, options] [, callback])\nAvailable options (all `false` by default):\n\n+ `async`: Asynchronous execution. Defaults to true if a callback is provided.\n+ `silent`: Do not echo program output to console.\n\nExamples:\n\n```javascript\nvar version = exec('node --version', {silent:true}).output;\n\nvar child = exec('some_long_running_process', {async:true});\nchild.stdout.on('data', function(data) {\n /* ... do something with data ... */\n});\n\nexec('some_long_running_process', function(code, output) {\n console.log('Exit code:', code);\n console.log('Program output:', output);\n});\n```\n\nExecutes the given `command` _synchronously_, unless otherwise specified.\nWhen in synchronous mode returns the object `{ code:..., output:... }`, containing the program's\n`output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and\nthe `callback` gets the arguments `(code, output)`.\n\n**Note:** For long-lived processes, it's best to run `exec()` asynchronously as\nthe current synchronous implementation uses a lot of CPU. This should be getting\nfixed soon.\n\n### chmod(octal_mode || octal_string, file)\n### chmod(symbolic_mode, file)\n\nAvailable options:\n\n+ `-v`: output a diagnostic for every file processed\n+ `-c`: like verbose but report only when a change is made\n+ `-R`: change files and directories recursively\n\nExamples:\n\n```javascript\nchmod(755, '/Users/brandon');\nchmod('755', '/Users/brandon'); // same as above \nchmod('u+x', '/Users/brandon');\n```\n\nAlters the permissions of a file or directory by either specifying the\nabsolute permissions in octal form or expressing the changes in symbols.\nThis command tries to mimic the POSIX behavior as much as possible.\nNotable exceptions:\n\n+ In symbolic modes, 'a-r' and '-r' are identical. No consideration is\n given to the umask.\n+ There is no \"quiet\" option since default behavior is to run silent.\n\n## Configuration\n\n\n### config.silent\nExample:\n\n```javascript\nvar silentState = config.silent; // save old silent state\nconfig.silent = true;\n/* ... */\nconfig.silent = silentState; // restore old silent state\n```\n\nSuppresses all command output if `true`, except for `echo()` calls.\nDefault is `false`.\n\n### config.fatal\nExample:\n\n```javascript\nconfig.fatal = true;\ncp('this_file_does_not_exist', '/dev/null'); // dies here\n/* more commands... */\n```\n\nIf `true` the script will die on errors. Default is `false`.\n\n## Non-Unix commands\n\n\n### tempdir()\nSearches and returns string containing a writeable, platform-dependent temporary directory.\nFollows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).\n\n### error()\nTests if error occurred in the last command. Returns `null` if no error occurred,\notherwise returns string explaining the error\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/arturadib/shelljs/issues"
+ },
"_id": "shelljs@0.1.4",
"_from": "shelljs@0.1.x"
}
View
3 node_modules/jshint/node_modules/underscore/package.json
@@ -27,6 +27,9 @@
},
"readme": " __\n /\\ \\ __\n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____\n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\\n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/\n \\ \\____/\n \\/___/\n\nUnderscore.js is a utility-belt library for JavaScript that provides\nsupport for the usual functional suspects (each, map, reduce, filter...)\nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://underscorejs.org\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n",
"readmeFilename": "README.md",
+ "bugs": {
+ "url": "https://github.com/documentcloud/underscore/issues"
+ },
"_id": "underscore@1.4.4",
"_from": "underscore@1.4.x"
}
View
15 node_modules/jshint/package.json
@@ -1,6 +1,6 @@
{
"name": "jshint",
- "version": "2.3.0",
+ "version": "2.4.1",
"homepage": "http://jshint.com/",
"description": "Static analysis tool for JavaScript",
"author": {
@@ -30,12 +30,13 @@
"underscore": "1.4.x",
"cli": "0.4.x",
"minimatch": "0.x.x",
+ "htmlparser2": "3.3.x",
"console-browserify": "0.1.x"
},
"devDependencies": {
- "jshint": "2.3.x",
+ "jshint": "2.4.x",
"shelljs": "0.1.x",
- "browserify": "2.12.x",
+ "browserify": "3.x",
"coveraje": "0.2.x",
"nodeunit": "0.8.x",
"sinon": "1.7.x",
@@ -69,10 +70,6 @@
],
"readme": "JSHint, A Static Code Analysis Tool for JavaScript\n--------------------------------------------------\n\n\\[ [Use it online](http://jshint.com/) • [About](http://jshint.com/about/) • \n[Docs](http://jshint.com/docs/) • [FAQ](http://jshint.com/docs/faq) • \n[Install](http://jshint.com/install/) • [Hack](http://jshint.com/hack/) • \n[Blog](http://jshint.com/blog/) • [Twitter](https://twitter.com/jshint/) \\]\n\n[![Build Status](https://travis-ci.org/jshint/jshint.png?branch=master)](https://travis-ci.org/jshint/jshint)\n[![NPM version](https://badge.fury.io/js/jshint.png)](http://badge.fury.io/js/jshint)\n\nJSHint is a community-driven tool to detect errors and potential problems\nin JavaScript code and to enforce your team’s coding conventions. It is\nvery flexible so you can easily adjust it to your particular coding guidelines\nand the environment you expect your code to execute in.\n\n#### JSHint 2.x versus JSHint 3\n\nThere's an effort going on to release the next major version of JSHint. All\ndevelopment in the `master` branch is for the version 3.0. Current stable\nversion is in the `2.x` branch. Keep that in mind when submitting pull requests.\n\nAlso, before reporting a bug or thinking about hacking on JSHint, read this:\n[JSHint 3 plans](http://www.jshint.com/blog/jshint-3-plans/). TL;DR: we're\nmoving away from style checks within JSHint so no new features around\nstyle checks will be accepted. Bug fixes are fine for the `2.x` branch.\n\n#### Reporting a bug\n\nTo report a bug simply create a\n[new GitHub Issue](https://github.com/jshint/jshint/issues/new) and describe\nyour problem or suggestion. We welcome all kind of feedback regarding\nJSHint including but not limited to:\n\n * When JSHint doesn't work as expected\n * When JSHint complains about valid JavaScript code that works in all browsers\n * When you simply want a new option or feature\n\nBefore reporting a bug look around to see if there are any open or closed tickets\nthat cover your issue. And remember the wisdom: pull request > bug report > tweet.\n\n\n#### License\n\nJSHint is distributed under the MIT License. One file and one file only\n(src/stable/jshint.js) is distributed under the slightly modified MIT License.\n\n\n#### Thank you!\n\nWe really appreciate all kind of feedback and contributions. Thanks for using and supporting JSHint!\n",
"readmeFilename": "README.md",
- "_id": "jshint@2.3.0",
- "dist": {
- "shasum": "19504455a2c20c46ee183361eb87f3a1c0b7dc47"
- },
- "_from": "jshint@",
- "_resolved": "https://registry.npmjs.org/jshint/-/jshint-2.3.0.tgz"
+ "_id": "jshint@2.4.1",
+ "_from": "jshint@2.4.1"
}
View
103 node_modules/jshint/src/cli.js
@@ -1,9 +1,11 @@
"use strict";
+var _ = require("underscore");
var cli = require("cli");
var path = require("path");
var shjs = require("shelljs");
var minimatch = require("minimatch");
+var htmlparser = require("htmlparser2");
var JSHINT = require("./jshint.js").JSHINT;
var defReporter = require("./reporters/default").reporter;
@@ -12,11 +14,19 @@ var OPTIONS = {
"reporter": ["reporter", "Custom reporter (<PATH>|jslint|checkstyle)", "string", undefined ],
"exclude": ["exclude",
"Exclude files matching the given filename pattern (same as .jshintignore)", "string", null],
+ "exclude-path": ["exclude-path", "Pass in a custom jshintignore file path", "string", null],
"verbose": ["verbose", "Show message codes"],
"show-non-errors": ["show-non-errors", "Show additional data generated by jshint"],
"extra-ext": ["e",
"Comma-separated list of file extensions to use (default is .js)", "string", ""],
+ "extract": [
+ "extract",
+ "Extract inline scripts contained in HTML (auto|always|never, default to never)",
+ "string",
+ "never"
+ ],
+
// Deprecated options.
"jslint-reporter": [
"jslint-reporter",
@@ -108,7 +118,11 @@ function loadNpmConfig(file) {
if (!fp)
return null;
- return require(fp).jshintConfig || null;
+ try {
+ return require(fp).jshintConfig;
+ } catch (e) {
+ return null;
+ }
}
/**
@@ -171,8 +185,8 @@ function findFile(name, dir) {
*
* @return {array} a list of files to ignore.
*/
-function loadIgnores(exclude) {
- var file = findFile(".jshintignore");
+function loadIgnores(exclude, excludePath) {
+ var file = findFile(excludePath || ".jshintignore");
if (!file && !exclude) {
return [];
@@ -219,6 +233,62 @@ function isIgnored(fp, patterns) {
}
/**
+ * Extract JS code from a given source code. The source code my be either HTML
+ * code or JS code. In the latter case, no extraction will be done unless
+ * 'always' is given.
+ *
+ * @param {string} code a piece of code
+ * @param {string} when 'always' will extract the JS code, no matter what.
+ * 'never' won't do anything. 'auto' will check if the code looks like HTML
+ * before extracting it.
+ *
+ * @return {string} the extracted code
+ */
+function extract(code, when) {
+ // A JS file won't start with a less-than character, whereas a HTML file
+ // should always start with that.
+ if (when !== "always" && (when !== "auto" || !/^\s*</.test(code)))
+ return code;
+
+ var inscript = false;
+ var index = 0;
+ var js = [];
+
+ // Test if current tag is a valid <script> tag.
+ function onopen(name, attrs) {
+ if (name !== "script")
+ return;
+
+ if (attrs.type && !/text\/javascript/.test(attrs.type.toLowerCase()))
+ return;
+
+ // Mark that we're inside a <script> a tag and push all new lines
+ // in between the last </script> tag and this <script> tag to preserve
+ // location information.
+ inscript = true;
+ js.push.apply(js, code.slice(index, parser.endIndex).match(/\n\r|\n|\r/g));
+ }
+
+ function onclose(name) {
+ if (name !== "script" || !inscript)
+ return;
+
+ inscript = false;
+ index = parser.startIndex;
+ }
+
+ function ontext(data) {
+ if (inscript)
+ js.push(data); // Collect JavaScript code.
+ }
+
+ var parser = new htmlparser.Parser({ onopentag: onopen, onclosetag: onclose, ontext: ontext });
+ parser.parseComplete(code);
+
+ return js.join("");
+}
+
+/**
* Recursively gather all files that need to be linted,
* excluding those that user asked to ignore.
*
@@ -304,6 +374,8 @@ function lint(code, results, config, data, file) {
}
var exports = {
+ extract: extract,
+
/**
* Loads and parses a configuration file.
*
@@ -323,6 +395,12 @@ var exports = {
try {
var config = JSON.parse(removeComments(shjs.cat(fp)));
config.dirname = path.dirname(fp);
+
+ if (config['extends']) {
+ _.defaults(config, exports.loadConfig(path.resolve(config.dirname, config['extends'])));
+ delete config['extends'];
+ }
+
return config;
} catch (err) {
cli.error("Can't parse config file: " + fp);
@@ -379,7 +457,7 @@ var exports = {
if (opts.useStdin) {
cli.withStdin(function (code) {
- lint(code, results, opts.config || {}, data);
+ lint(extract(code, opts.extract), results, opts.config || {}, data);
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
cb(results.length === 0);
});
@@ -398,14 +476,14 @@ var exports = {
process.exit(1);
}
- lint(code, results, config, data, file);
+ lint(extract(code, opts.extract), results, config, data, file);
});
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
return results.length === 0;
},
- /**
+ /**
* Helper exposed for testing.
* Used to determine is stdout has any buffered output before exiting the program
*/
@@ -492,13 +570,14 @@ var exports = {
}
done(exports.run({
- args: cli.args,
- config: config,
- reporter: reporter,
- ignores: loadIgnores(options.exclude),
+ args: cli.args,
+ config: config,
+ reporter: reporter,
+ ignores: loadIgnores(options.exclude, options["exclude-path"]),
extensions: options["extra-ext"],
- verbose: options.verbose,
- useStdin: {"-": true, "/dev/stdin": true}[args[args.length - 1]]
+ verbose: options.verbose,
+ extract: options.extract,
+ useStdin: {"-": true, "/dev/stdin": true}[args[args.length - 1]]
}, done));
}
};
View
580 node_modules/jshint/src/jshint.js
@@ -133,7 +133,6 @@ var JSHINT = (function () {
typed : true, // if typed array globals should be predefined
undef : true, // if variables should be declared before used
scripturl : true, // if script-targeted URLs should be tolerated
- shadow : true, // if variable shadowing should be tolerated
smarttabs : true, // if smarttabs should be tolerated
// (http://www.emacswiki.org/emacs/SmartTabs)
strict : true, // require the "use strict"; pragma
@@ -149,6 +148,7 @@ var JSHINT = (function () {
wsh : true, // if the Windows Scripting Host environment globals
// should be predefined
yui : true, // YUI variables should be predefined
+ noyield : true, // allow generators without a yield
// Obsolete options
onecase : true, // if one case switch statements should be allowed
@@ -171,6 +171,11 @@ var JSHINT = (function () {
maxdepth : false, // {int} max nested block depth per function
maxparams : false, // {int} max params per function
maxcomplexity: false, // {int} max cyclomatic complexity per function
+ shadow : false, // if variable shadowing should be tolerated
+ // "inner" - check for variables defined in the same scope only
+ // "outer" - check for variables defined in outer scopes as well
+ // false - same as inner
+ // true - allow variable shadowing
unused : true, // warn if variables are unused. Available options:
// false - don't check for unused variables
// true - "vars" + check last function param
@@ -311,18 +316,10 @@ var JSHINT = (function () {
});
}
- function combine(t, o) {
- var n;
- for (n in o) {
- if (_.has(o, n) && !_.has(JSHINT.blacklist, n)) {
- t[n] = o[n];
- }
- }
- }
-
- function updatePredefined() {
- Object.keys(JSHINT.blacklist).forEach(function (key) {
- delete predefined[key];
+ function combine(dest, src) {
+ Object.keys(src).forEach(function (name) {
+ if (JSHINT.blacklist.hasOwnProperty(name)) return;
+ dest[name] = src[name];
});
}
@@ -528,62 +525,73 @@ var JSHINT = (function () {
return i;
}
- function addlabel(t, type, tkn, islet) {
- // Define t in the current function in the current scope.
+ // name: string
+ // opts: { type: string, token: token, islet: bool }
+ function addlabel(name, opts) {
+ opts = opts || {};
+
+ var type = opts.type;
+ var token = opts.token;
+ var islet = opts.islet;
+
+ // Define label in the current function in the current scope.
if (type === "exception") {
- if (_.has(funct["(context)"], t)) {
- if (funct[t] !== true && !state.option.node) {
- warning("W002", state.tokens.next, t);
+ if (_.has(funct["(context)"], name)) {
+ if (funct[name] !== true && !state.option.node) {
+ warning("W002", state.tokens.next, name);
}
}
}
- if (_.has(funct, t) && !funct["(global)"]) {
- if (funct[t] === true) {
+ if (_.has(funct, name) && !funct["(global)"]) {
+ if (funct[name] === true) {
if (state.option.latedef) {
- if ((state.option.latedef === true && _.contains([funct[t], type], "unction")) ||
- !_.contains([funct[t], type], "unction")) {
- warning("W003", state.tokens.next, t);
+ if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) ||
+ !_.contains([funct[name], type], "unction")) {
+ warning("W003", state.tokens.next, name);
}
}
} else {
- if (!state.option.shadow && type !== "exception" ||
- (funct["(blockscope)"].getlabel(t))) {
- warning("W004", state.tokens.next, t);
+ if ((!state.option.shadow || _.contains([ "inner", "outer" ], state.option.shadow)) &&
+ type !== "exception" || funct["(blockscope)"].getlabel(name)) {
+ warning("W004", state.tokens.next, name);
}
}
}
- // a double definition of a let variable in same block throws a TypeError
- if (funct["(blockscope)"] && funct["(blockscope)"].current.has(t)) {
- error("E044", state.tokens.next, t);
+ if (funct["(context)"] && _.has(funct["(context)"], name) && type !== "function") {
+ if (state.option.shadow === "outer") {
+ warning("W123", state.tokens.next, name);
+ }
}
// if the identifier is from a let, adds it only to the current blockscope
if (islet) {
- funct["(blockscope)"].current.add(t, type, state.tokens.curr);
+ funct["(blockscope)"].current.add(name, type, state.tokens.curr);
} else {
+ funct["(blockscope)"].shadow(name);
+ funct[name] = type;
- funct[t] = type;
-
- if (tkn) {
- funct["(tokens)"][t] = tkn;
+ if (token) {
+ funct["(tokens)"][name] = token;
}
+ setprop(funct, name, { unused: opts.unused || false });
+
if (funct["(global)"]) {
- global[t] = funct;
- if (_.has(implied, t)) {
+ global[name] = funct;
+ if (_.has(implied, name)) {
if (state.option.latedef) {
- if ((state.option.latedef === true && _.contains([funct[t], type], "unction")) ||
- !_.contains([funct[t], type], "unction")) {
- warning("W003", state.tokens.next, t);
+ if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) ||
+ !_.contains([funct[name], type], "unction")) {
+ warning("W003", state.tokens.next, name);
}
}
- delete implied[t];
+ delete implied[name];
}
} else {
- scope[t] = funct;
+ scope[name] = funct;
}
}
}
@@ -604,7 +612,7 @@ var JSHINT = (function () {
val = false;
JSHINT.blacklist[key] = key;
- updatePredefined();
+ delete predefined[key];
} else {
predef[key] = (val === "true");
}
@@ -635,13 +643,6 @@ var JSHINT = (function () {
if (ch1 === ch2 && (ch1 === "\"" || ch1 === "'")) {
m = m
.substr(1, m.length - 2)
- .replace("\\b", "\b")
- .replace("\\t", "\t")
- .replace("\\n", "\n")
- .replace("\\v", "\v")
- .replace("\\f", "\f")
- .replace("\\r", "\r")
- .replace("\\\\", "\\")
.replace("\\\"", "\"");
}
@@ -697,15 +698,14 @@ var JSHINT = (function () {
if (key === "validthis") {
// `validthis` is valid only within a function scope.
- if (funct["(global)"]) {
- error("E009");
- } else {
- if (val === "true" || val === "false") {
- state.option.validthis = (val === "true");
- } else {
- error("E002", nt);
- }
- }
+
+ if (funct["(global)"])
+ return void error("E009");
+
+ if (val !== "true" && val !== "false")
+ return void error("E002", nt);
+
+ state.option.validthis = (val === "true");
return;
}
@@ -725,6 +725,24 @@ var JSHINT = (function () {
return;
}
+ if (key === "shadow") {
+ switch (val) {
+ case "true":
+ state.option.shadow = true;
+ break;
+ case "outer":
+ state.option.shadow = "outer";
+ break;
+ case "false":
+ case "inner":
+ state.option.shadow = "inner";
+ break;
+ default:
+ error("E002", nt);
+ }
+ return;
+ }
+
if (key === "unused") {
switch (val) {
case "true":
@@ -1215,19 +1233,23 @@ var JSHINT = (function () {
function prefix(s, f) {
var x = symbol(s, 150);
reserveName(x);
+
x.nud = (typeof f === "function") ? f : function () {
this.right = expression(150);
this.arity = "unary";
+
if (this.id === "++" || this.id === "--") {
if (state.option.plusplus) {
warning("W016", this, this.id);
- } else if ((!this.right.identifier || isReserved(this.right)) &&
+ } else if (this.right && (!this.right.identifier || isReserved(this.right)) &&
this.right.id !== "." && this.right.id !== "[") {
warning("W017", this);
}
}
+
return this;
};
+
return x;
}
@@ -1651,7 +1673,7 @@ var JSHINT = (function () {
advance();
advance(":");
scope = Object.create(s);
- addlabel(t.value, "label");
+ addlabel(t.value, { type: "label" });
if (!state.tokens.next.labelled && state.tokens.next.value !== "{") {
warning("W028", state.tokens.next, t.value, state.tokens.next.value);
@@ -1683,6 +1705,14 @@ var JSHINT = (function () {
}
r = expression(0, true);
+ if (r && (!r.identifier || r.value !== "function") && (r.type !== "(punctuator)")) {
+ if (!state.directive["use strict"] &&
+ state.option.globalstrict &&
+ state.option.strict) {
+ warning("E007");
+ }
+ }
+
// Look for the final semicolon.
if (!t.block) {
@@ -1801,11 +1831,11 @@ var JSHINT = (function () {
* Parses a single block. A block is a sequence of statements wrapped in
* braces.
*
- * ordinary - true for everything but function bodies and try blocks.
- * stmt - true if block can be a single statement (e.g. in if/for/while).
- * isfunc - true if block is a function body
- * isfatarrow -
- * iscase - true if block is a switch case block
+ * ordinary - true for everything but function bodies and try blocks.
+ * stmt - true if block can be a single statement (e.g. in if/for/while).
+ * isfunc - true if block is a function body
+ * isfatarrow - true if its a body of a fat arrow function
+ * iscase - true if block is a switch case block
*/
function block(ordinary, stmt, isfunc, isfatarrow, iscase) {
var a,
@@ -1948,17 +1978,13 @@ var JSHINT = (function () {
function note_implied(tkn) {
- var name = tkn.value, line = tkn.line, a = implied[name];
- if (typeof a === "function") {
- a = false;
- }
+ var name = tkn.value;
+ var desc = Object.getOwnPropertyDescriptor(implied, name);
- if (!a) {
- a = [line];
- implied[name] = a;
- } else if (a[a.length - 1] !== line) {
- a.push(line);
- }
+ if (!desc)
+ implied[name] = [tkn.line];
+ else
+ desc.value.push(tkn.line);
}
@@ -1976,30 +2002,30 @@ var JSHINT = (function () {
type: "(identifier)",
lbp: 0,
identifier: true,
+
nud: function () {
- var v = this.value,
- s = scope[v],
- f;
+ var v = this.value;
+ var s = scope[v];
+ var f;
+ var block;
if (typeof s === "function") {
// Protection against accidental inheritance.
s = undefined;
- } else if (typeof s === "boolean") {
+ } else if (!funct["(blockscope)"].current.has(v) && typeof s === "boolean") {
f = funct;
funct = functions[0];
- addlabel(v, "var");
+ addlabel(v, { type: "var" });
s = funct;
funct = f;
}
- var block;
- if (_.has(funct, "(blockscope)")) {
- block = funct["(blockscope)"].getlabel(v);
- }
+
+ block = funct["(blockscope)"].getlabel(v);
// The name is in scope and defined in the current function.
if (funct === s || block) {
// Change 'unused' to 'var', and reject labels.
- // the name is in a block scope
+ // the name is in a block scope.
switch (block ? block[v]["(type)"] : funct[v]) {
case "unused":
if (block) block[v]["(type)"] = "var";
@@ -2010,6 +2036,9 @@ var JSHINT = (function () {
else funct[v] = "function";
this["function"] = true;
break;
+ case "const":
+ setprop(funct, v, { unused: false });
+ break;
case "function":
this["function"] = true;
break;
@@ -2097,6 +2126,9 @@ var JSHINT = (function () {