|
| 1 | +## Version [2.9.0](https://github.com/jscs-dev/node-jscs/compare/v2.8.0...v2.9.0) (2015-01-23): |
| 2 | + |
| 3 | +> Changed the changelog date format to be YYYY-MM-DD. |
| 4 | +
|
| 5 | +Whoo a release during this blizzard! Hopefully, this will be our last release before we start pushing out pre-release versions of 3.0. (If necessary, we can push bug fixes to 2.x) |
| 6 | + |
| 7 | +The plan: |
| 8 | + |
| 9 | +- Push the `2.9.0` release |
| 10 | +- Create a `2.x` branch off of `master` |
| 11 | +- Switch `master` to be the `3.0` branch |
| 12 | +- Merge in 2.x changes + cleanup stuff for a 3.0 alpha release. |
| 13 | +- Do what we can in our [3.0 milestone](https://github.com/jscs-dev/node-jscs/issues/1854). We would really appreciate any help! |
| 14 | + - Especially for deprecating rules/options, rule merging, renames/inconsistencies that we don't catch. |
| 15 | + |
| 16 | +### New Rules |
| 17 | + |
| 18 | +#### [`requireCapitalizedConstructorsNew`](http://jscs.info/rule/requireCapitalizedConstructorsNew) (Alexander O'Mara) |
| 19 | + |
| 20 | +```js |
| 21 | +// Description: Requires capitalized constructors to to use the `new` keyword |
| 22 | + |
| 23 | +// Usage |
| 24 | +"requireCapitalizedConstructors": { |
| 25 | + "allExcept": ["somethingNative"] |
| 26 | +} |
| 27 | + |
| 28 | +// Valid |
| 29 | +var x = new Y(); |
| 30 | +var x = new somethingNative(); // exception |
| 31 | + |
| 32 | +// Invalid |
| 33 | +var x = Y(); |
| 34 | +``` |
| 35 | + |
| 36 | +### Rule Updates |
| 37 | + |
| 38 | +- [`validateNewlineAfterArrayElements`](http://jscs.info/rule/validateNewlineAfterArrayElements): add autofix support for this rule (Joeri de Gooijer) |
| 39 | + |
| 40 | +```js |
| 41 | +// can turn |
| 42 | +var a = [0, |
| 43 | +1, |
| 44 | +2]; |
| 45 | + |
| 46 | +// into |
| 47 | +var a = [ |
| 48 | +0, |
| 49 | +1, |
| 50 | +2 |
| 51 | +]; |
| 52 | +``` |
| 53 | + |
| 54 | +This was [@joerideg's](https://github.com/joerideg) first PR, so congrats and hope to see more contributions (not necessarily here)! |
| 55 | + |
| 56 | +> I think we would need a seperate rule to both check/fix alignment properly. |
| 57 | +
|
| 58 | +- [`requireSemicolons`](http://jscs.info/rule/requireSemicolons): account for stage-2 `ClassProperty` (Henry Zhu) |
| 59 | + |
| 60 | +```js |
| 61 | +class A { |
| 62 | + prop; // will add a semicolon here |
| 63 | + prop2 = 1; // and here |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +- [`requireCamelCaseOrUpperCaseIdentifiers`](http://jscs.info/rule/requireCamelCaseOrUpperCaseIdentifiers): add extra options `allowedPrefixes, allowedSuffixes, allExcept` |
| 68 | + |
| 69 | + - This lets you specify a permitted array of String, RegExp, or ESTree RegExpLiteral values |
| 70 | + |
| 71 | +For options: `{ allowedSuffixes: ["_dCel", {regex:{pattern:"_[kMG]?Hz"}}] }` |
| 72 | + |
| 73 | +```js |
| 74 | +// Extra valid options |
| 75 | +var camelCase_dCel = 5; |
| 76 | +var _camelCase_MHz = 6; |
| 77 | + ``` |
| 78 | + |
| 79 | +```js |
| 80 | +// Invalid |
| 81 | +var camelCase_cCel = 4; |
| 82 | +var CamelCase_THz = 5; |
| 83 | +``` |
| 84 | + |
| 85 | +- [`requireNewlineBeforeBlockStatements`](http://jscs.info/rule/requireNewlineBeforeBlockStatements), [`disallowNewlineBeforeBlockStatements`](http://jscs.info/rule/disallowNewlineBeforeBlockStatements): account for `SwitchStatement` |
| 86 | + |
| 87 | +```js |
| 88 | +// Valid for requireNewlineBeforeBlockStatements |
| 89 | +switch (a) |
| 90 | +{ |
| 91 | + case 1: break; |
| 92 | +} |
| 93 | + |
| 94 | +// Valid for disallowNewlineBeforeBlockStatements |
| 95 | +switch (a) { |
| 96 | + case 1: break; |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +### Presets |
| 101 | + |
| 102 | +- `airbnb`: Enforce rule [25.1](https://github.com/airbnb/javascript/blob/c25dbac620b258c4421251bc403fffa1051de61e/README.md#25.1) (Joe Bartlett) |
| 103 | + - This adds `requireDollarBeforejQueryAssignment` |
| 104 | +- `airbnb`: Enforce rule [7.11](https://github.com/airbnb/javascript/blob/c25dbac620b258c4421251bc403fffa1051de61e/README.md#7.11) (Joe Bartlett) |
| 105 | + - This fixes up function spacing issues (autofixable) |
| 106 | +- `google`: Enforce [naming rules](https://google.github.io/styleguide/javascriptguide.xml#Naming__body) |
| 107 | + - This adds `"requireCamelCaseOrUpperCaseIdentifiers": { |
| 108 | + "allowedPrefixes": ["opt_"], |
| 109 | + "allExcept": ["var_args"] |
| 110 | +}` |
| 111 | + |
| 112 | +### Bug Fixes |
| 113 | + |
| 114 | +- [`requireEnhancedObjectLiterals`](http://jscs.info/rule/requireEnhancedObjectLiterals): Don't error for computed properties (Henry Zhu) |
| 115 | +- [`requireTemplateStrings`](http://jscs.info/rule/requireTemplateStrings): should not report string to binary (Oleg Gaidarenko) |
| 116 | +- [`requireVarDeclFirst`](http://jscs.info/rule/requireVarDeclFirst): be aware of the comments (Kushan Joshi) |
| 117 | + |
| 118 | +### Misc |
| 119 | +- `OVERVIEW.md`: add the [Visual Studio Code extension](https://marketplace.visualstudio.com/items/ms-vscode.jscs) to list of "Friendly Packages" (Tyler Hughes) |
| 120 | + |
1 | 121 | ## Version [2.8.0](https://github.com/jscs-dev/node-jscs/compare/v2.7.0...v2.8.0)
|
2 | 122 |
|
3 | 123 | Happy new year! Small changes this time, small, but important fixes which still warrants the minor bump.
|
|
0 commit comments