jscs
Version:
JavaScript Code Style
1,291 lines (909 loc) • 117 kB
Markdown
## Version [3.0.7](https://github.com/jscs-dev/node-jscs/compare/v3.0.6...v3.0.7) (2016-07-14):
* validateParameterSeparator: notice class methods (Oleg Gaidarenko)
## Version [3.0.6](https://github.com/jscs-dev/node-jscs/compare/v3.0.5...v3.0.6) (2016-07-01):
### Bug fixes
* requireDollarBeforejQueryAssignment: do not blow up on reset parameter (Oleg Gaidarenko)
### Misc
* Misc: explicitly use latest CST version (Oleg Gaidarenko)
* Misc: fix typo in the changelog (Oleg Gaidarenko)
* Misc: bump CST version to 0.4.2 (Oleg Gaidarenko)
## Version [3.0.5](https://github.com/jscs-dev/node-jscs/compare/v3.0.4...v3.0.5) (2016-06-21):
Small fixes for ES6/7 related to [CST](https://github.com/cst/cst) which consisted of updating this package since those fixes were made in there.
And also there is one fix related to `fileExtension` option
### Bug fixes
* Configuration: Do not set default options if preset is set (Oleg Gaidarenko)
* Misc: bump CST version to 0.4.0 (Oleg Gaidarenko)
* Docs: remove yandex preset from overview (Oleg Gaidarenko)
* Docs: add intro delimiter to readme (Oleg Gaidarenko)
* Misc: use correct headers in changelog (Oleg Gaidarenko)
* Misc: correct changelog auto-replace result (Oleg Gaidarenko)
* Misc: correct changelog jscs version (Oleg Gaidarenko)
* Misc: changelog should be consistent (Oleg Gaidarenko)
## Version [3.0.4](https://github.com/jscs-dev/node-jscs/compare/v3.0.3...v3.0.4) (2016-06-04):
Fixed some bugs, correctly output CST errors plus improve speed and memory consumption
### Bug fixes
* requireObjectKeysOnNewLine: do not break on object methods (Oleg Gaidarenko)
* Fix: Last method throw in requireObjectKeysOnNewLine (Alexey Yaroshevich)
* disallowQuotedKeysInObjects: ignore spread properties (Oleg Gaidarenko)
* maximumLineLength: correctly position error for comment nodes (Oleg Gaidarenko)
* disallowUnusedParams: notice AssignmentPattern nodes (Oleg Gaidarenko)
* disallowPaddingNewlinesBeforeKeywords: should not ignore comments (Oleg Gaidarenko)
* disallowObjectKeysOnNewLine: correct error message (Oleg Gaidarenko)
### Misc
* Misc: make linters happy (Oleg Gaidarenko)
* Misc: add node 6 to travis (Oleg Gaidarenko)
* Misc: do not modify CST in check mode (#2252) (Oleg Gaidarenko)
* Misc: remove rules "grouping" (Oleg Gaidarenko)
* Misc: bump cst version (Oleg Gaidarenko)
* Tests: remove mocha `.only` call (Oleg Gaidarenko)
* Misc: parallelizing build on travis (Alexey Yaroshevich)
* Misc: Set higher timeout for config generator tests (Alexey Yaroshevich)
* Build: update cst to 0.3.0 (Henry Zhu)
* Errors: add ugly exception for `validateQuoteMarks` of position calc (Oleg Gaidarenko)
* Errors: always add to `line` and `column` properties (Oleg Gaidarenko)
### Docs
* Docs: Fix small typo in require-early-return (#2259) (Sander Boom)
* add jscs+eslint info (#2230) (Henry Zhu)
* Docs: simplify readme a bit more (Oleg Gaidarenko)
* Docs: deprecation clean-up (Oleg Gaidarenko)
* requireCurlyBraces: small docs corrections (Oleg Gaidarenko)
## Version [3.0.3](https://github.com/jscs-dev/node-jscs/compare/v3.0.2...v3.0.3) (2016-02-16):
### Bug fixes
- Misc: Make an exception for esnext/verbose since they are removed
- Revert "Configuration: exclude nested node_modules by default
## Version [3.0.2](https://github.com/jscs-dev/node-jscs/compare/v3.0.1...v3.0.2) (2016-02-15):
### Bug fixes
- Revert all rule deprecations
## Version [3.0.1](https://github.com/jscs-dev/node-jscs/compare/v3.0.0...v3.0.1) (2016-02-14):
### Bug fixes
- disallowUnusedVariables: was including function expressions
## Version [3.0.0](https://github.com/jscs-dev/node-jscs/compare/v2.11.0...v3.0.0) (2016-04-14):
Hell yeah! 3.0 is here. First and foremost we rewrote every... single... rule. We fixed a plentiful amount of bugs (most of which were found during refactoring those rules using [CST](https://github.com/cst/cst)). This provides us the opportunity to include autofix for complicated rules like the brand new `disallowUnusedVariables` rule (see below).
### Breaking Changes
If you aren't a plugin writer or support build extensions (like grunt or gulp), etc you don't have to worry about anything.
We didn't rename/remove any rules. All you should have to do to update is just bump the `jscs` version in your `package` version to `3.0.0` and be done with it.
#### Configuration
These following config options have been replaced in 3.0:
- `--esnext` (-e) // enabled by default
- `--esprima` (-s) and `--esprimaOptions` // babylon is the underlying CST parser
- `--verbose` // also enabled by default to show rule name when there is an error
One thing to notice though: the `yandex` preset was removed. Since Yandex doesn't have official code style (don't look at the https://github.com/ymaps/codestyle), we were requested to remove it
One drawback from all these changes is that JSCS might be a little, just a little slower, so if you find any issues related to that - don't hesitate to [drop](https://github.com/jscs-dev/node-jscs/issues/new) us a line, or just drop us a line we are all friendly :).
### New rules
Since this release is about rewrite of internal design, we adding only four new rules (all of them were added by our contributors!).
#### [`disallowUnusedVariables`](http://jscs.info/rule/disallowUnusedVariables) by Brian Schemp
That rule useful when you have `var x = <whatever>` and you don't export that `x` and don't use it. This rule will highlight that and remove it if you want.
#### [`disallowSpacesInsideImportedObjectBraces`](http://jscs.info/rule/disallowSpacesInsideImportedObjectBraces) and [`requireSpacesInsideImportedObjectBraces`](http://jscs.info/rule/requireSpacesInsideImportedObjectBraces) by Maks Sadowsky
When you need or don't need additional parentheses -
```js
import /*–>*/{foo, bar}/*<–*/ from 'foo-bar';
```
#### [`requireUseStrict`](http://jscs.info/rule/requireUseStrict`) Erik Vold
Short and cool - ask you to use `"use strict"` pragma on top of the file if you so desire.
#### [`requireImportAlphabetized`](http://jscs.info/rule/requireImportAlphabetized) by Ray Hammond
Keeps your imports alphabetized, pretty handy way to keep your dependency in tidy state.
### Presets
* Preset: allow URLs inside comments for airbnb (andreyvolokitin)
* Preset: add `requireSpaceBeforeObjectValues` rule to airbnb preset (Oleg Gaidarenko)
* Preset: add `requireSpacesInsideImportedObjectBraces` to airbnb (Maks Sadowsky)
* Preset: Add 'requireSpaceBetweenArguments' to google preset (Jon Merrifield)
### Internal
There are a lot of internal changes but we like to keep this changelog short and tidy. We will continue to update this shortly.
## Version [2.11.0](https://github.com/jscs-dev/node-jscs/compare/v2.10.1...v2.11.0) (2016-03-01):
Spring release! Yeah, yeah, technically spring only comes in middle of the March (you nerds, you), but we're coming to you a bit earlier!
Anyways, there are three new rules, a couple of changes for the `airbnb` preset and important fixes for [`disallowSpacesInsideTemplateStringPlaceholders`](http://jscs.info/rule/disallowSpacesInsideTemplateStringPlaceholders) and [`validateQuoteMarks`](http://jscs.info/rule/validateQuoteMarks) (for all you ES7 lovers).
### New Rules
### [`requireSpaceBeforeDestructuredValues`](http://jscs.info/rule/requireSpaceBeforeDestructuredValues) by Maks Sadowsky
Enforces colon spacing after destructuring assignment i.e. [`requireSpaceBeforeObjectValues`](http://jscs.info/rule/requireSpaceBeforeObjectValues) but for destructuring.
```js
// good
const { String: EmberString } = Ember;
// bad
const { String:EmberString } = Ember;
```
### [`disallowArrayDestructuringReturn`](http://jscs.info/rule/disallowArrayDestructuringReturn) by Maks Sadowsky
Enforces the [5:3 verse](https://github.com/airbnb/javascript#5.3) of airbnb code style, which prohibits use of array destructuring for thy `CallExpressions`.
```js
// God is on your side
const { left, right } = processInput(input);
// Devil is on your shoulder!
const [left, __, top] = processInput(input);
```
### [`requireNewlineBeforeSingleStatementsInIf`](http://jscs.info/rule/requireNewlineBeforeSingleStatementsInIf) by Brian Schemp
Enforces using newlines in your *parenthesesless* code.
```js
// Cool stairs brah
if (x)
doX();
else
doY();
// Just how could you have "X" and "Y"'s on the same line?!
if (x) doX();
else doY();
```
### Presets
* Preset: ease up on `requireCamelCaseOrUpperCaseIdentifiers` in airbnb (Oleg Gaidarenko)
* Preset: add `disallowArrayDestructuringReturn` to airbnb preset (Maks Sadowsky)
### Bug fixes
* `disallowSpacesInsideTemplateStringPlaceholders`: check template literal (ikokostya)
* `validateQuoteMarks`: do not throw on es7 decorators (Oleg Gaidarenko)
Other commits (as always) are omitted, since they're all about internal stuff and we care about your viewing pleasure.
## Version [2.10.1](https://github.com/jscs-dev/node-jscs/compare/v2.10.0...v2.10.1) (2016-02-15):
### Bug fixes
- Regression in `requireSpaceBeforeKeywords` [#2135](https://github.com/jscs-dev/node-jscs/issues/2135)
## Version [2.10.0](https://github.com/jscs-dev/node-jscs/compare/v2.9.0...v2.10.0) (2016-02-15):
Happy Presidents Day!
In this release, it's just some additional rules to update to the airbnb preset, new rules, and fixes.
### Preset Changes
* Add `maximumLineLength` to the `airbnb` preset [(reference)](https://github.com/airbnb/javascript#18.12) (Oleg Gaidarenko)
* Add `disallowSpacesInsideTemplateStringPlaceholders` to the `airbnb` preset (not explicit but used in examples) (Oleg Gaidarenko)
* Add `disallowNewlineBeforeBlockStatements` rule to the `mdcs` preset [(reference)](https://github.com/mrdoob/three.js/wiki/Mr.doob's-Code-Style%E2%84%A2#blocks) (Mauricio Massaia)
### New Rules
#### `disallowSpacesInsideTemplateStringPlaceholders`
(ikokostya)
> Disallows spaces before and after curly brace inside template string placeholders.
```js
// usage in config
"disallowSpacesInsideTemplateStringPlaceholders": true
```
```js
// Valid
`Hello ${name}!`
```
```js
// Invalid
`Hello ${ name}!`
`Hello ${name }!`
`Hello ${ name }!`
```
#### `requireImportsAlphabetized` (Ray Hammond)
> Requires imports to be alphabetized
```js
// usage in config
"requireImportAlphabetized": true
```
```js
// Valid
import a from 'a';
import c from 'c';
import z from 'z';
```
```js
// Invalid
import a from 'a';
import z from 'z';
import c from 'c';
```
### Rule Updates
* `requireSpaceBeforeKeywords`: add a `allExcept` option for filtering out default keywords (gpiress)
* This allows you do specify exceptions to the all keywords instead of creating an array of whitelisted keywords when you only want to blacklist a few.
### Bug fixes
* `requireNumericLiterals`: miss if first argument is an Identifier (Robert Jackson)
* `disallowSpacesInsideTemplateStringPlaceholders`: skip the edge case (Oleg Gaidarenko)
* `requirePaddingNewLinesBeforeExport`: exclude if only statement in block (Brian Schemp)
* `maximumLineLength`: some nodes might contain null values (Oleg Gaidarenko)
### Docs
* Correct date in the changelog (Oleg Gaidarenko)
* Various rule corrections (Christopher Cook)
## Version [2.9.0](https://github.com/jscs-dev/node-jscs/compare/v2.8.0...v2.9.0) (2016-01-23):
> Changed the changelog date format to be YYYY-MM-DD.
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)
The plan:
- Push the `2.9.0` release
- Create a `2.x` branch off of `master`
- Switch `master` to be the `3.0` branch
- Merge in 2.x changes + cleanup stuff for a 3.0 alpha release.
- Do what we can in our [3.0 milestone](https://github.com/jscs-dev/node-jscs/issues/1854). We would really appreciate any help!
- Especially for deprecating rules/options, rule merging, renames/inconsistencies that we don't catch.
### New Rules
#### [`requireCapitalizedConstructorsNew`](http://jscs.info/rule/requireCapitalizedConstructorsNew) (Alexander O'Mara)
```js
// Description: Requires capitalized constructors to to use the `new` keyword
// Usage
"requireCapitalizedConstructors": {
"allExcept": ["somethingNative"]
}
// Valid
var x = new Y();
var x = new somethingNative(); // exception
// Invalid
var x = Y();
```
### Rule Updates
- [`validateNewlineAfterArrayElements`](http://jscs.info/rule/validateNewlineAfterArrayElements): add autofix support for this rule (Joeri de Gooijer)
```js
// can turn
var a = [0,
1,
2];
// into
var a = [
0,
1,
2
];
```
This was [@joerideg's](https://github.com/joerideg) first PR, so congrats and hope to see more contributions (not necessarily here)!
> I think we would need a seperate rule to both check/fix alignment properly.
- [`requireSemicolons`](http://jscs.info/rule/requireSemicolons): account for stage-2 `ClassProperty` (Henry Zhu)
```js
class A {
prop; // will add a semicolon here
prop2 = 1; // and here
}
```
- [`requireCamelCaseOrUpperCaseIdentifiers`](http://jscs.info/rule/requireCamelCaseOrUpperCaseIdentifiers): add extra options `allowedPrefixes, allowedSuffixes, allExcept`
- This lets you specify a permitted array of String, RegExp, or ESTree RegExpLiteral values
For options: `{ allowedSuffixes: ["_dCel", {regex:{pattern:"_[kMG]?Hz"}}] }`
```js
// Extra valid options
var camelCase_dCel = 5;
var _camelCase_MHz = 6;
```
```js
// Invalid
var camelCase_cCel = 4;
var CamelCase_THz = 5;
```
- [`requireNewlineBeforeBlockStatements`](http://jscs.info/rule/requireNewlineBeforeBlockStatements), [`disallowNewlineBeforeBlockStatements`](http://jscs.info/rule/disallowNewlineBeforeBlockStatements): account for `SwitchStatement`
```js
// Valid for requireNewlineBeforeBlockStatements
switch (a)
{
case 1: break;
}
// Valid for disallowNewlineBeforeBlockStatements
switch (a) {
case 1: break;
}
```
### Presets
- `airbnb`: Enforce rule [25.1](https://github.com/airbnb/javascript/blob/c25dbac620b258c4421251bc403fffa1051de61e/README.md#25.1) (Joe Bartlett)
- This adds `requireDollarBeforejQueryAssignment`
- `airbnb`: Enforce rule [7.11](https://github.com/airbnb/javascript/blob/c25dbac620b258c4421251bc403fffa1051de61e/README.md#7.11) (Joe Bartlett)
- This fixes up function spacing issues (autofixable)
- `google`: Enforce [naming rules](https://google.github.io/styleguide/javascriptguide.xml#Naming__body)
- This adds `"requireCamelCaseOrUpperCaseIdentifiers": {
"allowedPrefixes": ["opt_"],
"allExcept": ["var_args"]
}`
### Bug fixes
- [`requireEnhancedObjectLiterals`](http://jscs.info/rule/requireEnhancedObjectLiterals): Don't error for computed properties (Henry Zhu)
- [`requireTemplateStrings`](http://jscs.info/rule/requireTemplateStrings): should not report string to binary (Oleg Gaidarenko)
- [`requireVarDeclFirst`](http://jscs.info/rule/requireVarDeclFirst): be aware of the comments (Kushan Joshi)
### Misc
- `OVERVIEW.md`: add the [Visual Studio Code extension](https://marketplace.visualstudio.com/items/ms-vscode.jscs) to list of "Friendly Packages" (Tyler Hughes)
## Version [2.8.0](https://github.com/jscs-dev/node-jscs/compare/v2.7.0...v2.8.0)
Happy new year! Small changes this time, small, but important fixes which still warrants the minor bump.
Aside from bug fixes, this update includes improvement for the airbnb preset and `allExcept` option for the [`disallowNewlineBeforeBlockStatements`](http://jscs.info/rule/disallowNewlineBeforeBlockStatements)
## Version [2.7.0](https://github.com/jscs-dev/node-jscs/compare/v2.6.0...v2.7.0)
It's this time of the year again, 2.7 is here!
One new rule, cool amount of fixes and massive jsdoc rule set update.
### New Rules
Although there's only one new rule in this release, it's pretty powerful! Say thanks to @ficristo!
#### [`requireEarlyReturn`](http://jscs.info/rule/requireEarlyReturn)
```js
// This is cool
function test() {
if (x) {
return x;
}
return y;
}
// This is not
function test() {
if (x) {
return x;
} else {
return y;
}
}
```
This is one of the most popular patterns out there, such as in [idiomatic](https://github.com/rwaldron/idiomatic.js/) and [node-style-guide](https://github.com/felixge/node-style-guide).
### Presets
- The `idiomatic` and `node-style-guide` presets now have the `requireEarlyReturn` rule.
- Whereas the `airbnb` preset is better in treating JSX.
### Bug fixes
* [`disallowTrailingWhitespace`](http://jscs.info/rule/disallowTrailingWhitespace) changes for autofix (thanks @lukeapage!)
* `requirePaddingNewlinesBeforeKeywords`: allow function return on the same line
* `disallowMixedSpacesAndTabs`: fix issue with erroring on block comments
* `auto-configure`: set `maxErrors` to `Infinity`
### Notable Changes in [`jsDoc`](http://jscs.info/rule/jsDoc)
* Improves ES6 support for `enforceExistence`: add exceptions for arrow functions and ES6 modules exports
* Many fixes related to `requireDescriptionCompleteSentence`
* Fixes for incorrecly sticked docblocks to IIFE
* Docblocks without tags now parsing correctly
* Adds `@override` to `jsdoc3` preset
* Arrow functions now treats as usual functions
See the full list in [jscs-jsdoc changelog](https://github.com/jscs-dev/jscs-jsdoc/blob/master/CHANGELOG.md#user-content-v130---2015-12-05).
## Version [2.6.0](https://github.com/jscs-dev/node-jscs/compare/v2.5.1...v2.6.0) (11-18-2015):
Thanks to @seanpdoyle, we're able to move some of the ES6 rules from [ember-suave](https://github.com/dockyard/ember-suave) to JSCS!
### New Rules
#### [`disallowVar`](http://jscs.info/rule/disallowVar) (Sean Doyle)
Disallows declaring variables with `var`.
`"disallowVar": true`
```js
// Valid
let foo;
const bar = 1;
```
```js
// Invalid
var baz;
```
You can also use `"disallowKeywords": ["var"]`
#### [`requireArrayDestructuring`](http://jscs.info/rule/requireArrayDestructuring) (Sean Doyle)
Requires that variable assignment from array values are destructured.
`"requireArrayDestructuring": true`
```js
// Valid
var colors = ['red', 'green', 'blue'];
var [ red ] = colors;
```
```js
// Invalid
var colors = ['red', 'green', 'blue'];
var red = colors[0];
```
#### [`requireEnhancedObjectLiterals`](http://jscs.info/rule/requireEnhancedObjectLiterals) (Sean Doyle)
Requires declaring objects via ES6 enhanced object literals (shorthand versions of properties)
`"requireEnhancedObjectLiterals": true`
```js
var obj = {
foo() { },
bar
};
```
```js
var obj = {
foo: function() { },
bar: bar
};
```
#### [`requireObjectDestructuring`](http://jscs.info/rule/requireObjectDestructuring) (Sean Doyle)
Requires variable declarations from objects via destructuring
`"requireObjectDestructuring": true`
```js
// Valid
var { foo } = SomeThing;
var { bar } = SomeThing.foo;
```
```js
// Invalid
var foo = SomeThing.foo;
var bar = SomeThing.foo.bar;
```
#### [`disallowSpacesInGenerator`](http://jscs.info/rule/disallowSpacesInGenerator) (Francisc Romano)
Checks the spacing around the `*` in a generator function.
```js
"disallowSpacesInGenerator": {
"beforeStar": true,
"afterStar": true
}
```
```js
var x = function*() {};
function*a() {};
var x = async function*() {};
```
### New Rule Options
* `requireCamelCaseOrUpperCaseIdentifiers`: add `strict` option (Jan-Pieter Zoutewelle)
Also forces the first character to not be capitalized.
```js
"requireCamelCaseOrUpperCaseIdentifiers": {
"strict": true
}
```
```js
// Valid
var camelCase = 0;
var UPPER_CASE = 4;
// Invalid
var Mixed_case = 2;
var Snake_case = { snake_case: 6 };
var snake_case = { SnakeCase: 6 };
```
* `disallowSpace(After|Before)Comma`: add `allExcept: ['sparseArrays']` (Brian Dixon)
* `validateQuoteMarks`: add "ignoreJSX" value (Oleg Gaidarenko)
* `requireMatchingFunctionName`: add `includeModuleExports` option (George Chung)
### Fixes
* Account for sparse arrays in rules with spacing and commas (Brian Dixon)
- [`disallowCommaBeforeLineBreak`](http://jscs.info/rule/disallowCommaBeforeLineBreak)
- [`requireCommaBeforeLineBreak`](http://jscs.info/rule/requireCommaBeforeLineBreak)
* `requireSpaceBeforeBinaryOperators`: report "operator =" correctly when erroring (Rob Wu)
* `requireAlignedMultilineParams`: do not throw on function without body (Oleg Gaidarenko)
### Preset Changes
* `WordPress`: add `requireBlocksOnNewLines` (Gary Jones)
## Version [2.5.1](https://github.com/jscs-dev/node-jscs/compare/v2.5.0...v2.5.1) (11-06-2015):
Just some bug fixes and an internal change before we integrate CST.
### Fixes
* `disallowUnusedParams`: ignore eval exressions (Oleg Gaidarenko)
* `Configuration`: do not try to load presets with function values (Oleg Gaidarenko)
* `requirePaddingNewLinesAfterBlocks` - don't throw on empty block (Oleg Gaidarenko)
* `requireSpacesInGenerator` - account for named functions (Henry Zhu)
### Internal changes
* Add `Whitespace` token in preparation for using CST (Marat Dulin)
## Version [2.5.0](https://github.com/jscs-dev/node-jscs/compare/v2.4.0...v2.5.0) (10-28-2015):
### Preset Updates
Thanks to markelog and Krinkle, the built-in wikimedia preset will be hosted at https://github.com/wikimedia/jscs-preset-wikimedia.
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.
Example:
```js
// JSCS package.json
"jscs-preset-wikimedia": "~1.0.0",
```
- Wikimedia updates their preset to to `1.1.0`
- A new user runs `npm install` with jscs and will get version `1.0.0` of the wikimedia preset
- If the user wants to update the preset themselves, they can add a direct dependency in their package.json
- Otherwise they can wait for JSCS to have a minor version update (`2.4.0` to `2.5.0`) which will update all presets.
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).
### New Rules
#### [`requireSpacesInGenerator`](http://jscs.info/rule/requireSpacesInGenerator) (stefania11)
Checks the spacing around the `*` in a generator function.
```js
"requireSpacesInGenerator": {
"beforeStar": true,
"afterStar": true
}
```
```js
// allowed
var x = function * () {};
function * a() {};
var x = async function * () {};
```
> Thanks to Stefania and Christopher for working on this rule this past Sunday during the JS Open Source workshop at the NY Javascript meetup!
### New Rule Options
#### [`requireCurlyBraces`](http://jscs.info/rule/requireCurlyBraces) (Henry Zhu)
```js
"requireCurlyBraces": {
"allExcept": ["return", "continue", "break", ...],
"keywords": ["if", "else", "for", "while", ... ]
}
```
```js
// allowed
if (x) return;
if (x) return 1;
if (x) continue;
if (x) break;
// still not allowed
if (x) i++;
```
#### [`requireSpaceAfterComma`](http://jscs.info/rule/requireSpaceAfterComma) add option `{ allExcept: ['trailing'] }` (Brian Dixon)
```js
// allows
var a = [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
}];
```
### Fixes
#### Account for sparse arrays in comma spacing rules (Brian Dixon)
- [`disallowSpaceBeforeComma`](http://jscs.info/rule/disallowSpaceBeforeComma), [`disallowSpaceAfterComma`](http://jscs.info/rule/disallowSpaceAfterComma)
- [`disallowSpaceBeforeBinaryOperators`](http://jscs.info/rule/disallowSpaceBeforeBinaryOperators), [`disallowSpaceAfterBinaryOperators`](http://jscs.info/rule/disallowSpaceAfterBinaryOperators)
```js
// allowed
var x = [1, , ,2];
```
#### Configuration: correct config dir detection (Oleg Gaidarenko)
Fixes a regression with loading additional rules in a `.jscsrc`
## Version [2.4.0](https://github.com/jscs-dev/node-jscs/compare/v2.3.5...v2.4.0) (10-22-2015):
We're releasing pretty often now, right? :-)
### `Fix` option
- The `--fix` CLI flag can now be used programatically and [through](http://jscs.info/overview#fix) a `.jscsrc` config.
> This is be useful for plugin authors (not only for jscs plugins but also for `grunt`/`gulp`/`etc...`)
### Preset updates
- The `jquery` preset (and dependant ones like `wordpress` and `wikimedia`) is less strict, whereas `idiomatic` is now more meticulous.
### Couple new rules
* [`disallowSpaceAfterComma`](http://jscs.info/rule/disallowSpaceAfterComma) - to have an opposite rule to [`disallowSpaceBeforeComma`](http://jscs.info/rule/disallowSpaceBeforeComma):
```js
[1,2,3] // valid
[1, 2, 3] // invalid
```
* [`requireAlignedMultilineParams`](http://jscs.info/rule/requireAlignedMultilineParams) - a nice addition to our indentation rules:
```js
var test = function(one, two,
/*indent!*/ three) {
...
};
```
### Some new rule options
* [`requireDotNotation`](http://jscs.info/rule/requireDotNotation) now supports fancy letters like `π` -
```js
obj["ಠ_ಠ"] // This is wrong!
obj.ಠ_ಠ // Now you get it :-)
```
* [`maxNumberOfLines`](http://jscs.info/rule/maxNumberOfLines) can now ignore comments with the `{"allExcept": ["comments"]}` option
* [`requireObjectKeysOnNewLine`](http://jscs.info/rule/requireObjectKeysOnNewLine) can ignore object properties on the same line with `{"allExcept": ["sameLine"]}` option -
```js
var whatDoesAnimalsSay = {
cat: 'meow', dog: 'woof', fox: 'What does it say?' // this is cool now
};
```
### Fixes
* Account for bare blocks in both [`disallowNewlineBeforeBlockStatements`](http://jscs.info/rule/disallowNewlineBeforeBlockStatements) and [`disallowSpaceBeforeBlockStatements`](http://jscs.info/rule/disallowSpaceBeforeBlockStatements)
```js
// allows
var a = 1;
{
let b = 1;
}
```
## Version [2.3.5](https://github.com/jscs-dev/node-jscs/compare/v2.3.4...v2.3.5) (10-19-2015):
Why not fix some more bugs!
### Bug fixes
* Fix: `requireSpacesInForStatement` account for parenthesizedExpression (Henry Zhu)
```js
// allows ()
for (var i = 0; (!reachEnd && (i < elementsToMove)); i++) {
```
* Fix: `disallowCommaBeforeLineBreak`: fix for function params (Henry Zhu)
```js
// allows
function a(b, c) {
console.log('');
}
```
* Fix: `requirePaddingNewLineAfterVariableDeclaration` - allow exported declarations (Henry Zhu)
```js
// allows
export var a = 1;
export let a = 1;
export const a = 1;
```
* Fix: `disallowSpaceAfterKeywords` - fix issue with using default keyword list (Henry Zhu)
```js
// fixes autofix from `return obj` to `returnobj`
```
* Fix: `disallowTrailingComma`, `requireTrailingComma` - support ObjectPattern and ArrayPattern (Henry Zhu)
```js
// disallow
const { foo, bar } = baz;
const [ foo, bar ] = baz;
// require
const { foo, bar, } = baz;
const [ foo, bar, ] = baz;
```
hzoo
## Version [2.3.4](https://github.com/jscs-dev/node-jscs/compare/v2.3.3...v2.3.4) (10-17-2015):
### Bug fixes
- Change `requireVarDeclFirst` to ignore let and const [`2199ca4`](https://github.com/jscs-dev/node-jscs/commit/2199ca488a56ff1472d876ac2b21fe2292ae8413) [`#1783`](https://github.com/jscs-dev/node-jscs/issues/1783)
- Fixed an issue with all function spacing rules not accounting for the generators [`a2c009f`](https://github.com/jscs-dev/node-jscs/commit/a2c009f19aaf410a46abb3edfbc56d4aa9931f41) [`#1175`](https://github.com/jscs-dev/node-jscs/issues/1175)
hzoo
## Version [2.3.3](https://github.com/jscs-dev/node-jscs/compare/v2.3.2...v2.3.3) (10-16-2015):
### Bug fixes
- Fixed an error with `disallowUnusedParams` and es6 imports [`63526b7`](https://github.com/jscs-dev/node-jscs/commit/63526b73d55eed3719d79527a7a7c7490b4cd2cb) [`#1875`](https://github.com/jscs-dev/node-jscs/issues/1875)
- Fixed an autofix issue with all function spacing rules and not accounting for the async keyword [`cf134a1`](https://github.com/jscs-dev/node-jscs/commit/cf134a12c1ab0bb7a23c7197780593bfdb8682e2) [`#1873`](https://github.com/jscs-dev/node-jscs/issues/1873)
hzoo
## Version [2.3.2](https://github.com/jscs-dev/node-jscs/compare/v2.3.1...v2.3.2) (10-14-2015):
Fix an issue with `--extract` option being true by default
## Version [2.3.1](https://github.com/jscs-dev/node-jscs/compare/v2.3.0...v2.3.1) (10-14-2015):
A bunch of bug fixes in this release!
### The Future
We are probably going to start 3.0 for the next release (mainly integrating [CST](https://github.com/cst/cst) into JSCS). If you want to know more about CST check out the [previous changelog](https://github.com/jscs-dev/node-jscs/blob/master/CHANGELOG.md#-つ-_-つ--give-cst).
Our current plan is to move our 3.0/cst branch to master and then create a 2.x branch to continue to release bug fixes / contributer PRs. The core team will be mainly focused on tackling issues on our [3.0 roadmap](https://github.com/jscs-dev/node-jscs/issues/1854) (which we are still planning). We would love to hear your feedback on what you think should be in 3.0 and beyond!
### Bug fixes
* [`disallowMultipleVarDecl`](http://jscs.info/rule/disallowMultipleVarDecl) - improve `{"allExcept": ["require"]}` logic (ValYouW)
```js
// Allow MemberExpressions: require('a').b.c;
var fs = require('fs');
var Emitter = require('events').EventEmitter;
```
* [`disallowSpaceAfterObjectKeys`](http://jscs.info/rule/disallowSpaceAfterObjectKeys) - Allow no space after key with `align` option. (Andrey Ermakov)
```js
// this should be allowed
var f = {
"name": 1,
"x": 2
};
```
* [`disallowUnusedParams`](http://jscs.info/rule/disallowUnusedParams) - correctly output unused param name (Oleg Gaidarenko)
```js
// Should output:
// Param unusedParam is not used at input
var a = function(unusedParam) {}
```
* [`requireDollarBeforejQueryAssignment`](http://jscs.info/rule/requireDollarBeforejQueryAssignment) - validate all keys (Brian Dixon)
```js
// check all keys
var x = {
bar: 1,
foo: $(".foo") // error here
};
```
* [`requireDollarBeforejQueryAssignment`](http://jscs.info/rule/requireDollarBeforejQueryAssignment) - Ignore array
destructuring (Simen Bekkhus)
```js
// Don't error with this
const [beep, boop] = meep;
var $s = $("#id")
```
* `CLI` - "auto-configure" argument should always be at the end
(Oleg Gaidarenko)
```bash
// correct autoconfigure args
jscs --autoconfigure ./files/here
```
* `js-file` - make parser not confuse token types (Oleg Gaidarenko)
```js
// Fixes issues with keywords like with
class A {
catch() {}
}
```
Again, a big thanks to everything using [JSCS](jscs.info)! Definitely continue to report any bugs and new ideas! We always appreciate any help/PRs!
We'll probably be moving more of the new rule/option issues to [`orphaned`](https://github.com/jscs-dev/node-jscs/issues?q=label%3Aorphaned+is%3Aclosed) which just means that they are on hold but anyone can still PR it or reopen it later. Remember to tweet at us at [@jscs_dev](https://twitter.com/jscs_dev) and chat with us on our [gitter room](https://gitter.im/jscs-dev/node-jscs)!
hzoo
## Version [2.3.0](https://github.com/jscs-dev/node-jscs/compare/v2.2.1...v2.3.0) (10-07-2015):
A quick update! A few more rules, preset updates, and bug fixes!
> If anyone missed it from the previous minor release, we've been working on https://github.com/cst/cst. This will help us continue to autofix more complex rules in the future. If you want to know more about it check out the [changelog](https://github.com/jscs-dev/node-jscs/blob/master/CHANGELOG.md#-つ-_-つ--give-cst).
Now that we're done implementing all of ES6 the next major thing we'll be working on is intergrating CST into JSCS.
### New Rules:
#### [`disallowIdenticalDestructuringNames`](http://jscs.info/rule/disallowIdenticalDestructuringNames) (ES6) (Henry Zhu)
```js
// Valid for "disallowIdenticalDestructuringNames": true
var {left, top} = obj; // shorthand
var {left, top: topper} = obj; // different identifier
let { [key]: key } = obj; // computed property
```
```js
// Invalid for "disallowIdenticalDestructuringNames": true
var {left: left, top: top} = obj;
```
#### [`disallowNestedTernaries`](http://jscs.info/rule/disallowNestedTernaries) (Brian Dixon)
```js
// Valid for "disallowNestedTernaries": "true"
// Valid for "disallowNestedTernaries": { "maxLevel": 0 }
var foo = (a === b) ? 1 : 2;
```
```js
// Invalid for "disallowNestedTernaries": true
// Valid for "disallowNestedTernaries": { "maxLevel": 0 }
var foo = (a === b)
? (a === c)
? 1
: 2
: (b === c)
? 3
: 4;
```
#### [`requireSpaceAfterComma`](http://jscs.info/rule/requireSpaceAfterComma) (Brian Dixon)
> To match [requireSpaceBeforeComma](http://jscs.info/rule/requireSpaceBeforeComma)
```js
// Valid for "requireSpaceAfterComma": true
var a, b;
```
```js
// Invalid for "requireSpaceAfterComma": true
var a,b;
```
### Preset Updates:
- Preset: add more comma rules to jquery and airbnb presets (Oleg Gaidarenko) [`94f175e`](https://github.com/jscs-dev/node-jscs/commit/94f175eec822f62528e6e5ca5aab0eb1de037243)
- Preset: `wordpress` - change `requireCamelCaseOrUpperCaseIdentifiers` from `true` to `ignoreProperties` [`58ba037`](https://github.com/jscs-dev/node-jscs/commit/58ba030744e8c7e55fa40a08bf19e89fc93a7eed)
### Bug fixes
- Fix: `disallowParenthesesAroundArrowParam` - account for non-identifiers (`RestElement`, `ArrayPattern`) correctly (Henry Zhu) [`bcfaa51`](https://github.com/jscs-dev/node-jscs/commit/bcfaa5192b09391bdec31adecab14d3861817c8a) [#1831](https://github.com/jscs-dev/node-jscs/issues/1831)
- Fix: `disallowCommaBeforeLineBreak` correctly handle empty object (Oleg Gaidarenko)
[`6571ebb`](https://github.com/jscs-dev/node-jscs/commit/6571ebbbf29e5b96be45ade585e4676de3c2817d) [#1841](https://github.com/jscs-dev/node-jscs/issues/1841)
Again, a big thanks to everything using JSCS! Definitely continue to report any bugs and new ideas! We always appreciate any help/PRs as we don't have that many resources!
hzoo
### Other
* disallowDanglingUnderscores: correct documentation (Oleg Gaidarenko)
* Docs: `disallowMultipleVarDecl` typo (ValYouW)
* Docs: couple small fixes (Oleg Gaidarenko)
* Internal: `Checker` - return correct arguments for excluded files (Oleg Gaidarenko)
* Misc: remove babelType and just use node.type (Henry Zhu)
* Misc: Update CHANGELOG.md (Craig Klementowski)
* Misc: Use Chai (Marat Dulin)
## Version [2.2.1](https://github.com/jscs-dev/node-jscs/compare/v2.2.0...v2.2.1) (09-29-2015):
#### Bug fix:es
Quick fix related to checker not returning correctly with excluded files.
- [`f12830a`](https://github.com/jscs-dev/node-jscs/commit/f12830a469959f3543c51bfc632fe37292ea6d09) [#1816](https://github.com/jscs-dev/node-jscs/issues/1816)
- Internal: `Checker` - return correct arguments for excluded files ([markelog](https://github.com/markelog))
## Version [2.2.0](https://github.com/jscs-dev/node-jscs/compare/v2.1.1...v2.2.0) (09-28-2015):
Again, it's been way too long since the last version; we're going to be releasing more often in the future!
In this release, we have a nicer [homepage](http://jscs.info/), 5 new rules, 4 more autofixable rules, many new rule options/bug fixes, and a [jscs-jsdoc@1.2.0](https://github.com/jscs-dev/jscs-jsdoc/blob/master/CHANGELOG.md#v120---2015-09-22) update.
We also added support for using YAML in config files, checking JS style in HTML files, and are **trying out some non-stylistic rules** (like [`disallowUnusedParams`](http://jscs.info/rule/disallowUnusedParams))!
Be on the look out for https://github.com/cst/cst (just finished ES6 support this weekend) if you haven't already.
### Autofixing: Support for 4 more rules!
Thanks to [@markelog](https://github.com/markelog), we also have autofix support for the following rules:
- [`disallowSemicolons`](http://jscs.info/rule/disallowSemicolons)
- [`requireSemicolons`](http://jscs.info/rule/requireSemicolons)
- [`disallowQuotedKeysInObjects`](http://jscs.info/rule/disallowQuotedKeysInObjects)
- [`requireCapitalizedComments`](http://jscs.info/rule/requireCapitalizedComments)
> We will also be labeling which rules don't support autofixing (only a few).
### Configuration: YAML support, and linting JS in HTML files
We weren't even thinking about different config formats, but [@ronkorving](https://github.com/ronkorving) stepped in and added support for using YAML as a config format!
So now you can use a `.jscsrc / jscs.json` (JSON) file or a `.jscs.yaml` (YAML) file.
[@lahmatiy](https://github.com/lahmatiy) has landed support for linting javascript in HTML files with the [extract](http://jscs.info/overview#extract) option! Thanks so much for sticking with us for that PR.
Example usage:
```
jscs ./hello.html --extract *.html
```
### New Rules
#### [`disallowMultiLineTernary`](http://jscs.info/rule/disallowMultiLineTernary) (Brian Dixon)
```js
// Valid for "disallowMultiLineTernary": true
var foo = (a === b) ? 1 : 2;
```
#### [`requireMultiLineTernary`](http://jscs.info/rule/requireMultiLineTernary) (Brian Dixon)
```js
// Valid for "requireMultiLineTernary": true
var foo = (a === b)
? 1
: 2;
```
#### [`disallowTabs`](http://jscs.info/rule/disallowTabs) (Mike Ottum)
It disallows tab characters everywhere!
#### [`disallowUnusedParams`](http://jscs.info/rule/disallowUnusedParams) (Oleg Gaidarenko)
Another cool rule [@markelog](https://github.com/markelog) added is actually a non-stylistic rule with autofixing support! It checks to make sure you use the parameters in function declarations and function expressions!
```js
// Invalid since test is unused
function x(test) {
}
var x = function(test) {
}
```
#### [`validateCommentPosition`](http://jscs.info/rule/validateCommentPosition) (Brian Dixon)
Comments that start with keywords like `eslint, jscs, jshint` are ignored by default.
```js
/* Valid for "validateCommentPosition": { position: `above`, allExcept: [`pragma`] } */
// This is a valid comment
1 + 1; // pragma (this comment is fine)
/* Valid for "validateCommentPosition": { position: `beside` } */
1 + 1; // This is a valid comment
```
Just as a reminder, you can disable certain AST node types with the [`disallowNodeTypes`](http://jscs.info/rule/disallowNodeTypes.html) rule which takes in an array of node types.
For example: if you want to disable arrow functions for some reason, you could do
`"disallowNodeTypes": ['ArrowFunctionExpression']`.
### Presets: Idiomatic.js and other updates
We finally added support for [Idiomatic.js](https://github.com/rwaldron/idiomatic.js)! There are a few more rules we still need to add, so leave a comment in the [issue](https://github.com/jscs-dev/node-jscs/issues/1065) or create a new one.
* `Google`: remove `capitalizedNativeCase` option in the JSDoc `checkTypes` rule (Sam Thorogood)
* `Idiomatic`: add initial preset (Henry Zhu)
* `jQuery`: add `disallowSpacesInCallExpression` rule to (Oleg Gaidarenko)
* `jQuery`: use `ignoreIfInTheMiddle` value for `requireCapitalizedComments` rule (Oleg Gaidarenko)
* `jQuery`: add `validateIndentation` rule (Oleg Gaidarenko)
* `Wikimedia`: enable `es3` (James Forrester)
### Rule Options/Changes
* `requireSpacesInsideParentheses`: `ignoreParenthesizedExpression` option (Oleg Gaidarenko)
* `disallowSpaceAfterObjectKeys`: add `method` exception option (Alexander Zeilmann)
* `disallowSpaceBeforeSemicolon`: add `allExcept` option (Oleg Gaidarenko)
* `requireCapitalizedComments`: add `ignoreIfInTheMiddle` option (Oleg Gaidarenko)
* `disallowSpacesInsideParentheses`: add quotes option (Oleg Gaidarenko)
* `requireSpacesInsideParentheses`: add quotes option (Oleg Gaidarenko)
* `requireCapitalizedComments`: add default exceptions (alawatthe)
* `requireArrowFunctions`: create an error on function bind (Henry Zhu)
* Misc: Bucket all rules into groups, test case to ensure new rules have a group (indexzero)
### Bug fixes
We fixed a bug with exit codes not matching the [wiki](https://github.com/jscs-dev/node-jscs/wiki/Exit-codes) (Oleg Gaidarenko).
* `disallowParenthesesAroundArrowParam`: fix check for params (Henry Zhu)
* `spacesInsideBrackets`: account for block comments (Oleg Gaidarenko)
* `disallowSemicolons`: ignore needed exceptions (Oleg Gaidarenko)
* `spacesInFunctionExpression`: account for async functions (MikeMac)
* `disallowSpaceBeforeSemicolon`: do not trigger error if it's first token (Oleg Gaidarenko)
* `requireCapitalizedComments`: consider edge cases (Oleg Gaidarenko)
* `requireSemicolons`: handle phantom cases (Oleg Gaidarenko)
* `spaceAfterObjectKeys`: fix for computed properties with more than one token (Henry Zhu)
* Exclude `.git` folder by default (Vladimir Starkov)
### JSDoc updates
* New Rule: [`checkParamExistence`](http://jscs.info/rule/jsDoc#checkparamexistence)
* New Rule: [`requireReturnDescription`](http://jscs.info/rule/jsDoc#requirereturndescription)
* [`enforceExistence`](http://jscs.info/rule/jsDoc#enforceexistence) add `paramless-procedures` exception
### What's JSCS?
The homepage now showcases what JSCS actually does. We were missing a :cat: picture as well so ...

> If you have any feedback on the site, leave a comment at our [website repo](https://github.com/jscs-dev/jscs-dev.github.io).
### ༼ つ ◕_◕ ༽つ GIVE CST!
We've also been busy working on https://github.com/cst/cst.

CST stands for `Concrete Syntax Tree`, as opposed to AST which stands for `Abstract Syntax Tree`. CST uses a regular AST but adds support for information that you normally don't care about but is vital for a style checker, e.g. spaces, newlines, comments, semicolons, etc. Using a CST will allow us to support more complex autofixing such as adding curly braces while retaining other formatting or much larger transformations.
We just finished supporting all of ES6 this past weekend. [ES6+](https://github.com/cst/cst/issues/39) and [JSX](https://github.com/cst/cst/issues/3) support is also in progress! We'll be integrating CST into JSCS in the [3.0 branch](https://github.com/jscs-dev/node-jscs/tree/3.0), so look out for that soon (CST uses babel as its AST parser).
If you're interested, there was a lot of discussion on CSTs at the [ESTree](https://github.com/estree/estree/issues/41) repo.
---
Hopefully we can get more community help for JSCS! (check out [CONTRIBUTING.md](https://github.com/jscs-dev/node-jscs/blob/master/CONTRIBUTING.md#how-you-can-help) if you're interested)
We have a [`beginner-friendly`](https://github.com/jscs-dev/node-jscs/labels/beginner-friendly) tag for people to get started on issues.
### Small personal sidenote
Thanks to everyone who has been submitting issues/PRs!
It's been almost a year since I (hzoo) really started contributing to open source. It's still crazy to me that my first pull request was just adding the [table of contents](https://github.com/jscs-dev/node-jscs/pull/677). I was so excited to contribute that day!
Little did I know I would slowly do more and more - typo fixes, docs changes, bugfixes, rules, and then eventually become part of the team! I've become a better communicator and become more confident to give and take constructive feedback. I'm currently still figuring out how to review PRs, label issues, do changelogs (like right now), release, etc.
So much has happened after starting that one simple contribution! Even though I know a lot more about ASTs, javascript/node, and programming style, it all adds up to much more than that technical knowledge.
Contributing here helped me make PRs to a lot of other projects (in my case babel, eslint, and others). I understand more that it doesn't take a special person to start helping out. I really hope to encourage others to join our awesome open source community at large!
[hzoo](https://github.com/hzoo)
### Other Awesome Changes!
* CLI: correct `describe` description (Roman Dvornov)
* ClI: move `handleMaxErrors` helper to the more appropriate place (Oleg Gaidarenko)
* CLI: set `maxErrors` to `Infinity` for autoconfigure (Henry Zhu)
* disallowSemicolons: simplify `disallowSemicolons` rule (Oleg Gaidarenko)
* Docs: another portion of changelog fixes (Oleg Gaidarenko)
* Docs: Correct documentation for `requireCapitalizedComments` (Alexander Zeilmann)
* Docs: `disallowParenthesesAroundArrowParam` (Samuel Lindblom)
* Docs: fix markdown for `disallowMultipleSpaces` (Marián Rusnák)
* Docs: fix markdown in `requireBlocksOnNewline` (Marián Rusnák)
* Docs: fix markdown in `requireCapitalizedComments` (Marián Rusnák)
* Docs: fixup broken links (Henry Zhu)
* Docs: improve documentation for various rules (oredi)
* Docs: improve documentation for various rules (oredi)
* Docs: remove unnecessary paragraph, use js syntax highlighting (Dennis Wissel)
* Docs: small changelog corrections (Oleg Gaidarenko)
* Docs: small correction for the `disallowEmptyBlocks` rule (Oleg Gaidarenko)
* js-file: add `getScope` method (Oleg Gaidarenko)
* js-file: add `removeToken` method (Oleg Gaidarenko)
* js-file: all return values should be consistent (Oleg Gaidarenko)
* js-file: check argument of the `file#getNodeRange` (Oleg Gaidarenko)
* js-file: do not interpret html as grit instructions (Oleg Gaidarenko)
* js-file: make grit regexp case-insensitive (Oleg Gaidarenko)
* Misc: add `only` property to `reportAndFix` assert helper (Oleg Gaidarenko)
* Misc: make jslint happy (Oleg Gaidarenko)
* Misc: make lint happy (Oleg Gaidarenko)
* Misc: use node "4" instead of node "4.0" in travis (Henry Zhu)
* Misc: correct code style violations (Oleg Gaidarenko)
* Misc: add node 4.0 to travis (Henry Zhu)
* Misc: autofix tests for rules that are not supported by default presets (Oleg Gaidarenko)
* Misc: change default mocha reporter (Oleg Gaidarenko)
* Misc: disable duplicative jshint check for semicolons (Oleg Gaidarenko)
* Misc: do not show console.error at the test run (Oleg Gaidarenko)
* Misc: increase coverage and use console.error for maxError output (Oleg Gaidarenko)
* Misc: increase rules coverage (Oleg Gaidarenko)
* Misc: use full lodash package (Oleg Gaidarenko)
* Misc: add `requireSemicolons` rule to our jscsrc (Oleg Gaidarenko)
* `requireCapitalizedComments`: remove merge artefacts (Oleg Gaidarenko)
* `*Semicolons`: increase coverage (Oleg Gaidarenko)
* String-checker: pass `file` instance to `_fix` method (Oleg Gaidarenko)
* Strip `BOM` from config files (Jonathan Wilsson)
* Support `null` and `-1` values for `maxErrors` option (Daniel Anechitoaie)
* Tests: improve `reportAndFix` assertion helper (Oleg Gaidarenko)
* Utils: add `isPragma` method (Brian Dixon)
## Version [2.1.1](https://github.com/jscs-dev/node-jscs/compare/v2.1.0...v2.1.1)
### Overview
This release consists mostly of bug-fixes. Check them out – there are a lot of them!
We also managed to squeeze two new rules - [requireSpacesInsideParenthesizedExpression](http://jscs.info/rule/requireSpacesInsideParenthesizedExpression.html) and [disallowSpacesInsideParenthesizedExpression](http://jscs.info/rule/disallowSpacesInsideParenthesizedExpression.html), increase performance, and improve ES6 support.
#### Fix regarding global jscs installs and plugins
One of the biggest issues fixed: a **global** jscs install can finally load **local** extensions (à la gulp style) like error-filters, plugins, additional rules, and presets.
This will fix issues with using a custom preset with something like [SublimeLinter](https://packagecontrol.io/packages/SublimeLinter-jscs) which uses the global jscs install.
- To make a custom preset, you need to publish a npm package with a jscs config file
- We recommend the package name starts with `jscs-preset-` or with `jscs-config-` to help with searching for presets on npm and defining it in your config
- This would allow you to specify your preset more succinctly: `”preset”: “awesome”` instead of `”preset”: “jscs-preset-awesome”`
- You can also share multiple presets in one package with `”preset”: “awesome/super-awesome”`, provided that you have `super-awesome.{json, js}` in your package root directory
- Create a `jscs.json` file to store your jscs config
- In your `package.json`, set the `main` field to `jscs.json`
```js
// example package.json in `jscs-config-awesome`
{
“name”: “jscs-config-awesome”,
“version”: “1.0.0”,
“main”: “jscs.json”
}
// example .jscsrc using a custom preset
// assuming the preset package name is `jscs-config-awesome`
{
“preset”: “awesome”,
“disallowEmptyBlocks”: false // example of disabling a preset rule with false
}
```
We will add more comprehensive documentation for this feature a bit later, so stay tuned.
#### Disable a rule with `false` or `null`
You can use `false` (instead of only `null`) to disable a rule (such as in a preset). This was a point of confusion for newer users. To disable a rule you can do:
```js
{
“preset”: “airbnb”,
“disallowEmptyBlocks”: null // disabling a rule with null
“disallowSpacesInCallExpression”: false // disabling a rule with false
}
```
### New Rules
* New Rule: SpacesInsideParenthesizedExpression (Richard Gibson)
### Enhancements
* Configuration: disable any rule if its value equals to "false” (Oleg Gaidarenko)
### Bug fixes
* requireDollarBeforejQueryAssignment: Ignore destructuring assignment (Simen Bekkhus)
* validateIdentation: fix on empty switch blocks (Henry Zhu)
* disallowQuotedKeysInObjects: fix allowing quoted non-reserved keys (Alexej Yaroshevich)
* disallowParenthesesAroundArrowParam: allow destructuring of param (Henry Zhu)
* requireTrailingComma: correct error message (monk-time)
* requirePaddingNewLinesAfterBlocks: do not report arrow fn chaining (Oleg Gaidarenko)
* safeContextKeyword: miss destructuring assignment (Oleg Gaidarenko)
* disallowNodeTypes: correct configure error (Alexander Zeilmann)
* requireDollarBeforejQueryAssignment: Ignore destructuring assignment (Simen Bekkhus)
* paddingNewlinesInBlocks: add exceptions and open/close options (Kai Cataldo)
* requireS