Skip to content

Commit

Permalink
Stylistic fixes for CONTRIBUTING and README
Browse files Browse the repository at this point in the history
  • Loading branch information
valueof committed Oct 9, 2012
1 parent 18d6ca4 commit 3103342
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -35,20 +35,22 @@ many people contributed. —[idiomatic.js](https://github.com/rwldrn/idiomatic.j
* [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

```javascript
// Good
var next = token.peak();
var prev = token.peak(-1);
var cur = token.current;

var scope = {
name: '(global)',
name: "(global)",
parent: parentScope,
vars: [],
uses: []
Expand All @@ -58,16 +60,19 @@ var scope = {
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
Expand All @@ -84,8 +89,8 @@ var next, prev, cur;
* 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

```javascript
// Good
token = token || tokens.find(0);

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -44,13 +44,13 @@ use them, clone this repo and run our build command:
Contributing
------------

Look for a file named CONTRIBUTING.md in this repository. It contains our 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 (`src/stable/jshint.js`) is
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
Expand Down

0 comments on commit 3103342

Please sign in to comment.