|
| 1 | +## Version [2.5.0](https://github.com/jscs-dev/node-jscs/compare/v2.4.0...v2.5.0) (10-28-2015): |
| 2 | + |
| 3 | +### Preset Updates |
| 4 | + |
| 5 | +Thanks to markelog and Krinkle, the built-in wikimedia preset will be hosted at https://github.com/wikimedia/jscs-preset-wikimedia. |
| 6 | + |
| 7 | +The purpose of this change is so that organizations can update their preset as needed without waiting for JSCS to update to another minor version (even though we are releasing more often anyway). The plan is to not update our preset dependencies until a new minor version of JSCS. |
| 8 | + |
| 9 | +Example: |
| 10 | + |
| 11 | +```js |
| 12 | +// JSCS package.json |
| 13 | +"jscs-preset-wikimedia": "~1.0.0", |
| 14 | +``` |
| 15 | + |
| 16 | +- Wikimedia updates their preset to to `1.1.0` |
| 17 | +- A new user runs `npm install` with jscs and will get version `1.0.0` of the wikimedia preset |
| 18 | +- If the user wants to update the preset themselves, they can add a direct dependency in their package.json |
| 19 | +- Otherwise they can wait for JSCS to have a minor version update (`2.4.0` to `2.5.0`) which will update all presets. |
| 20 | + |
| 21 | +If you would like to maintain one of the default supported presets, please let us [know](https://github.com/jscs-dev/node-jscs/issues/1811). |
| 22 | + |
| 23 | +### New Rules |
| 24 | + |
| 25 | +#### [`requireSpacesInGenerator`](http://jscs.info/rule/requireSpacesInGenerator) (stefania11) |
| 26 | + |
| 27 | +Checks the spacing around the `*` in a generator function. |
| 28 | + |
| 29 | +```js |
| 30 | +"requireSpacesInGenerator": { |
| 31 | + "beforeStar": true, |
| 32 | + "afterStar": true |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +```js |
| 37 | +// allowed |
| 38 | +var x = function * () {}; |
| 39 | +function * a() {}; |
| 40 | +var x = async function * () {}; |
| 41 | +``` |
| 42 | + |
| 43 | +> Thanks to Stefania and Christopher for working on this rule this past Sunday during the JS Open Source workshop at the NY Javascript meetup! |
| 44 | +
|
| 45 | +### New Rule Options |
| 46 | + |
| 47 | +#### [`requireCurlyBraces`](http://jscs.info/rule/requireCurlyBraces) (Henry Zhu) |
| 48 | + |
| 49 | +```js |
| 50 | +"requireCurlyBraces": { |
| 51 | + "allExcept": ["return", "continue", "break", ...], |
| 52 | + "keywords": ["if", "else", "for", "while", ... ] |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +```js |
| 57 | +// allowed |
| 58 | +if (x) return; |
| 59 | +if (x) return 1; |
| 60 | +if (x) continue; |
| 61 | +if (x) break; |
| 62 | + |
| 63 | +// still not allowed |
| 64 | +if (x) i++; |
| 65 | +``` |
| 66 | + |
| 67 | +#### [`requireSpaceAfterComma`](http://jscs.info/rule/requireSpaceAfterComma) add option `{ allExcept: ['trailing'] }` (Brian Dixon) |
| 68 | + |
| 69 | +```js |
| 70 | +// allows |
| 71 | +var a = [{ |
| 72 | + test: /\.jsx?$/, |
| 73 | + exclude: /node_modules/, |
| 74 | + loader: 'babel', |
| 75 | +}]; |
| 76 | +``` |
| 77 | + |
| 78 | +### Fixes |
| 79 | + |
| 80 | +#### Account for sparse arrays in comma spacing rules (Brian Dixon) |
| 81 | + |
| 82 | +- [`disallowSpaceBeforeComma`](http://jscs.info/rule/disallowSpaceBeforeComma), [`disallowSpaceAfterComma`](http://jscs.info/rule/disallowSpaceAfterComma) |
| 83 | +- [`disallowSpaceBeforeBinaryOperators`](http://jscs.info/rule/disallowSpaceBeforeBinaryOperators), [`disallowSpaceAfterBinaryOperators`](http://jscs.info/rule/disallowSpaceAfterBinaryOperators) |
| 84 | + |
| 85 | +```js |
| 86 | +// allowed |
| 87 | +var x = [1, , ,2]; |
| 88 | +``` |
| 89 | + |
| 90 | +#### Configuration: correct config dir detection (Oleg Gaidarenko) |
| 91 | + |
| 92 | +Fixes a regression with loading additional rules in a `.jscsrc` |
| 93 | + |
1 | 94 | ## Version [2.4.0](https://github.com/jscs-dev/node-jscs/compare/v2.3.5...v2.4.0) (10-22-2015): |
2 | 95 |
|
3 | 96 | We're releasing pretty often now, right? :-) |
|
0 commit comments