Skip to content
This repository
Browse code

Added LICENSE and CONTRIBUTING. Updated README

  • Loading branch information...
commit 18d6ca4c089d785acbdb4ce1aed1119bbcf93590 1 parent da0db53
Anton Kovalyov authored October 09, 2012
100  CONTRIBUTING.md
Source Rendered
... ...
@@ -0,0 +1,100 @@
  1
+How to contribute
  2
+=================
  3
+
  4
+The best way to make sure your issue is addressed is to submit a patch. We accept
  5
+patches through all mediums: pull requests, email, issue comment, tweet with a link
  6
+to a snippet, graffiti outside of Anton's apartment, etc.
  7
+
  8
+However, before sending a patch, please make sure that the following applies:
  9
+
  10
+* There is a corresponding issue. If there is no issue yet, create one before
  11
+  working on your patch. Patches that come out of nowhere usually end up in
  12
+	the end of our queue.
  13
+* Your commit message links to that issue.
  14
+* Your commit message is very descriptive ([example](https://github.com/jshint/jshint/commit/5751c5ed249b7a035758a3ae876cfa1a360fd144)).
  15
+* Your patch doesn't have useless merge commits.
  16
+* Your coding style is similar to ours (see below).
  17
+* Your patch is 100% tested. We don't accept any test regressions.
  18
+* All tests and lint checks pass (`node make.js test` and `node make.js lint`).
  19
+* You understand that we're super grateful for your patch.
  20
+
  21
+Coding Style
  22
+------------
  23
+
  24
+This section describes our coding style guide. You might not agree with it and that's
  25
+fine but if you're going to send us patches treat this guide as a law.
  26
+
  27
+### Our main rule is simple:
  28
+
  29
+> All code in any code-base should look like a single person typed it, no matter how
  30
+many people contributed. —[idiomatic.js](https://github.com/rwldrn/idiomatic.js/)
  31
+
  32
+### Whitespace:
  33
+
  34
+* We use hard tabs everywhere except for `src/stable/jshint.js`. It's annoying, we know.
  35
+* [Smart tabs](http://www.emacswiki.org/SmartTabs) are okay.
  36
+* Use one space after `if`, `for`, `while`, etc.
  37
+* Use one space after `function` for anonymous functions but not for named functions:
  38
+```javascript
  39
+var a = function () {};
  40
+function a() {}
  41
+```
  42
+* Feel free to indent variable assignments or property definitions if it makes the code look better. But don't abuse that:
  43
+```javascript
  44
+
  45
+// Good
  46
+var next = token.peak();
  47
+var prev = token.peak(-1);
  48
+var cur  = token.current;
  49
+
  50
+var scope = {
  51
+  name:   '(global)',
  52
+  parent: parentScope,
  53
+  vars:   [],
  54
+  uses:   []
  55
+};
  56
+
  57
+// Bad
  58
+var cur         = token.current;
  59
+var isSemicolon = cur.isPunctuator(";");
  60
+```
  61
+* Wrap multi-line comments with new lines on both sides.
  62
+
  63
+### Variables
  64
+
  65
+* Use one `var` per variable unless you don't assign any values to it (and it's short enough):
  66
+```javascript
  67
+var token = tokens.find(index);
  68
+var scope = scopes.current;
  69
+var next, prev, cur;
  70
+```
  71
+* Don't be overly descriptive with your variable names but don't abuse one-letter variables either. Find a sweet spot somewhere in between.
  72
+
  73
+### Comments
  74
+
  75
+* Use `//` for all comments.
  76
+* Comment everything that is not obvious.
  77
+* If you're adding a new check, write a comment describing why this check is important and what it checks for.
  78
+
  79
+### Misc
  80
+
  81
+* Always use strict mode.
  82
+* Always use strict comparisons: `===` and `!==`.
  83
+* Use semicolons.
  84
+* Don't use comma-first notation.
  85
+* Try not to chain stuff unless it **really** helps (e.g. in tests).
  86
+* Don't short-circuit expressions if you're not assigning the result:
  87
+```javascript
  88
+
  89
+// Good
  90
+token = token || tokens.find(0);
  91
+
  92
+// Bad
  93
+token.isPunctuator(";") && report.addWarning("W001");
  94
+
  95
+// Good
  96
+if (token.isPunctuator(";"))
  97
+  report.addWarning("W001");
  98
+```
  99
+
  100
+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.
20  LICENSE
... ...
@@ -0,0 +1,20 @@
  1
+Copyright 2012 Anton Kovalyov (http://jshint.com)
  2
+
  3
+Permission is hereby granted, free of charge, to any person obtaining
  4
+a copy of this software and associated documentation files (the
  5
+"Software"), to deal in the Software without restriction, including
  6
+without limitation the rights to use, copy, modify, merge, publish,
  7
+distribute, sublicense, and/or sell copies of the Software, and to
  8
+permit persons to whom the Software is furnished to do so, subject to
  9
+the following conditions:
  10
+
  11
+The above copyright notice and this permission notice shall be
  12
+included in all copies or substantial portions of the Software.
  13
+
  14
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
87  README.md
Source Rendered
@@ -2,16 +2,18 @@ JSHint, A Static Code Analysis Tool for JavaScript
2 2
 ==================================================
3 3
 
4 4
 JSHint is a community-driven tool to detect errors and potential problems in
5  
-JavaScript code and to enforce your team's coding conventions.
  5
+JavaScript code and to enforce your team's coding conventions. We made JSHint
  6
+very flexible so you can easily adjust it to your particular coding guidelines
  7
+and the environment you expect your code to execute in.
6 8
 
7  
-**IMPORTANT**:
  9
+Our goal is to help JavaScript developers write complex programs without
  10
+worrying about typos and language gotchas.
8 11
 
9  
- * This README is for people who are thinking about contributing to JSHint. For general usage
10  
-   please refer to [our website](http://jshint.com/).
11  
- * If you want to report a bug about the website, please go to the
12  
-   [jshint/site](https://github.com/jshint/site/) repository.
13  
- * If you want to report a bug or contribute to our NPM package, please go to the
14  
-   [jshint/node-jshint](https://github.com/jshint/node-jshint/) repository.
  12
+We believe that static code analysis programs—as well as other code quality
  13
+tools—are important and beneficial to the JavaScript community and, thus,
  14
+should not alienate their users.
  15
+
  16
+For general usage information, visit our website: [http://jshint.com/](http://jshint.com/).
15 17
 
16 18
 Reporting a bug
17 19
 ---------------
@@ -24,36 +26,32 @@ not limited to:
24 26
  * When JSHint complains about valid JavaScript code that works in all browsers
25 27
  * When you simply want a new option or feature
26 28
 
27  
-Please, before reporting a bug look around to see if there are any open or closed tickets that
  29
+Before reporting a bug look around to see if there are any open or closed tickets that
28 30
 cover your issue. And remember the wisdom: pull request > bug report > tweet.
29 31
 
30  
-Submitting patches
31  
-------------------
32  
-
33  
-The best way to make sure your issue is addressed is to submit a patch. GitHub provides a very
34  
-nice interface--pull requests--for that but we accept patches through all mediums: email, issue
35  
-comment, tweet with a link to a snippet, etc.
  32
+Installation
  33
+------------
36 34
 
37  
-Before submitting a patch make sure that you comply to our style. We don't have specific style
38  
-guide so just look around the code you are changing.
  35
+You can install JSHint via NPM:
39 36
 
40  
-Also, make sure that you write tests for new features and make sure that all tests pass before
41  
-submitting a patch. Patches that break the build will be rejected.
  37
+	npm install jshint -g
42 38
 
43  
-**FEATURE FREEZE**: Please note that we currently have a feature freeze on new environments and
44  
-styling options. The only patches we accept at this time are for bug fixes.
  39
+We also provide platform wrappers for Rhino, JavaScriptCore and Windows Script Host. To
  40
+use them, clone this repo and run our build command:
45 41
 
46  
-Tests
47  
------
  42
+	node make.js
48 43
 
49  
-To run tests you will need to install [node.js](http://nodejs.org/) and
50  
-expresso. You can install the latter with npm:
  44
+Contributing
  45
+------------
51 46
 
52  
-    npm install expresso
  47
+Look for a file named CONTRIBUTING.md in this repository. It contains our contributing
  48
+guidelines. We also have [a mailing list](http://groups.google.com/group/jshint/).
53 49
 
54  
-After that, running the unit tests is as easy as:
  50
+License
  51
+-------
55 52
 
56  
-    expresso tests/unit/*.js
  53
+JSHint is distributed under the MIT License. One file (`src/stable/jshint.js`) is
  54
+distributed under the slightly modified MIT License.
57 55
 
58 56
 Attribution
59 57
 -----------
@@ -63,41 +61,10 @@ Core Team members:
63 61
  * [Anton Kovalyov](http://anton.kovalyov.net/) ([@valueof](http://twitter.com/valueof))
64 62
  * [Wolfgang Kluge](http://klugesoftware.de/) ([blog](http://gehirnwindung.de/))
65 63
  * [Josh Perez](http://www.goatslacker.com/) ([@goatslacker](http://twitter.com/goatslacker))
  64
+ * [Brent Lintner](http://brentlintner.heroku.com/) ([@brentlintner](http://twitter.com/brentlintner))
66 65
 
67 66
 Maintainer: Anton Kovalyov
68 67
 
69  
-License
70  
--------
71  
-
72  
-JSHint is licensed under the same slightly modified MIT license that JSLint is.
73  
-It stops evil-doers everywhere.
74  
-
75  
-JSHint is a derivative work of JSLint:
76  
-
77  
-Copyright (c) 2002 Douglas Crockford  (www.JSLint.com)
78  
-
79  
-Permission is hereby granted, free of charge, to any person obtaining
80  
-a copy of this software and associated documentation files (the "Software"),
81  
-to deal in the Software without restriction, including without limitation
82  
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
83  
-and/or sell copies of the Software, and to permit persons to whom
84  
-the Software is furnished to do so, subject to the following conditions:
85  
-
86  
-The above copyright notice and this permission notice shall be included
87  
-in all copies or substantial portions of the Software.
88  
-
89  
-The Software shall be used for Good, not Evil.
90  
-
91  
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92  
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93  
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94  
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95  
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
96  
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
97  
-DEALINGS IN THE SOFTWARE.
98  
-
99  
-JSHint was forked from the 2010-12-16 edition of JSLint.
100  
-
101 68
 Thank you!
102 69
 ----------
103 70
 
6  src/stable/jshint.js
... ...
@@ -1,8 +1,8 @@
1 1
 /*!
2 2
  * JSHint, by JSHint Community.
3 3
  *
4  
- * Licensed under the same slightly modified MIT license that JSLint is.
5  
- * It stops evil-doers everywhere.
  4
+ * This file (and this file only) is licensed under the same slightly modified
  5
+ * MIT license that JSLint is. It stops evil-doers everywhere.
6 6
  *
7 7
  * JSHint is a derivative work of JSLint:
8 8
  *
@@ -28,8 +28,6 @@
28 28
  *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 29
  *   DEALINGS IN THE SOFTWARE.
30 30
  *
31  
- * JSHint was forked from the 2010-12-16 edition of JSLint.
32  
- *
33 31
  */
34 32
 
35 33
 /*

0 notes on commit 18d6ca4

Please sign in to comment.
Something went wrong with that request. Please try again.