Permalink
Browse files

Adding JSHint to repo

  • Loading branch information...
arthurakay committed Dec 7, 2012
1 parent d89fd40 commit fc2981effab8a54c18950abf87fb9907f8535e32
Showing with 40,972 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +8 −0 assets/jshint-master/.gitignore
  3. +3 −0 assets/jshint-master/.travis.yml
  4. +105 −0 assets/jshint-master/CONTRIBUTING.md
  5. +20 −0 assets/jshint-master/LICENSE
  6. +267 −0 assets/jshint-master/README.md
  7. +3 −0 assets/jshint-master/bin/jshint
  8. +2 −0 assets/jshint-master/examples/.jshintignore
  9. +5 −0 assets/jshint-master/examples/.jshintrc
  10. +21 −0 assets/jshint-master/examples/reporter.js
  11. +14 −0 assets/jshint-master/jshint.json
  12. +106 −0 assets/jshint-master/make.js
  13. +39 −0 assets/jshint-master/package.json
  14. +4,372 −0 assets/jshint-master/res/jshint.ai
  15. +380 −0 assets/jshint-master/src/cli/cli.js
  16. +43 −0 assets/jshint-master/src/next/constants.js
  17. +193 −0 assets/jshint-master/src/next/jshint.js
  18. +302 −0 assets/jshint-master/src/next/reason.js
  19. +125 −0 assets/jshint-master/src/next/regexp.js
  20. +359 −0 assets/jshint-master/src/next/utils.js
  21. +59 −0 assets/jshint-master/src/platforms/jsc.js
  22. +29 −0 assets/jshint-master/src/platforms/jsc.sh
  23. +86 −0 assets/jshint-master/src/platforms/rhino.js
  24. +258 −0 assets/jshint-master/src/platforms/wsh.js
  25. +107 −0 assets/jshint-master/src/reporters/checkstyle.js
  26. +19 −0 assets/jshint-master/src/reporters/default.js
  27. +56 −0 assets/jshint-master/src/reporters/jslint_xml.js
  28. +45 −0 assets/jshint-master/src/reporters/non_error.js
  29. +207 −0 assets/jshint-master/src/shared/messages.js
  30. +386 −0 assets/jshint-master/src/shared/vars.js
  31. +3,588 −0 assets/jshint-master/src/stable/jshint.js
  32. +1,365 −0 assets/jshint-master/src/stable/lex.js
  33. +34 −0 assets/jshint-master/src/stable/reg.js
  34. +22 −0 assets/jshint-master/src/stable/state.js
  35. +162 −0 assets/jshint-master/src/stable/style.js
  36. +350 −0 assets/jshint-master/tests/cli.js
  37. +13 −0 assets/jshint-master/tests/next/fixtures/parser/comments.js
  38. +9 −0 assets/jshint-master/tests/next/fixtures/parser/simple_file.js
  39. +398 −0 assets/jshint-master/tests/next/fixtures/parser/tokens.json
  40. +28 −0 assets/jshint-master/tests/next/fixtures/reason/arguments.js
  41. +46 −0 assets/jshint-master/tests/next/fixtures/reason/asi.js
  42. +21 −0 assets/jshint-master/tests/next/fixtures/reason/bitwise.js
  43. +51 −0 assets/jshint-master/tests/next/fixtures/reason/comparison.js
  44. +7 −0 assets/jshint-master/tests/next/fixtures/reason/debugger.js
  45. +5 −0 assets/jshint-master/tests/next/fixtures/reason/esprima.js
  46. +11 −0 assets/jshint-master/tests/next/fixtures/reason/expr_in_test.js
  47. +58 −0 assets/jshint-master/tests/next/fixtures/reason/fifty.js
  48. +26 −0 assets/jshint-master/tests/next/fixtures/reason/iterator.js
  49. +24 −0 assets/jshint-master/tests/next/fixtures/reason/native.js
  50. +38 −0 assets/jshint-master/tests/next/fixtures/reason/proto.js
  51. +19 −0 assets/jshint-master/tests/next/fixtures/reason/shadow.js
  52. +10 −0 assets/jshint-master/tests/next/fixtures/reason/trailing.js
  53. +42 −0 assets/jshint-master/tests/next/fixtures/reason/undef.js
  54. +10 −0 assets/jshint-master/tests/next/fixtures/regexp/dashes.js
  55. +9 −0 assets/jshint-master/tests/next/fixtures/utils/simple_file.js
  56. +121 −0 assets/jshint-master/tests/next/lib/helpers.js
  57. +84 −0 assets/jshint-master/tests/next/unit/parser.js
  58. +130 −0 assets/jshint-master/tests/next/unit/reason.js
  59. +39 −0 assets/jshint-master/tests/next/unit/regexp.js
  60. +128 −0 assets/jshint-master/tests/next/unit/utils.js
  61. +82 −0 assets/jshint-master/tests/stable/helpers/coveraje.js
  62. +7 −0 assets/jshint-master/tests/stable/helpers/fixture.js
  63. +148 −0 assets/jshint-master/tests/stable/helpers/testhelper.js
  64. +1,158 −0 assets/jshint-master/tests/stable/regression/libs/backbone.js
  65. +9,304 −0 assets/jshint-master/tests/stable/regression/libs/jquery-1.7.js
  66. +487 −0 assets/jshint-master/tests/stable/regression/libs/json2.js
  67. +4,454 −0 assets/jshint-master/tests/stable/regression/libs/lodash.js
  68. +6,082 −0 assets/jshint-master/tests/stable/regression/libs/prototype-17.js
  69. +8 −0 assets/jshint-master/tests/stable/regression/npm.js
  70. +203 −0 assets/jshint-master/tests/stable/regression/thirdparty.js
  71. +574 −0 assets/jshint-master/tests/stable/unit/core.js
  72. +638 −0 assets/jshint-master/tests/stable/unit/envs.js
  73. +28 −0 assets/jshint-master/tests/stable/unit/fixtures/asi.js
  74. +31 −0 assets/jshint-master/tests/stable/unit/fixtures/blocks.js
  75. +12 −0 assets/jshint-master/tests/stable/unit/fixtures/boss.js
  76. +18 −0 assets/jshint-master/tests/stable/unit/fixtures/browser.js
  77. +17 −0 assets/jshint-master/tests/stable/unit/fixtures/camelcase.js
  78. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/caseExpressions.js
  79. +40 −0 assets/jshint-master/tests/stable/unit/fixtures/comma.js
  80. +72 −0 assets/jshint-master/tests/stable/unit/fixtures/const.js
  81. +8 −0 assets/jshint-master/tests/stable/unit/fixtures/curly.js
  82. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/curly2.js
  83. +23 −0 assets/jshint-master/tests/stable/unit/fixtures/emptystmt.js
  84. +10 −0 assets/jshint-master/tests/stable/unit/fixtures/eqeqeq.js
  85. +15 −0 assets/jshint-master/tests/stable/unit/fixtures/es5.funcexpr.js
  86. +78 −0 assets/jshint-master/tests/stable/unit/fixtures/es5.js
  87. +7 −0 assets/jshint-master/tests/stable/unit/fixtures/es5Reserved.js
  88. +18 −0 assets/jshint-master/tests/stable/unit/fixtures/exported.js
  89. +15 −0 assets/jshint-master/tests/stable/unit/fixtures/forin.js
  90. +8 −0 assets/jshint-master/tests/stable/unit/fixtures/functionScopedOptions.js
  91. +21 −0 assets/jshint-master/tests/stable/unit/fixtures/gh-226.js
  92. +15 −0 assets/jshint-master/tests/stable/unit/fixtures/gh-334.js
  93. +23 −0 assets/jshint-master/tests/stable/unit/fixtures/gh247.js
  94. +15 −0 assets/jshint-master/tests/stable/unit/fixtures/gh431.js
  95. +4 −0 assets/jshint-master/tests/stable/unit/fixtures/gh56.js
  96. +7 −0 assets/jshint-master/tests/stable/unit/fixtures/gh618.js
  97. +20 −0 assets/jshint-master/tests/stable/unit/fixtures/gruntComment.js
  98. +4 −0 assets/jshint-master/tests/stable/unit/fixtures/ignored.js
  99. +31 −0 assets/jshint-master/tests/stable/unit/fixtures/immed.js
  100. +12 −0 assets/jshint-master/tests/stable/unit/fixtures/indent.js
  101. +17 −0 assets/jshint-master/tests/stable/unit/fixtures/insideEval.js
  102. +4 −0 assets/jshint-master/tests/stable/unit/fixtures/jslintInverted.js
  103. +9 −0 assets/jshint-master/tests/stable/unit/fixtures/jslintOptions.js
  104. +5 −0 assets/jshint-master/tests/stable/unit/fixtures/jslintRenamed.js
  105. +6 −0 assets/jshint-master/tests/stable/unit/fixtures/lastsemic.js
  106. +21 −0 assets/jshint-master/tests/stable/unit/fixtures/latedef.js
  107. +46 −0 assets/jshint-master/tests/stable/unit/fixtures/latedefundef.js
  108. +19 −0 assets/jshint-master/tests/stable/unit/fixtures/laxbreak.js
  109. +17 −0 assets/jshint-master/tests/stable/unit/fixtures/laxcomma.js
  110. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/loopfunc.js
  111. +74 −0 assets/jshint-master/tests/stable/unit/fixtures/max-cyclomatic-complexity-per-function.js
  112. +18 −0 assets/jshint-master/tests/stable/unit/fixtures/max-nested-block-depth-per-function.js
  113. +5 −0 assets/jshint-master/tests/stable/unit/fixtures/max-parameters-per-function.js
  114. +19 −0 assets/jshint-master/tests/stable/unit/fixtures/max-statements-per-function.js
  115. +3 −0 assets/jshint-master/tests/stable/unit/fixtures/maxlen.js
  116. +8 −0 assets/jshint-master/tests/stable/unit/fixtures/missingspaces.js
  117. +1 −0 assets/jshint-master/tests/stable/unit/fixtures/nestedFunctions-locations.js
  118. +35 −0 assets/jshint-master/tests/stable/unit/fixtures/nestedFunctions.js
  119. +13 −0 assets/jshint-master/tests/stable/unit/fixtures/newcap.js
  120. +7 −0 assets/jshint-master/tests/stable/unit/fixtures/noarg.js
  121. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/onevar.js
  122. +37 −0 assets/jshint-master/tests/stable/unit/fixtures/protoiterator.js
  123. +3 −0 assets/jshint-master/tests/stable/unit/fixtures/quotes.js
  124. +3 −0 assets/jshint-master/tests/stable/unit/fixtures/quotes2.js
  125. +36 −0 assets/jshint-master/tests/stable/unit/fixtures/quotes3.js
  126. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/redef.js
  127. +40 −0 assets/jshint-master/tests/stable/unit/fixtures/return.js
  128. +43 −0 assets/jshint-master/tests/stable/unit/fixtures/scope.js
  129. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/scripturl.js
  130. +14 −0 assets/jshint-master/tests/stable/unit/fixtures/smarttabs.js
  131. +59 −0 assets/jshint-master/tests/stable/unit/fixtures/strict_incorrect.js
  132. +21 −0 assets/jshint-master/tests/stable/unit/fixtures/strict_newcap.js
  133. +17 −0 assets/jshint-master/tests/stable/unit/fixtures/strict_this.js
  134. +18 −0 assets/jshint-master/tests/stable/unit/fixtures/strict_this2.js
  135. +9 −0 assets/jshint-master/tests/stable/unit/fixtures/strict_violations.js
  136. +24 −0 assets/jshint-master/tests/stable/unit/fixtures/strings.js
  137. +11 −0 assets/jshint-master/tests/stable/unit/fixtures/supernew.js
  138. +40 −0 assets/jshint-master/tests/stable/unit/fixtures/switchFallThrough.js
  139. +24 −0 assets/jshint-master/tests/stable/unit/fixtures/trycatch.js
  140. +24 −0 assets/jshint-master/tests/stable/unit/fixtures/undef.js
  141. +8 −0 assets/jshint-master/tests/stable/unit/fixtures/undef_func.js
  142. +6 −0 assets/jshint-master/tests/stable/unit/fixtures/undefstrict.js
  143. +18 −0 assets/jshint-master/tests/stable/unit/fixtures/unused.js
  144. +4 −0 assets/jshint-master/tests/stable/unit/fixtures/unusedglobals.js
  145. +66 −0 assets/jshint-master/tests/stable/unit/fixtures/white.js
  146. +16 −0 assets/jshint-master/tests/stable/unit/fixtures/with.js
  147. +1,396 −0 assets/jshint-master/tests/stable/unit/options.js
  148. +476 −0 assets/jshint-master/tests/stable/unit/parser.js
@@ -1,2 +1,3 @@
/.idea
*.log
*.log
.DS_Store
@@ -0,0 +1,8 @@
dist/*
node_modules/*
# TextMate 2 properties file.
.tm_properties
# File with my local one-off experiments.
demo.js
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.8
@@ -0,0 +1,105 @@
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.
@@ -0,0 +1,20 @@
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.
Oops, something went wrong.

0 comments on commit fc2981e

Please sign in to comment.