|
| 1 | +## Version [2.6.0](https://github.com/jscs-dev/node-jscs/compare/v2.5.1...v2.6.0) (11-18-2015): |
| 2 | + |
| 3 | +Thanks to @seanpdoyle, we're able to move some of the ES6 rules from [ember-suave](https://github.com/dockyard/ember-suave) to JSCS! |
| 4 | + |
| 5 | +### New Rules |
| 6 | + |
| 7 | +#### [`disallowVar`](http://jscs.info/rule/disallowVar) (Sean Doyle) |
| 8 | + |
| 9 | +Disallows declaring variables with `var`. |
| 10 | + |
| 11 | +`"disallowVar": true` |
| 12 | + |
| 13 | +```js |
| 14 | +// Valid |
| 15 | +let foo; |
| 16 | +const bar = 1; |
| 17 | +``` |
| 18 | + |
| 19 | +```js |
| 20 | +// Invalid |
| 21 | +var baz; |
| 22 | +``` |
| 23 | + |
| 24 | +You can also use `"disallowKeywords": ["var"]` |
| 25 | + |
| 26 | +#### [`requireArrayDestructuring`](http://jscs.info/rule/requireArrayDestructuring) (Sean Doyle) |
| 27 | + |
| 28 | +Requires that variable assignment from array values are destructured. |
| 29 | + |
| 30 | +`"requireArrayDestructuring": true` |
| 31 | + |
| 32 | +```js |
| 33 | +// Valid |
| 34 | +var colors = ['red', 'green', 'blue']; |
| 35 | +var [ red ] = colors; |
| 36 | +``` |
| 37 | + |
| 38 | +```js |
| 39 | +// Invalid |
| 40 | +var colors = ['red', 'green', 'blue']; |
| 41 | +var red = colors[0]; |
| 42 | +``` |
| 43 | + |
| 44 | +#### [`requireEnhancedObjectLiterals`](http://jscs.info/rule/requireEnhancedObjectLiterals) (Sean Doyle) |
| 45 | + |
| 46 | +Requires declaring objects via ES6 enhanced object literals (shorthand versions of properties) |
| 47 | + |
| 48 | +`"requireEnhancedObjectLiterals": true` |
| 49 | + |
| 50 | +```js |
| 51 | +var obj = { |
| 52 | + foo() { }, |
| 53 | + bar |
| 54 | +}; |
| 55 | +``` |
| 56 | + |
| 57 | +```js |
| 58 | +var obj = { |
| 59 | + foo: function() { }, |
| 60 | + bar: bar |
| 61 | +}; |
| 62 | +``` |
| 63 | + |
| 64 | +#### [`requireObjectDestructuring`](http://jscs.info/rule/requireObjectDestructuring) (Sean Doyle) |
| 65 | + |
| 66 | +Requires variable declarations from objects via destructuring |
| 67 | + |
| 68 | +`"requireObjectDestructuring": true` |
| 69 | + |
| 70 | +```js |
| 71 | +// Valid |
| 72 | +var { foo } = SomeThing; |
| 73 | +var { bar } = SomeThing.foo; |
| 74 | +``` |
| 75 | + |
| 76 | +```js |
| 77 | +// Invalid |
| 78 | +var foo = SomeThing.foo; |
| 79 | +var bar = SomeThing.foo.bar; |
| 80 | +``` |
| 81 | + |
| 82 | +#### [`disallowSpacesInGenerator`](http://jscs.info/rule/disallowSpacesInGenerator) (Francisc Romano) |
| 83 | + |
| 84 | +Checks the spacing around the `*` in a generator function. |
| 85 | + |
| 86 | +```js |
| 87 | +"disallowSpacesInGenerator": { |
| 88 | + "beforeStar": true, |
| 89 | + "afterStar": true |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +```js |
| 94 | +var x = function*() {}; |
| 95 | +function*a() {}; |
| 96 | +var x = async function*() {}; |
| 97 | +``` |
| 98 | + |
| 99 | +### New Rule Options |
| 100 | + |
| 101 | +* `requireCamelCaseOrUpperCaseIdentifiers`: add `strict` option (Jan-Pieter Zoutewelle) |
| 102 | + |
| 103 | +Also forces the first character to not be capitalized. |
| 104 | + |
| 105 | +```js |
| 106 | +"requireCamelCaseOrUpperCaseIdentifiers": { |
| 107 | + "strict": true |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +```js |
| 112 | +// Valid |
| 113 | +var camelCase = 0; |
| 114 | +var UPPER_CASE = 4; |
| 115 | + |
| 116 | +// Invalid |
| 117 | +var Mixed_case = 2; |
| 118 | +var Snake_case = { snake_case: 6 }; |
| 119 | +var snake_case = { SnakeCase: 6 }; |
| 120 | +``` |
| 121 | + |
| 122 | +* `disallowSpace(After|Before)Comma`: add `allExcept: ['sparseArrays']` (Brian Dixon) |
| 123 | +* `validateQuoteMarks`: add "ignoreJSX" value (Oleg Gaidarenko) |
| 124 | +* `requireMatchingFunctionName`: add `includeModuleExports` option (George Chung) |
| 125 | + |
| 126 | +### Fixes |
| 127 | + |
| 128 | +* Account for sparse arrays in rules with spacing and commas (Brian Dixon) |
| 129 | + |
| 130 | + - [`disallowCommaBeforeLineBreak`](http://jscs.info/rule/disallowCommaBeforeLineBreak) |
| 131 | + - [`requireCommaBeforeLineBreak`](http://jscs.info/rule/requireCommaBeforeLineBreak) |
| 132 | + |
| 133 | +* `requireSpaceBeforeBinaryOperators`: report "operator =" correctly when erroring (Rob Wu) |
| 134 | +* `requireAlignedMultilineParams`: do not throw on function without body (Oleg Gaidarenko) |
| 135 | + |
| 136 | +### Preset Changes |
| 137 | +* `WordPress`: add `requireBlocksOnNewLines` (Gary Jones) |
| 138 | + |
1 | 139 | ## Version [2.5.1](https://github.com/jscs-dev/node-jscs/compare/v2.5.0...v2.5.1) (11-06-2015): |
2 | 140 |
|
3 | 141 | Just some bug fixes and an internal change before we integrate CST. |
|
0 commit comments