mdevils/node-jscs — pull request #336 by angryzor (2014-04-14 10:57:03+00:00)
Title: Function expressions ignore getters and setters

Added a check to the following rules:

* disallow-spaces-in-anonymous-function-expression
* disallow-spaces-in-function-expression
* require-spaces-in-anonymous-function-expression
* require-spaces-in-function-expression

These rules erroneously interpreted setter and getter expressions like
these as full function expressions:

{
get x () {
},
set x (v) {
}
}

This made it impossible to run jscs on JS code that used these constructs,
as it threw false errors whenever it encountered them.

The bug was caused by the fact that esprima actually registers these constructs as
functions assigned to a property with the special kinds 'set' and 'get'.
This patch checks the parent node of the function expression against these
special kinds in order to ignore the special getter and setter constructs.

Tests for this condition were also added for the following rules:

* disallow-spaces-in-anonymous-function-expression
* disallow-spaces-in-function-expression
* disallow-spaces-in-named-function-expression
* require-spaces-in-anonymous-function-expression
* require-spaces-in-function-expression
* require-spaces-in-named-function-expression

The named function expression rules did not need to be patched
because these constructs never generate named functions.

Fixes #69