Skip to content
Browse files

Removing physical file dependencies under /assets/ since NPM can hand…

…le that for me
  • Loading branch information...
1 parent 128f548 commit 76361349802f66986d39cf63e7f432d205e72987 @arthurakay committed
Showing with 0 additions and 37,718 deletions.
  1. +0 −8 assets/jshint-master/.gitignore
  2. +0 −3 assets/jshint-master/.travis.yml
  3. +0 −105 assets/jshint-master/CONTRIBUTING.md
  4. +0 −20 assets/jshint-master/LICENSE
  5. +0 −267 assets/jshint-master/README.md
  6. +0 −3 assets/jshint-master/bin/jshint
  7. +0 −2 assets/jshint-master/examples/.jshintignore
  8. +0 −5 assets/jshint-master/examples/.jshintrc
  9. +0 −21 assets/jshint-master/examples/reporter.js
  10. +0 −14 assets/jshint-master/jshint.json
  11. +0 −106 assets/jshint-master/make.js
  12. +0 −39 assets/jshint-master/package.json
  13. +0 −4,372 assets/jshint-master/res/jshint.ai
  14. +0 −380 assets/jshint-master/src/cli/cli.js
  15. +0 −43 assets/jshint-master/src/next/constants.js
  16. +0 −193 assets/jshint-master/src/next/jshint.js
  17. +0 −302 assets/jshint-master/src/next/reason.js
  18. +0 −125 assets/jshint-master/src/next/regexp.js
  19. +0 −359 assets/jshint-master/src/next/utils.js
  20. +0 −59 assets/jshint-master/src/platforms/jsc.js
  21. +0 −29 assets/jshint-master/src/platforms/jsc.sh
  22. +0 −86 assets/jshint-master/src/platforms/rhino.js
  23. +0 −258 assets/jshint-master/src/platforms/wsh.js
  24. +0 −107 assets/jshint-master/src/reporters/checkstyle.js
  25. +0 −19 assets/jshint-master/src/reporters/default.js
  26. +0 −56 assets/jshint-master/src/reporters/jslint_xml.js
  27. +0 −45 assets/jshint-master/src/reporters/non_error.js
  28. +0 −207 assets/jshint-master/src/shared/messages.js
  29. +0 −386 assets/jshint-master/src/shared/vars.js
  30. +0 −3,588 assets/jshint-master/src/stable/jshint.js
  31. +0 −1,365 assets/jshint-master/src/stable/lex.js
  32. +0 −34 assets/jshint-master/src/stable/reg.js
  33. +0 −22 assets/jshint-master/src/stable/state.js
  34. +0 −162 assets/jshint-master/src/stable/style.js
  35. +0 −350 assets/jshint-master/tests/cli.js
  36. +0 −13 assets/jshint-master/tests/next/fixtures/parser/comments.js
  37. +0 −9 assets/jshint-master/tests/next/fixtures/parser/simple_file.js
  38. +0 −398 assets/jshint-master/tests/next/fixtures/parser/tokens.json
  39. +0 −28 assets/jshint-master/tests/next/fixtures/reason/arguments.js
  40. +0 −46 assets/jshint-master/tests/next/fixtures/reason/asi.js
  41. +0 −21 assets/jshint-master/tests/next/fixtures/reason/bitwise.js
  42. +0 −51 assets/jshint-master/tests/next/fixtures/reason/comparison.js
  43. +0 −7 assets/jshint-master/tests/next/fixtures/reason/debugger.js
  44. +0 −5 assets/jshint-master/tests/next/fixtures/reason/esprima.js
  45. +0 −11 assets/jshint-master/tests/next/fixtures/reason/expr_in_test.js
  46. +0 −58 assets/jshint-master/tests/next/fixtures/reason/fifty.js
  47. +0 −26 assets/jshint-master/tests/next/fixtures/reason/iterator.js
  48. +0 −24 assets/jshint-master/tests/next/fixtures/reason/native.js
  49. +0 −38 assets/jshint-master/tests/next/fixtures/reason/proto.js
  50. +0 −19 assets/jshint-master/tests/next/fixtures/reason/shadow.js
  51. +0 −10 assets/jshint-master/tests/next/fixtures/reason/trailing.js
  52. +0 −42 assets/jshint-master/tests/next/fixtures/reason/undef.js
  53. +0 −10 assets/jshint-master/tests/next/fixtures/regexp/dashes.js
  54. +0 −9 assets/jshint-master/tests/next/fixtures/utils/simple_file.js
  55. +0 −121 assets/jshint-master/tests/next/lib/helpers.js
  56. +0 −84 assets/jshint-master/tests/next/unit/parser.js
  57. +0 −130 assets/jshint-master/tests/next/unit/reason.js
  58. +0 −39 assets/jshint-master/tests/next/unit/regexp.js
  59. +0 −128 assets/jshint-master/tests/next/unit/utils.js
  60. +0 −82 assets/jshint-master/tests/stable/helpers/coveraje.js
  61. +0 −7 assets/jshint-master/tests/stable/helpers/fixture.js
  62. +0 −148 assets/jshint-master/tests/stable/helpers/testhelper.js
  63. +0 −1,158 assets/jshint-master/tests/stable/regression/libs/backbone.js
  64. +0 −9,304 assets/jshint-master/tests/stable/regression/libs/jquery-1.7.js
  65. +0 −487 assets/jshint-master/tests/stable/regression/libs/json2.js
  66. +0 −4,454 assets/jshint-master/tests/stable/regression/libs/lodash.js
  67. +0 −6,082 assets/jshint-master/tests/stable/regression/libs/prototype-17.js
  68. +0 −8 assets/jshint-master/tests/stable/regression/npm.js
  69. +0 −203 assets/jshint-master/tests/stable/regression/thirdparty.js
  70. +0 −574 assets/jshint-master/tests/stable/unit/core.js
  71. +0 −638 assets/jshint-master/tests/stable/unit/envs.js
  72. +0 −28 assets/jshint-master/tests/stable/unit/fixtures/asi.js
  73. +0 −31 assets/jshint-master/tests/stable/unit/fixtures/blocks.js
  74. +0 −12 assets/jshint-master/tests/stable/unit/fixtures/boss.js
  75. +0 −18 assets/jshint-master/tests/stable/unit/fixtures/browser.js
  76. +0 −17 assets/jshint-master/tests/stable/unit/fixtures/camelcase.js
Sorry, we could not display the entire diff because it was too big.
View
8 assets/jshint-master/.gitignore
@@ -1,8 +0,0 @@
-dist/*
-node_modules/*
-
-# TextMate 2 properties file.
-.tm_properties
-
-# File with my local one-off experiments.
-demo.js
View
3 assets/jshint-master/.travis.yml
@@ -1,3 +0,0 @@
-language: node_js
-node_js:
- - 0.8
View
105 assets/jshint-master/CONTRIBUTING.md
@@ -1,105 +0,0 @@
-How to contribute
-=================
-
-The best way to make sure your issue is addressed is to submit a patch. We accept
-patches through all mediums: pull requests, email, issue comment, tweet with a link
-to a snippet, graffiti outside of Anton's apartment, etc.
-
-However, before sending a patch, please make sure that the following applies:
-
-* There is a corresponding issue. If there is no issue yet, create one before
- working on your patch. Patches that come out of nowhere usually end up in
- the end of our queue.
-* Your commit message links to that issue.
-* Your commit message is very descriptive ([example](https://github.com/jshint/jshint/commit/5751c5ed249b7a035758a3ae876cfa1a360fd144)).
-* Your patch doesn't have useless merge commits.
-* Your coding style is similar to ours (see below).
-* Your patch is 100% tested. We don't accept any test regressions.
-* All tests and lint checks pass (`node make.js test` and `node make.js lint`).
-* You understand that we're super grateful for your patch.
-
-Coding Style
-------------
-
-This section describes our coding style guide. You might not agree with it and that's
-fine but if you're going to send us patches treat this guide as a law.
-
-### Our main rule is simple:
-
-> All code in any code-base should look like a single person typed it, no matter how
-many people contributed. —[idiomatic.js](https://github.com/rwldrn/idiomatic.js/)
-
-### Whitespace:
-
-* We use hard tabs everywhere.
-* [Smart tabs](http://www.emacswiki.org/SmartTabs) are okay.
-* Use one space after `if`, `for`, `while`, etc.
-* Use one space after `function` for anonymous functions but not for named functions:
-
-```javascript
-var a = function () {};
-function a() {}
-```
-
-* Feel free to indent variable assignments or property definitions if it makes the code look better. But don't abuse that:
-
-```javascript
-// Good
-var next = token.peak();
-var prev = token.peak(-1);
-var cur = token.current;
-
-var scope = {
- name: "(global)",
- parent: parentScope,
- vars: [],
- uses: []
-};
-
-// Bad
-var cur = token.current;
-var isSemicolon = cur.isPunctuator(";");
-```
-
-* Wrap multi-line comments with new lines on both sides.
-
-### Variables
-
-* Use one `var` per variable unless you don't assign any values to it (and it's short enough):
-
-```javascript
-var token = tokens.find(index);
-var scope = scopes.current;
-var next, prev, cur;
-```
-
-* Don't be overly descriptive with your variable names but don't abuse one-letter variables either. Find a sweet spot somewhere in between.
-
-### Comments
-
-* Use `//` for all comments.
-* Comment everything that is not obvious.
-* If you're adding a new check, write a comment describing why this check is important and what it checks for.
-
-### Misc
-
-* Always use strict mode.
-* Always use strict comparisons: `===` and `!==`.
-* Use semicolons.
-* Don't use comma-first notation.
-* Try not to chain stuff unless it **really** helps (e.g. in tests).
-* Don't short-circuit expressions if you're not assigning the result:
-
-```javascript
-// Good
-token = token || tokens.find(0);
-
-// Bad
-token.isPunctuator(";") && report.addWarning("W001");
-
-// Good
-if (token.isPunctuator(";"))
- report.addWarning("W001");
-```
-
-Today we use JSHint's `white:true` to enforce some of these rules. Eventually we'll switch to JSHint Next style enforcing component. But it's not ready yet.
View
20 assets/jshint-master/LICENSE
@@ -1,20 +0,0 @@
-Copyright 2012 Anton Kovalyov (http://jshint.com)
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
267 assets/jshint-master/README.md
@@ -1,267 +0,0 @@
-JSHint, A Static Code Analysis Tool for JavaScript
-==================================================
-
-JSHint is a community-driven tool to detect errors and potential problems in
-JavaScript code and to enforce your team's coding conventions. We made JSHint
-very flexible so you can easily adjust it to your particular coding guidelines
-and the environment you expect your code to execute in.
-
-Our goal is to help JavaScript developers write complex programs without
-worrying about typos and language gotchas.
-
-We believe that static code analysis programs—as well as other code quality
-tools—are important and beneficial to the JavaScript community and, thus,
-should not alienate their users.
-
-For general usage information, visit our website:
-[http://jshint.com/](http://jshint.com/).
-
-Reporting a bug
----------------
-
-To report a bug simply create a
-[new GitHub Issue](https://github.com/jshint/jshint/issues/new) and describe
-your problem or suggestion. We welcome all kind of feedback regarding
-JSHint including but not limited to:
-
- * When JSHint doesn't work as expected
- * When JSHint complains about valid JavaScript code that works in all browsers
- * When you simply want a new option or feature
-
-Before reporting a bug look around to see if there are any open or closed tickets
-that cover your issue. And remember the wisdom: pull request > bug report > tweet.
-
-Installation
-------------
-
-You can install JSHint via NPM:
-
- npm install jshint -g
-
-We also provide platform wrappers for Rhino, JavaScriptCore and Windows Script
-Host. To use them, clone this repo and run our build command:
-
- node make.js
-
-Usage
------
-
- jshint -h
-
-You can also require JSHint itself as a module.
-
- var jshint = require('jshint');
-
-Note: If you are using npm v1.x be sure to install jshint locally (without the -g
-flag) or link it globally.
-
-Custom Reporters
-----------------
-
-Specify a custom reporter module (see example/reporter.js).
-
- --reporter path/to/reporter.js
-
-Use a jslint compatible xml reporter.
-
- --jslint-reporter
-
-Show additional non-error data generated by jshint (unused globals etc).
-
- --show-non-errors
-
-Configuration Options
----------------------
-
-**Note:** This behavior described below is very different from versions
-prior to `0.6`.
-
-The CLI uses the default options that come with JSHint. Only one extra
-option is unique to the CLI version of JSHint: `globals` allows you to
-define an object of globals that get ignored for every file.
-
-To have your own configuration apply, there are several methods you can
-use:
-
-### Specify Manually
-
-Setting the `--config=/path/to/your/config` command line option to specify
-your own configuration file outside of the directory tree for your project.
-
-### Within your Project's Directory Tree
-
-When the CLI is called, and a configuration file isn't specified already,
-`node-jshint` will attempt to locate one for you starting in `pwd`. (or
-"present working directory") If this does not yield a `.jshintrc` file,
-it will move one level up (`..`) the directory tree all the way up to
-the filesystem root. If a file is found, it stops immediately and uses
-that set of configuration.
-
-This setup allows you to set up **one** configuration file for your entire
-project. (place it in the root folder) As long as you run `jshint` from
-anywhere within your project directory tree, the same configuration file
-will be used.
-
-### Home Directory
-
-If all the methods above do not yield a `.jshintrc` to use, the last place
-that will be checked is your user's `$HOME` directory.
-
-## File Extensions
-
-Default extension for files is ".js". If you want to use JSHint with other
-file extensions (.json), you need to pass this extra extension as an
-option:
-
- --extra-ext .json
-
-## Ignoring Files and Directories
-
-If there is a .jshintignore file in your project's directory tree, (also
-provided you run `jshint` from within your project's directory) then any
-directories or files specified will be skipped over. (behaves just like
-a `.gitignore` file)
-
-**Note:** Pattern matching uses minimatch, with the nocase
-[option](https://github.com/isaacs/minimatch). When there is no match,
-it performs a left side match (when no forward slashes present and path
-is a directory).
-
-Using JSHint as a library
--------------------------
-
-It is easy to use JSHint as a JavaScript library. Just install the package
-with NPM and, in your code, import a global `JSHINT` function:
-
- var JSHINT = require("jshint").JSHINT;
-
-This function takes two parameters. The first parameter is either a string
-or an array of strings. If it is a string, it will be split on '\n' or
-'\r'. If it is an array of strings, it is assumed that each string
-represents one line. The source can be a JavaScript text or a JSON text.
-
-The second parameter is an optional object of options which control the
-operation of JSHINT. Most of the options are booleans: they are all
-optional and have a default value of false.
-
-The third parameter is an object of global variables, with keys as names
-and a boolean value to determine if they are assignable.
-
-If it checks out, JSHINT returns true. Otherwise, it returns false.
-
-If false, you can inspect JSHINT.errors to find out the problems.
-JSHINT.errors is an array of objects containing these members:
-
- {
- line : The line (relative to 1) at which the lint was found
- character : The character (relative to 1) at which the lint was found
- reason : The problem
- evidence : The text line in which the problem occured
- scope : The scope of the problem.
- raw : The raw message before the details were inserted
- a : The first detail
- b : The second detail
- c : The third detail
- d : The fourth detail
- }
-
-If a fatal error was found, a null will be the last element of the
-JSHINT.errors array.
-
-You can request a data structure which contains JSHint's results.
-
- var myData = JSHINT.data();
-
-It returns a structure with this form:
-
- {
- errors: [
- {
- line : NUMBER,
- character : NUMBER,
- reason : STRING,
- evidence : STRING
- }
- ],
- functions: [
- name : STRING,
- line : NUMBER,
- character : NUMBER,
- last : NUMBER,
- lastcharacter: NUMBER,
- param : [ STRING ],
- closure : [ STRING ],
- var : [ STRING ],
- exception : [ STRING ],
- outer : [ STRING ],
- unused : [ STRING ],
- global : [ STRING ],
- label : [ STRING ]
- ],
- globals: [
- STRING
- ],
- member: {
- STRING: NUMBER
- },
- unused: [
- {
- name : STRING,
- line : NUMBER
- }
- ],
- implieds: [
- {
- name: STRING,
- line: NUMBER
- }
- ],
- urls: [
- STRING
- ],
- json: BOOLEAN
- }
-
-Empty array will not be included.
-
-
-FAQ
----
-
-#### How do I turn off "mixed tabs and spaces" warning?
-
-If you're using so-called [smart tabs](http://www.emacswiki.org/SmartTabs)
-then we have an option `smarttabs` for you. Otherwise, your solution is to
-run JSHint with a custom reporter that discards any warnings you don't like.
-For example, this [example reporter](https://gist.github.com/3885619)
-discards all warnings about mixed tabs and spaces.
-
-Contributing
-------------
-
-Look for a file named `CONTRIBUTING.md` in this repository. It contains our
-contributing guidelines. We also have
-[a mailing list](http://groups.google.com/group/jshint/).
-
-License
--------
-
-JSHint is distributed under the MIT License. One file and one file only
-(src/stable/jshint.js) is distributed under the slightly modified MIT License.
-
-Attribution
------------
-
-Core Team members:
-
- * [Anton Kovalyov](http://anton.kovalyov.net/) ([@valueof](http://twitter.com/valueof))
- * [Wolfgang Kluge](http://klugesoftware.de/) ([blog](http://gehirnwindung.de/))
- * [Josh Perez](http://www.goatslacker.com/) ([@goatslacker](http://twitter.com/goatslacker))
- * [Brent Lintner](http://brentlintner.heroku.com/) ([@brentlintner](http://twitter.com/brentlintner))
-
-Maintainer: Anton Kovalyov
-
-Thank you!
-----------
-
-We really appreciate all kind of feedback and contributions. Thanks for using and supporting JSHint!
View
3 assets/jshint-master/bin/jshint
@@ -1,3 +0,0 @@
-#!/usr/bin/env node
-
-require("./../src/cli/cli.js").interpret(process.argv);
View
2 assets/jshint-master/examples/.jshintignore
@@ -1,2 +0,0 @@
-ignored.js
-another.js
View
5 assets/jshint-master/examples/.jshintrc
@@ -1,5 +0,0 @@
-{
- "strict": true,
- "undef": true,
- "unused": true
-}
View
21 assets/jshint-master/examples/reporter.js
@@ -1,21 +0,0 @@
-"use strict";
-
-module.exports = {
- reporter: function (res) {
- var len = res.length;
- var str = "";
-
- res.forEach(function (r) {
- var file = r.file;
- var err = r.error;
-
- str += file + ": line " + err.line + ", col " +
- err.character + ", " + err.reason + "\n";
- });
-
- if (str) {
- process.stdout.write(str + "\n" + len + " error" +
- ((len === 1) ? "" : "s") + "\n");
- }
- }
-};
View
14 assets/jshint-master/jshint.json
@@ -1,14 +0,0 @@
-{
- "es5": true,
- "boss": true,
- "node": true,
- "strict": true,
- "white": true,
- "smarttabs": true,
- "maxlen": 100,
- "newcap": false,
- "undef": true,
- "unused": true,
- "onecase": true,
- "indent": 2
-}
View
106 assets/jshint-master/make.js
@@ -1,106 +0,0 @@
-#!/usr/bin/env node
-/*global ls:true, target:true, find: true, echo: true, cat:true, exit:true, exec: true */
-
-"use strict";
-
-require("shelljs/make");
-var cli = require("cli");
-
-var TESTS = [
- "tests/stable/unit/",
- "tests/stable/regression/",
- "tests/next/unit/"
-];
-
-var OPTIONS = JSON.parse(cat("./jshint.json"));
-
-target.all = function () {
- target.lint();
- target.test();
- target.build();
-};
-
-target.lint = function () {
- var jshint = require("jshint").JSHINT;
- var files = find("src").filter(function (file) {
- return file.match(/\.js$/);
- }).concat(ls(__dirname + "/*.js"));
-
- TESTS.forEach(function (dir) {
- ls(dir + "*.js").forEach(function (file) {
- files.push(file);
- });
- });
-
- echo("Linting files...", "\n");
-
- var failures = {};
- files.forEach(function (file) {
- var passed = jshint(cat(file), OPTIONS);
- process.stdout.write(passed ? "." : "F");
-
- if (!passed) {
- failures[file] = jshint.data();
- }
- });
-
- echo("\n");
-
- if (Object.keys(failures).length === 0) {
- cli.ok("All files passed.");
- return;
- }
-
- var outputError = function (err) {
- if (!err) {
- return;
- }
-
- var line = "[L" + err.line + "]";
- while (line.length < 10) {
- line += " ";
- }
-
- echo(line, err.reason);
- echo("\n");
- };
-
- for (var key in failures) {
- cli.error(key);
- failures[key].errors.forEach(outputError);
- }
-
- exit(1);
-};
-
-target.test = function () {
- var nodeunit = require("nodeunit").reporters.minimal;
- var files = [];
-
- TESTS.forEach(function (dir) {
- ls(dir + "*.js").forEach(function (file) {
- files.push(file);
- });
- });
-
- echo("Running tests...", "\n");
- nodeunit.run(files);
-};
-
-target.build = function () {
- echo("Building platform wrappers:");
-
- var rhino = cat("./src/stable/jshint.js", "./src/platforms/rhino.js");
- rhino = "#!/usr/bin/env rhino\n\n" + rhino;
- rhino.to("./dist/jshint-rhino.js");
- exec("chmod +x dist/jshint-rhino.js");
- cli.ok("Rhino");
-
- cat("./src/platforms/wsh.js").to("./dist/jshint-wsh.js");
- cli.ok("Windows Script Host");
-
- cat("./src/platforms/jsc.sh").to("./dist/jshint-jsc.sh");
- cat("./src/platforms/jsc.js").to("./dist/jshint-jsc.js");
- exec("chmod +x dist/jshint-jsc.sh");
- cli.ok("JavaScript Core");
-};
View
39 assets/jshint-master/package.json
@@ -1,39 +0,0 @@
-{
- "name": "jshint",
- "version": "1.0.0",
- "homepage": "http://jshint.com/",
- "description": "Static analysis tool for JavaScript",
-
- "author": {
- "name": "Anton Kovalyov",
- "email": "anton@kovalyov.net",
- "url": "http://anton.kovalyov.net/"
- },
-
- "scripts": {
- "test": "node ./make.js test",
- "lint": "node ./make.js lint"
- },
-
- "main": "./src/stable/jshint.js",
-
- "dependencies": {
- "esprima": "https://github.com/ariya/esprima/tarball/master",
- "shelljs": "*",
- "underscore": "*",
- "peakle": "*",
- "cli": "0.4.3",
- "minimatch": "0.0.x"
- },
-
- "devDependencies": {
- "jshint": "*",
- "shelljs": "*",
- "browserify": "*",
- "coveraje": "*",
- "nodeunit": "*",
- "sinon": "*"
- },
-
- "preferGlobal": true
-}
View
4,372 assets/jshint-master/res/jshint.ai
0 additions, 4,372 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
380 assets/jshint-master/src/cli/cli.js
@@ -1,380 +0,0 @@
-"use strict";
-
-var cli = require("cli");
-var path = require("path");
-var shjs = require("shelljs");
-var minimatch = require("minimatch");
-var JSHINT = require("../stable/jshint.js").JSHINT;
-var defReporter = require("../reporters/default").reporter;
-
-var OPTIONS = {
- "config": ["config", "Custom configuration file", "string", false ],
- "reporter": ["reporter", "Custom reporter", "string", undefined ],
- "show-non-errors": ["show-non-errors", "Show additional data generated by jshint"],
- "extra-ext": ["extra-ext",
- "Comma-separated list of file extensions to use (default is .js)", "string", ""],
-
- // Deprecated options.
- "jslint-reporter": [
- "jslint-reporter",
- deprecated("Use a jslint compatible reporter", "--reporter=jslint")
- ],
-
- "checkstyle-reporter": [
- "checkstyle-reporter",
- deprecated("Use a CheckStyle compatible XML reporter", "--reporter=checkstyle")
- ]
-};
-
-/**
- * Returns the same text but with a deprecation notice.
- * Useful for options descriptions.
- *
- * @param {string} text
- * @param {string} alt (optional) Alternative command to include in the
- * deprecation notice.
- *
- * @returns {string}
- */
-function deprecated(text, alt) {
- if (!alt) {
- return text + " (DEPRECATED)";
- }
-
- return text + " (DEPRECATED, use " + alt + " instead)";
-}
-
-/**
- * Removes JavaScript comments from a string by replacing
- * everything between block comments and everything after
- * single-line comments in a non-greedy way.
- *
- * English version of the regex:
- * match '/*'
- * then match zero or more instances of any character (incl. \n)
- * except for instances of '* /' (without a space, obv.)
- * then match '* /' (again, without a space)
- *
- * @param {string} str a string with potential JavaScript comments.
- * @returns {string} a string without JavaScript comments.
- */
-function removeComments(str) {
- str = str || "";
-
- str = str.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\//g, "");
- str = str.replace(/\/\/[^\n\r]*/g, ""); // Everything after '//'
-
- return str;
-}
-
-/**
- * Loads and parses a configuration file.
- *
- * @param {string} fp a path to the config file
- * @returns {object} config object
- */
-function loadConfig(fp) {
- if (fp && shjs.test("-e", fp)) {
- return JSON.parse(removeComments(shjs.cat(fp)));
- }
-
- return {};
-}
-
-/**
- * Tries to find a configuration file in either project directory
- * or in the home directory. Configuration files are named
- * '.jshintrc'.
- *
- * @returns {string} a path to the config file
- */
-function findConfig() {
- var name = ".jshintrc";
- var proj = findFile(name);
- var home = path.normalize(path.join(process.env.HOME, name));
-
- if (proj) {
- return proj;
- }
-
- if (shjs.test("-e", home)) {
- return home;
- }
-
- return null;
-}
-
-/**
- * Tries to import a reporter file and returns its reference.
- *
- * @param {string} fp a path to the reporter file
- * @returns {object} imported module for the reporter or 'null'
- * if a module cannot be imported.
- */
-function loadReporter(fp) {
- try {
- return require(fp).reporter;
- } catch (err) {
- return null;
- }
-}
-
-/**
- * Searches for a file with a specified name starting with
- * 'dir' and going all the way up either until it finds the file
- * or hits the root.
- *
- * @param {string} name filename to search for (e.g. .jshintrc)
- * @param {string} dir directory to start search from (default:
- * current working directory)
- *
- * @returns {string} normalized filename
- */
-function findFile(name, dir) {
- dir = dir || process.cwd();
-
- var filename = path.normalize(path.join(dir, name));
- var parent = path.resolve(dir, "../../");
-
- if (shjs.test("-e", filename)) {
- return filename;
- }
-
- if (dir === parent) {
- return null;
- }
-
- return findFile(name, parent);
-}
-
-/**
- * Loads a list of files that have to be skipped. JSHint assumes that
- * the list is located in a file called '.jshintignore'.
- *
- * @return {array} a list of files to ignore.
- */
-function loadIgnores() {
- var file = findFile(".jshintignore");
-
- if (!file) {
- return;
- }
-
- return shjs.cat(file).split("\n")
- .filter(function (line) {
- return !!line.trim();
- })
- .map(function (line) {
- return path.resolve(path.dirname(file), line.trim());
- });
-}
-
-/**
- * Checks whether we should ignore a file or not.
- *
- * @param {string} fp a path to a file
- * @param {array} patterns a list of patterns for files to ignore
- *
- * @return {boolean} 'true' if file should be ignored, 'false' otherwise.
- */
-function isIgnored(fp, patterns) {
- return patterns.some(function (ip) {
- if (minimatch(fp, ip, { nocase: true })) {
- return true;
- }
-
- if (path.resolve(fp) === ip) {
- return true;
- }
-
- if (shjs.test("-d", fp) && ip.match(/^[^\/]*\/?$/) &&
- fp.match(new RegExp("^" + ip + ".*"))) {
- return true;
- }
- });
-}
-
-/**
- * Recursively gather all files that need to be linted,
- * excluding those that user asked to ignore.
- *
- * @param {string} fp a path to a file or directory to lint
- * @param {array} files a pointer to an array that stores a list of files
- * @param {array} ignores a list of patterns for files to ignore
- * @param {array} ext a list of non-dot-js extensions to lint
- */
-function collect(fp, files, ignores, ext) {
- if (ignores && isIgnored(fp, ignores)) {
- return;
- }
-
- if (shjs.test("-d", fp)) {
- shjs.ls(fp).forEach(function (item) {
- collect(path.join(fp, item), files, ignores, ext);
- });
-
- return;
- }
-
- if (fp.match(ext)) {
- files.push(fp);
- }
-}
-
-/**
- * Runs JSHint against provided file and saves the result
- *
- * @param {string} file a path to a file that needs to be linted
- * @param {object} results a pointer to an object with results
- * @param {object} config an object with JSHint configuration
- * @param {object} data a pointer to an object with extra data
- */
-function lint(file, results, config, data) {
- var buffer;
- var globals;
- var lintData;
-
- config = config || {};
- config = JSON.parse(JSON.stringify(config));
-
- try {
- buffer = shjs.cat(file);
- } catch (err) {
- cli.error("Can't open " + file);
- process.exit(1);
- }
-
- // Remove potential Unicode BOM.
- buffer = buffer.replace(/^\uFEFF/, "");
-
- if (config.globals) {
- globals = config.globals;
- delete config.globals;
- }
-
- if (!JSHINT(buffer, config, globals)) {
- JSHINT.errors.forEach(function (err) {
- if (err) {
- results.push({ file: file, error: err });
- }
- });
- }
-
- lintData = JSHINT.data();
-
- if (lintData) {
- lintData.file = file;
- data.push(lintData);
- }
-}
-
-var exports = {
- /**
- * Gathers all files that need to be linted, lints them, sends them to
- * a reporter and returns the overall result.
- *
- * @param {object} post-processed options from 'interpret':
- * args - CLI arguments
- * config - Configuration object
- * reporter - Reporter function
- * ignores - A list of files/dirs to ignore
- * extensions - A list of non-dot-js extensions to check
- *
- * @returns {bool} 'true' if all files passed and 'false' otherwise.
- */
- run: function (opts) {
- var files = [];
- var results = [];
- var data = [];
- var reg = new RegExp("\\.(js" +
- (opts.extensions === "" ? "" : "|" +
- opts.extensions.replace(/,/g, "|").replace(/[\. ]/g, "")) + ")$");
-
- opts.args.forEach(function (target) {
- collect(target, files, opts.ignores, reg);
- });
-
- files.forEach(function (file) {
- lint(file, results, opts.config, data);
- });
-
- (opts.reporter || defReporter)(results, data);
-
- return results.length === 0;
- },
-
- /**
- * Main entrance function. Parses arguments and calls 'run' when
- * its done. This function is called from bin/jshint file.
- *
- * @param {object} args, arguments in the process.argv format.
- */
- interpret: function (args) {
- cli.setArgv(args);
- cli.options = {};
-
- cli.enable("version", "glob", "help");
- cli.setApp(path.resolve(__dirname + "/../../package.json"));
-
- var options = cli.parse(OPTIONS);
- var config = loadConfig(options.config || findConfig());
-
- switch (true) {
- // JSLint reporter
- case options.reporter === "jslint":
- case options["jslint-reporter"]:
- options.reporter = "../reporters/jslint_xml.js";
- break;
-
- // CheckStyle (XML) reporter
- case options.reporter === "checkstyle":
- case options["checkstyle-reporter"]:
- options.reporter = "../reporters/checkstyle.js";
- break;
-
- // Reporter that displays additional JSHint data
- case options["show-non-errors"]:
- options.reporter = "../reporters/non_error.js";
- break;
-
- // Custom reporter
- case options.reporter !== undefined:
- options.reporter = path.resolve(process.cwd(), options.reporter);
- }
-
- var reporter;
- if (options.reporter) {
- reporter = loadReporter(options.reporter);
-
- if (reporter === null) {
- cli.error("Can't load reporter file: " + options.reporter);
- process.exit(1);
- }
- }
-
- var passed = exports.run({
- args: cli.args,
- config: config,
- reporter: reporter,
- ignores: loadIgnores(),
- extensions: options["extra-ext"]
- });
-
- // Avoid stdout cutoff in Node 0.4.x, also supports 0.5.x.
- // See https://github.com/joyent/node/issues/1669
-
- function exit() { process.exit(passed ? 0 : 2); }
-
- try {
- if (!process.stdout.flush()) {
- process.stdout.once("drain", exit);
- } else {
- exit();
- }
- } catch (err) {
- exit();
- }
- }
-};
-
-module.exports = exports;
View
43 assets/jshint-master/src/next/constants.js
@@ -1,43 +0,0 @@
-"use strict";
-
-var _ = require("underscore");
-
-// Errors and warnings
-
-var errors = {
- E001: "Trailing comma causes errors in some versions of IE.",
- E002: "'with' statement is prohibited in strict mode.",
- E003: "'return' can be used only within functions.",
- E004: "'__iterator__' property is only available in JavaScript 1.7.",
- E005: "'__proto___' property is deprecated.",
- E006: "Missing semicolon.",
- E007: "Unexpected debugger statement.",
- E008: "'arguments.callee' is prohibited in strict mode.",
- E009: "Undefined variable in strict mode."
-};
-
-var warnings = {
- W001: "Bitwise operator. (mistyped logical operator?)",
- W002: "Unsafe comparison.",
- W003: "Redefined variable.",
- W004: "Undefined variable.",
- W005: "Avoid arguments.caller.",
- W006: "Avoid arguments.callee.",
- W007: "Object arguments outside of a function body.",
- W008: "Assignment instead of a conditionial expression. (typo?)",
- W009: "Insecure use of {sym} in a regular expression.",
- W010: "Empty regular expression class.",
- W011: "Unescaped {sym} in a regular expression.",
- W012: "Don't extend native objects."
-};
-
-exports.errors = {};
-exports.warnings = {};
-
-_.each(errors, function (desc, code) {
- exports.errors[code] = { code: code, desc: desc };
-});
-
-_.each(warnings, function (desc, code) {
- exports.warnings[code] = { code: code, desc: desc };
-});
View
193 assets/jshint-master/src/next/jshint.js
@@ -1,193 +0,0 @@
-"use strict";
-
-var _ = require("underscore");
-var parser = require("esprima");
-var events = require("events");
-var utils = require("./utils.js");
-var reason = require("./reason.js");
-var regexp = require("./regexp.js");
-var vars = require("../shared/vars.js");
-
-var MAXERR = 50;
-
-// Converts errors spitted out by Esprima into JSHint errors.
-
-function esprima(linter) {
- linter.on("lint:end", function () {
- var mapping = {
- "Illegal return statement": "E003",
- "Strict mode code may not include a with statement": "E002"
- };
-
- _.each(linter.tree.errors, function (err) {
- var msg = err.message.split(": ")[1];
- linter.report.addError(mapping[msg], err.lineNumber);
- });
- });
-}
-
-function Linter(code) {
- this.code = code;
- this.config = {};
- this.tree = {};
- this.scopes = new utils.ScopeStack();
- this.report = new utils.Report(code);
- this.tokens = null;
- this.modules = [];
- this.emitter = new events.EventEmitter();
-
- this.addModule(esprima);
- this.addModule(reason.register);
- this.addModule(regexp.register);
-
- // Pre-populate globals array with reserved variables,
- // standard ECMAScript globals and user-supplied globals.
-
- this.setGlobals(vars.reservedVars);
- this.setGlobals(vars.ecmaIdentifiers);
-}
-
-Linter.prototype = {
- on: function (names, listener) {
- var self = this;
-
- names.split(" ").forEach(function (name) {
- self.emitter.on(name, listener);
- });
- },
-
- trigger: function () {
- this.emitter.emit.apply(this.emitter, Array.prototype.slice.call(arguments));
- },
-
- addModule: function (func) {
- this.modules.push(func);
- },
-
- setGlobals: function (globals) {
- var scopes = this.scopes;
-
- _.each(globals, function (writeable, name) {
- scopes.addGlobalVariable({ name: name, writeable: writeable });
- });
- },
-
- parse: function () {
- var self = this;
-
- self.tree = parser.parse(self.code, {
- range: true, // Include range-based location data.
- loc: true, // Include column-based location data.
- comment: true, // Include a list of all found code comments.
- tokens: true, // Include a list of all found tokens.
- tolerant: true // Don't break on non-fatal errors.
- });
-
- self.tokens = new utils.Tokens(self.tree.tokens);
-
- _.each(self.modules, function (func) {
- func(self);
- });
-
- function _parseComments(from, to) {
- var slice = self.tree.comments.filter(function (comment) {
- return comment.range[0] >= from && comment.range[1] <= to;
- });
-
- slice.forEach(function (comment) {
- comment = utils.parseComment(comment.value);
-
- switch (comment.type) {
- case "set":
- comment.value.forEach(function (name) {
- self.scopes.addSwitch(name);
- });
- break;
- case "ignore":
- comment.value.forEach(function (code) {
- self.scopes.addIgnore(code);
- });
- break;
- }
- });
- }
-
- // Walk the tree using recursive* depth-first search and trigger
- // appropriate events when needed.
- //
- // * - and probably horribly inefficient.
-
- function _parse(tree) {
- if (tree.type)
- self.trigger(tree.type, tree);
-
- if (self.report.length > MAXERR)
- return;
-
- _.each(tree, function (val) {
- if (val === null)
- return;
-
- if (!_.isObject(val) && !_.isArray(val))
- return;
-
- switch (val.type) {
- case "ExpressionStatement":
- if (val.expression.type === "Literal" && val.expression.value === "use strict")
- self.scopes.current.strict = true;
- _parse(val);
- break;
- case "FunctionDeclaration":
- self.scopes.addVariable({ name: val.id.name });
- self.scopes.push(val.id.name);
-
- // If this function is not empty, parse its leading comments (if any).
- if (val.body.type === "BlockStatement" && val.body.body.length > 0)
- _parseComments(val.range[0], val.body.body[0].range[0]);
-
- _parse(val);
- self.scopes.pop();
- break;
- case "FunctionExpression":
- if (val.id && val.id.type === "Identifier")
- self.scopes.addVariable({ name: val.id.name });
- self.scopes.push("(anon)");
-
- // If this function is not empty, parse its leading comments (if any).
- if (val.body.type === "BlockStatement" && val.body.body.length > 0)
- _parseComments(val.range[0], val.body.body[0].range[0]);
-
- _parse(val);
- self.scopes.pop();
- break;
- case "WithStatement":
- self.scopes.runtimeOnly = true;
- _parse(val);
- self.scopes.runtimeOnly = false;
- break;
- default:
- _parse(val);
- }
- });
- }
-
- self.trigger("lint:start");
- _parseComments(0, self.tree.range[0]);
- _parse(self.tree.body);
- self.trigger("lint:end");
- }
-};
-
-function JSHINT(args) {
- var linter = new Linter(args.code);
- linter.setGlobals(args.predefined || {});
- linter.parse();
-
- return {
- tree: linter.tree,
- report: linter.report
- };
-}
-
-exports.Linter = Linter;
-exports.lint = JSHINT;
View
302 assets/jshint-master/src/next/reason.js
@@ -1,302 +0,0 @@
-"use strict";
-
-var _ = require("underscore");
-var vars = require("../shared/vars.js");
-
-exports.register = function (linter) {
- var report = linter.report;
- var tokens = linter.tokens;
- var scopes = linter.scopes;
-
- // Check for trailing commas in arrays and objects.
-
- linter.on("ArrayExpression ObjectExpression", function (expr) {
- var token = tokens.move(tokens.find(expr.range[1] - 3));
-
- if (token.isPunctuator(","))
- report.addError("E001", token.range);
- });
-
- // Check for properties named __iterator__. This is a special property
- // available only in browsers with JavaScript 1.7 implementation.
-
- linter.on("MemberExpression", function (expr) {
- var prop = expr.property;
-
- if (prop.type === "Identifier" && prop.name === "__iterator__")
- report.addError("E004", prop.range);
- });
-
- // Check for properties named __proto__. This special property was
- // deprecated long time ago.
-
- linter.on("MemberExpression", function (expr) {
- var prop = expr.property;
-
- if (prop.type === "Identifier" && prop.name === "__proto__")
- report.addError("E005", prop.range);
- });
-
- // Check for missing semicolons but only when they have a potential
- // of breaking things due to automatic semicolon insertion.
-
- linter.on("ExpressionStatement", function (expr) {
- var type = expr.expression.type;
-
- if (type !== "CallExpression" && type !== "MemberExpression")
- return;
-
- var slice = tokens.getRange(expr.range);
- var token = slice.move(1);
- var prev, curLine, prevLine;
-
- while (token !== null) {
- if (token.isPunctuator(["(", "["])) {
- prev = slice.peak(-1);
- curLine = report.lineFromRange(token.range);
- prevLine = report.lineFromRange(prev.range);
-
- if (curLine !== prevLine && !prev.isPunctuator(";")) {
- report.addError("E006", prev.range);
- }
- }
-
- token = slice.next();
- }
- });
-
- linter.on("BinaryExpression", function (expr) {
- var op = expr.operator;
-
- if (op !== "+" && op !== "*" && op !== "/")
- return;
-
- if (expr.left.loc.end.line < expr.right.loc.start.line)
- report.addError("E006", expr.range);
- });
-
- // Catch cases where you put a new line after a `return` statement
- // by mistake.
-
- linter.on("ReturnStatement", function (expr) {
- var cur = tokens.move(tokens.find(expr.range[0]));
- var next = tokens.peak();
-
- if (report.lineFromRange(next.range) === report.lineFromRange(cur.range))
- return;
-
- if (next && next.isPunctuator(";"))
- return;
-
- if (next && next.isKeyword("var"))
- return;
-
- if (next && next.isKeyword("case"))
- return;
-
- report.addError("E006", cur.range);
- });
-
- // Check for debugger statements. You really don't want them in your
- // production code.
-
- linter.on("DebuggerStatement", function (expr) {
- report.addError("E007", expr.range);
- });
-
- // Disallow bitwise operators: they are slow in JavaScript and
- // more often than not are simply typoed logical operators.
-
- linter.on("BinaryExpression UnaryExpression", function (expr) {
- var ops = {
- "|" : true,
- "&" : true,
- "^" : true,
- "~" : true,
- "<<" : true,
- ">>" : true,
- ">>>": true
- };
-
- if (expr.operator && ops[expr.operator] === true)
- report.addWarning("W001", expr.range);
- });
-
- // Complain about comparisons that can blow up because of type
- // coercion.
-
- linter.on("BinaryExpression", function (expr) {
- function isUnsafe(el) {
- if (el.type === "Identifier" && el.name === "undefined")
- return true;
-
- if (el.type !== "Literal")
- return false;
-
- return _.any([
- el.value === 0,
- el.value === null,
- el.value === "",
- el.value === false,
- el.value === true
- ]);
- }
-
- if (expr.operator !== "==" && expr.operator !== "!=")
- return;
-
- if (isUnsafe(expr.left))
- report.addWarning("W002", expr.left.range);
-
- if (isUnsafe(expr.right))
- report.addWarning("W002", expr.right.range);
- });
-
- // Complain about variables defined twice.
-
- function isRedefined(name, range) {
- if (scopes.isDefined(name))
- report.addWarning("W003", range);
- }
-
- linter.on("VariableDeclarator", function (expr) {
- isRedefined(expr.id.name, expr.id.range);
- scopes.addVariable({ name: expr.id.name });
- });
-
- linter.on("FunctionExpression FunctionDeclaration", function (expr) {
- _.each(expr.params, function (param) {
- isRedefined(param.name, param.range);
- scopes.addVariable({ name: param.name });
- });
- });
-
- // Check if identifier is a free variable and record its
- // use. Later in the code we'll use that to spot undefined
- // variables.
-
- linter.on("Identifier", function (ident) {
- var index = tokens.find(ident.range[0]);
- var token, prev, next;
-
- if (index > 0) {
- token = tokens.move(index);
- prev = tokens.peak(-1);
- next = tokens.peak(1) || { isPunctuator: function () { return false; } };
-
- // This identifier is a property key, not a free variable.
-
- if (next.isPunctuator(":") && !prev.isPunctuator("?"))
- return;
-
- // This identifier is a property itself, not a free variable.
-
- if (prev.isPunctuator("."))
- return;
-
- // Operators typeof and delete do not raise runtime errors
- // even if the base object of a reference is null, so we don't
- // need to display warnings in these cases.
-
- if (prev.isKeyword("typeof") || prev.isKeyword("delete")) {
-
- // Unless you're trying to subscript a null references. That
- // will throw a runtime error.
-
- if (!next.isPunctuator(".") && !next.isPunctuator("["))
- return;
- }
- }
-
- scopes.addUse(ident.name, ident.range);
- });
-
- // Look for arguments.callee and arguments.caller usage and warn about
- // them. In strict mode, instead of warning about arguments.callee, return
- // an error. This also supports [] notation.
-
- linter.on("Identifier Literal", function (expr) {
- if (scopes.current.name === "(global)") {
- if (expr.type === "Identifier" && expr.name === "arguments")
- report.addWarning("W007", expr.range);
-
- return;
- }
-
- var name = expr.type === "Identifier" ? expr.name : expr.value;
- var punc = expr.type === "Identifier" ? "." : "[";
- var range = expr.range;
-
- if (name !== "callee" && name !== "caller")
- return;
-
- var index = tokens.find(range[0]);
-
- if (index < 1)
- return;
-
- tokens.move(index);
-
- if (tokens.peak(-1).isPunctuator(punc) && tokens.peak(-2).isIdentifier("arguments")) {
- switch (name) {
- case "caller":
- report.addWarning("W005", range);
- break;
- case "callee":
- if (scopes.isStrictMode())
- report.addError("E008", range);
- else
- report.addWarning("W006", range);
- }
- }
- });
-
- // Warn when assignments are used instead of conditionals.
- linter.on("ForStatement IfStatement WhileStatement DoWhileStatement", function (expr) {
- if (expr.test && expr.test.type === "AssignmentExpression")
- report.addWarning("W008", expr.range);
- });
-
- // Warn when extending prototypes of built-in objects
- linter.on("AssignmentExpression", function (expr) {
- var left = expr.left;
- var obj = left.object;
-
- function isNativeProto(expr) {
- if (!expr.property || !expr.object)
- return false;
-
- return expr.object.name in
- vars.ecmaIdentifiers && expr.property.name === "prototype";
- }
-
- if (left.type !== "MemberExpression")
- return;
-
- // Check for Object.prototype.prop = ""
- // Check for Native.prototype = {}
- if (isNativeProto(left) || isNativeProto(obj))
- report.addWarning("W012", expr.range);
- });
-
- // Go over all stacks and find all variables that were used but
- // never defined.
- //
- // This is not very efficient--for starters we can mark visited
- // scopes and not visit them again.
-
- linter.on("lint:end", function () {
- _.each(scopes.stack, function (env) {
- _.each(env.uses, function (ranges, name) {
- if (scopes.isDefined(name, env))
- return;
-
- _.each(ranges, function (range) {
- if (scopes.isStrictMode(env))
- return void linter.report.addError("E009", range);
- linter.report.addWarning("W004", range);
- });
- });
- });
- });
-};
View
125 assets/jshint-master/src/next/regexp.js
@@ -1,125 +0,0 @@
-"use strict";
-
-var events = require("events");
-
-function Tokens(exp) {
- this.exp = exp;
- this.pos = 0;
- this.emitter = new events.EventEmitter();
-}
-
-Tokens.prototype = {
- get current() {
- return this.peak(0);
- },
-
- at: function (index) {
- var chr = this.exp.charAt(index);
- return chr === "" ? null : chr;
- },
-
- peak: function (offset) {
- var pos = this.pos + (offset === undefined ? 1 : offset);
- var chr = this.exp.charAt(pos);
-
- return chr === "" ? null : chr;
- },
-
- next: function () {
- if (this.current !== null)
- this.pos += 1;
-
- return this.current;
- }
-};
-
-exports.register = function (linter) {
- var report = linter.report;
-
- linter.on("Literal", function (literal) {
- var value = (literal.value || "").toString();
-
- value = value.match(/^\/(.+)\/[igm]?$/);
- if (value === null)
- return;
-
- var tokens = new Tokens(value[1]);
- var isLiteral = false;
- var inRange = false;
-
- tokens.emitter.on("[", function () {
- tokens.next();
-
- if (tokens.current === "^") {
- report.addWarning("W009", literal.range, { sym: tokens.current });
- tokens.next();
- }
-
- if (tokens.current === "]") {
- report.addWarning("W010", literal.range);
- }
-
- do {
- switch (tokens.current) {
- case "[":
- case "^":
- report.addWarning("W011", literal.range, { sym: tokens.current });
- if (inRange) inRange = false;
- else isLiteral = true;
- break;
- case "-":
- if (isLiteral && !inRange) {
- isLiteral = false;
- inRange = true;
- } else if (inRange) {
- inRange = false;
- } else if (tokens.peak() === "]") {
- inRange = true;
- } else {
- report.addWarning("W011", literal.range, { sym: "-" });
- isLiteral = true;
- }
- break;
- case "]":
- if (inRange)
- report.addWarning("W011", literal.range, { sym: "-" });
- return;
- case "\\":
- tokens.next();
-
- // \w, \s and \d are never part of a character range.
- if (/[wsd]/i.test(tokens.current)) {
- if (inRange) {
- report.addWarning("W011", literal.range, { sym: "-" });
- inRange = false;
- }
- isLiteral = false;
- } else if (inRange) {
- inRange = false;
- } else {
- isLiteral = true;
- }
- break;
- case "/":
- report.addWarning("W011", literal.range, { sym: tokens.current });
- /* falls through */
- default:
- if (inRange) inRange = false;
- else isLiteral = true;
- }
-
- } while (tokens.next());
- });
-
- tokens.emitter.on(".", function () {
- if (tokens.peak(-1) !== "\\") {
- report.addWarning("W009", literal.range, { sym: tokens.current });
- }
- });
-
- while (tokens.current !== null) {
- tokens.emitter.emit(tokens.current);
- tokens.next();
- }
- });
-};
View
359 assets/jshint-master/src/next/utils.js
@@ -1,359 +0,0 @@
-"use strict";
-
-var _ = require("underscore");
-var util = require("util");
-var Peakle = require("peakle").Peakle;
-var warnings = require("./constants.js").warnings;
-var errors = require("./constants.js").errors;
-
-function safe(name) {
- if (name === "__proto__")
- return "(__proto__)";
-
- var special = Object.getOwnPropertyNames(Object.prototype);
- for (var i = 0; i < special.length; i++) {
- if (name === special[i])
- return "(" + name + ")";
- }
-
- return name;
-}
-
-function interpolate(string, data) {
- return string.replace(/\{([^{}]*)\}/g, function (match, key) {
- var repl = data[key];
-
- if (typeof repl === 'string' || typeof repl === 'number')
- return repl;
-
- return match;
- });
-}
-
-// ScopeStack stores all the environments we encounter while
-// traversing syntax trees. It also keeps track of all
-// variables defined and/or used in these environments.
-//
-// We use linked-list implementation of a stack. The first
-// element, representing global environment, doesn't have
-// a reference to its parent.
-//
-// runtimeOnly means that we can't tell if identifier
-// is a variable or a property by analysing the source. It
-// is true only within the `with` statement.
-
-function ScopeStack() {
- this.stack = [];
- this.curid = null;
-
- this.runtimeOnly = false;
- this.push("(global)");
-}
-
-ScopeStack.prototype = {
- get current() {
- if (this.curid === null)
- return null;
-
- return this.stack[this.curid];
- },
-
- get parent() {
- if (this.curid === null)
- return null;
-
- var parid = this.current.parid;
-
- if (parid === null)
- return null;
-
- return this.stack[parid];
- },
-
- // Push a new environment into the stack.
-
- push: function (name) {
- var curid = this.curid;
- this.curid = this.stack.length;
-
- this.stack.push({
- parid: curid,
- name: name,
- strict: false,
- switches: {},
- ignores: {},
- vars: {},
- uses: {}
- });
- },
-
- // Exit from the current environment. Even though
- // this method is called `pop` it doesn't actually
- // delete the environment--it simply jumps into the
- // parent one.
-
- pop: function () {
- this.curid = this.current.parid;
- },
-
- any: function (cond, env) {
- env = env || this.current;
-
- while (env) {
- if (cond.call(env))
- return true;
-
- env = this.stack[env.parid];
- }
-
- return false;
- },
-
- isDefined: function (name, env) {
- return this.any(function () { return _.has(this.vars, safe(name)); }, env);
- },
-
- isStrictMode: function (env) {
- return this.any(function () { return this.strict; }, env);
- },
-
- isSwitchEnabled: function (name, env) {
- return this.any(function () { return this.switches[name]; }, env);
- },
-
- isMessageIgnored: function (code, env) {
- return this.any(function () { return this.ignores[code]; }, env);
- },
-
- addUse: function (name, range) {
- name = safe(name);
-
- if (this.runtimeOnly)
- return;
-
- if (this.current.uses[name] === undefined)
- this.current.uses[name] = [range];
- else
- this.current.uses[name].push(range);
- },
-
- addVariable: function (opts) {
- this.current.vars[safe(opts.name)] = {
- writeable: opts.writeable || false
- };
- },
-
- addGlobalVariable: function (opts) {
- this.stack[0].vars[safe(opts.name)] = {
- writeable: opts.writeable || false
- };
- },
-
- addSwitch: function (name) {
- this.current.switches[name] = true;
- },
-
- addIgnore: function (name) {
- this.current.ignores[name] = true;
- }
-};
-
-function Report(source) {
- this.ERROR = 1;
- this.WARNING = 2;
-
- this.length = 0;
- this.messages = {};
- this.ranges = [];
- this.source = source;
-}
-
-Report.prototype = {
- lineFromRange: function (range) {
- var lines = this.source.slice(0, range[0]).split("\n");
- return lines.length || -1;
- },
-
- getMessages: function (cond) {
- var ret = [];
- cond = cond || function () { return true; };
-
- _.each(this.messages, function (pool) {
- _.each(pool, function (msg) {
- if (cond(msg))
- ret.push(msg);
- });
- });
-
- return ret;
- },
-
- get errors() {
- var type = this.ERROR;
-
- return this.getMessages(function (msg) {
- return msg.type === type;
- });
- },
-
- get warnings() {
- var type = this.WARNING;
-
- return this.getMessages(function (msg) {
- return msg.type === type;
- });
- },
-
- addMessage: function (obj) {
- var line = obj.line;
- this.messages[line] = _.union(this.messages[line] || [], [obj]);
- this.length += 1;
- },
-
- addWarning: function (label, loc, data) {
- var line = _.isArray(loc) ? this.lineFromRange(loc) : loc;
- var warn = warnings[label];
-
- if (!warn)
- throw new Error("Warning " + label + "is not defined.");
-
- warn.desc = interpolate(warn.desc, data);
- this.addMessage({
- type: this.WARNING,
- line: line,
- data: warn
- });
- },
-
- addError: function (label, loc, data) {
- var line = _.isArray(loc) ? this.lineFromRange(loc) : loc;
- var err = errors[label];
-
- if (!err)
- throw new Error("Error " + label + " is not defined.");
-
- err.desc = interpolate(err.desc, data);
- this.addMessage({
- type: this.ERROR,
- line: line,
- data: err
- });
- }
-};
-
-function Token(obj) {
- _.extend(this, obj);
-}
-
-_.each(["Punctuator", "Keyword", "Identifier"], function (name) {
- Token.prototype["is" + name] = function (values) {
- if (!Array.isArray(values))
- values = [ values ];
-
- return values.some(function (value) {
- return this.type === name && this.value === value;
- }, this);
- };
-});
-
-function Tokens(list) {
- var self = this;
- Peakle.call(self, list);
-
- // A hash-table to make tokens lookup by their starting
- // position cheaper (see Tokens.find for more info).
- self.byStart = {};
-
- self.list = _.map(list || [], function (obj, i) {
- var token = new Token(obj);
- self.byStart[token.range[0]] = i;
- return token;
- });
-}
-
-util.inherits(Tokens, Peakle);
-
-Tokens.prototype.find = function (rangeIndex) {
- // First try to lookup our token in byStart in
- // case this index is the starting point for the token.
-
- var index = this.byStart[rangeIndex];
-
- if (index)
- return index;
-
- // If we could find it, step back, token by token
- // until we find one that starts before the one we're
- // looking for,
-
- var cur = rangeIndex - 1;
-
- do {
- index = this.byStart[cur];
- cur = cur - 1;
- } while (index === undefined && cur > 0);
-
- // If we're in the beginning and still nothing--return.
-
- if (index === undefined)
- return -1;
-
- // Otherwise go in a slow O(N) loop looking for our token.
-
- for (var i = index; i < this.length; i++) {
- if (this.list[i].range[0] >= rangeIndex)
- return i;
- }
-
- return -1;
-};
-
-Tokens.prototype.getRange = function (range) {
- var slice = [];
- var length = this.list.length;
- var token;
-
- for (var i = this.byStart[range[0]] || 0; i < length; i++) {
- token = this.list[i];
-
- if (token.range[0] < range[0])
- continue;
-
- if (token.range[1] <= range[1])
- slice.push(token);
- else
- break;
- }
-
- return new Tokens(slice);
-};
-
-var commentsTypes = { "set": true, "ignore": true };
-
-function parseComment(text) {
- var parts = text.trim().split(" ");
- var defval = { type: "text", value: text };
- var head, body;
-
- if (parts.length === 0)
- return defval;
-
- head = parts[0].split(":");
- if (head[0] !== "jshint" || commentsTypes[head[1]] !== true)
- return defval;
-
- body = parts.slice(1).join(" ").split(",").map(function (s) {
- return s.trim();
- });
-
- return {
- type: head[1],
- value: body
- };
-}
-
-exports.Report = Report;
-exports.Token = Token;
-exports.Tokens = Tokens;
-exports.ScopeStack = ScopeStack;
-exports.parseComment = parseComment;
View
59 assets/jshint-master/src/platforms/jsc.js
@@ -1,59 +0,0 @@
-/*global load, print, quit, JSHINT */
-
-// usage:
-// jsc ${env_home}/jsc.js -- ${file} "$(cat ${file})" "option1:true,option2:false ${env_home}"
-var env_home = '';
-if (arguments.length > 3) {
- env_home = arguments[3].toString().replace(/\/dist/, '/src/stable/');
-}
-load(env_home + "jshint.js");
-
-if (typeof(JSHINT) === 'undefined') {
- print('jshint: Could not load jshint.js, tried "' + env_home + 'jshint.js".');
- quit();
-}
-
-(function (args) {
- "use strict";
- /*jshint evil:true */
-
- var name = args[0],
- input = args[1],
- opts = (function (arg) {
- var opts = {};
- var item;
-
- switch (arg) {
- case undefined:
- case '':
- return opts;
- default:
- arg = arg.split(',');
- for (var i = 0, ii = arg.length; i < ii; i++) {
- item = arg[i].split(':');
- opts[item[0].replace(/(^\s*)|(\s*$)/g, '')] = eval(item[1]);
- }
- return opts;
- }
- })(args[2]);
-
- if (!name) {
- print('jshint: No file name was provided.');
- quit();
- }
-
- if (!input) {
- print('jshint: ' + name + ' contents were not provided to jshint.');
- quit();
- }
-
- if (!JSHINT(input, opts)) {
- for (var i = 0, err; err = JSHINT.errors[i]; i++) {
- print(err.reason + ' (line: ' + err.line + ', character: ' + err.character + ')');
- print('> ' + (err.evidence || '').replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
- print('');
- }
- }
-
- quit();
-})(arguments);
View
29 assets/jshint-master/src/platforms/jsc.sh
@@ -1,29 +0,0 @@
-#!/bin/sh
-# usage (run from any directory) :
-# env/jsc.sh /path/to/script.js
-# or with jshint options:
-# env/jsc.sh /path/to/script.js "option1:true,option2:false,option3:25"
-
-alias jsc="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc"
-FILE="${1}"
-OPTS="${2}"
-
-FILE_CONTENT=$(cat "${FILE}")
-
-if [ -L $BASH_SOURCE ]; then
- ENV_HOME="$( cd "$( dirname "$(readlink "$BASH_SOURCE")" )" && pwd )"
-else
- ENV_HOME="$( cd "$( dirname "$BASH_SOURCE" )" && pwd )"
-fi
-
-LINT_RESULT=$(jsc "${ENV_HOME}"/jshint-jsc.js -- "${FILE}" "${FILE_CONTENT}" "${OPTS}" "${ENV_HOME}")
-ERRORS=$(echo ${LINT_RESULT} | egrep [^\s] -c)
-
-if [[ ${ERRORS} -ne 0 ]]; then
- echo "[jshint] Error(s) in ${FILE}:"
- printf "%s\n" "${LINT_RESULT}"
-else
- echo "[jshint] ${FILE} passed!"
-fi
-
-exit $((0 + ${ERRORS}))
View
86 assets/jshint-master/src/platforms/rhino.js
@@ -1,86 +0,0 @@
-/*jshint boss: true, rhino: true, unused: true, undef: true, white: true, quotmark: double */
-/*global JSHINT*/
-
-(function (args) {
- "use strict";
-
- var filenames = [];
- var optstr; // arg1=val1,arg2=val2,...
- var predef; // global1=true,global2,global3,...
- var opts = {};
- var retval = 0;
-
- args.forEach(function (arg) {
- if (arg.indexOf("=") > -1) {
- if (!optstr) {
- // First time it's the options.
- optstr = arg;
- } else {
- predef = arg;
- }
-
- return;
- }
-
- if (optstr) {
- predef = arg;
- return;
- }
-
- filenames.push(arg);
- });
-
- if (filenames.length === 0) {
- print("Usage: jshint.js file.js");
- quit(1);
- }
-
- if (optstr) {
- optstr.split(",").forEach(function (arg) {
- var o = arg.split("=");
- if (o[0] === "indent") {
- opts[o[0]] = parseInt(o[1], 10);
- } else {
- opts[o[0]] = (function (ov) {
- switch (ov) {
- case "true":
- return true;
- case "false":
- return false;
- default:
- return ov;
- }
- }(o[1]));
- }
- });
- }
-
- if (predef) {
- opts.predef = {};
-
- predef.split(",").forEach(function (arg) {
- var global = arg.split("=");
- opts.predef[global[0]] = global[1] === "true" ? true : false;
- });
- }
-
- filenames.forEach(function (name) {
- var input = readFile(name);
-
- if (!input) {
- print("jshint: Couldn't open file " + name);
- quit(1);
- }
-
- if (!JSHINT(input, opts)) {
- for (var i = 0, err; err = JSHINT.errors[i]; i += 1) {
- print(err.reason + " (" + name + ":" + err.line + ":" + err.character + ")");
- print("> " + (err.evidence || "").replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
- print("");
- }
- retval = 1;
- }
- });
-
- quit(retval);
-}(arguments));
View
258 assets/jshint-master/src/platforms/wsh.js