Repository: brenolf/polyjuice (js)

Issue:
Add `ArrowFunctions` rules
* http://jscs.info/rule/disallowArrowFunctions
* http://jscs.info/rule/requireArrowFunctions

Pull request description:
Resolves #32

Patch:
diff --git a/lib/dictionaries/jscs.js b/lib/dictionaries/jscs.js
index b13ea30..ff0b0b3 100644
--- a/lib/dictionaries/jscs.js
+++ b/lib/dictionaries/jscs.js
@@ -781,6 +781,17 @@ module.exports = {
 
   'requireArrowFunctions': 'prefer-arrow-callback',
 
+  'disallowArrowFunctions': {
+    name: 'no-restricted-syntax',
+    truthy: function () {
+      var attrs = this.value || []
+
+      attrs.push('ArrowFunctionExpression')
+
+      return attrs
+    }
+  },
+
   'requireSpaceBeforePostfixUnaryOperators': {
     name: 'space-unary-ops',
     truthy: [2, { words: true, nonwords: true }]


Test patch:
diff --git a/test/dictionaries/jscs.test.js b/test/dictionaries/jscs.test.js
index f45d2fe..7be3461 100644
--- a/test/dictionaries/jscs.test.js
+++ b/test/dictionaries/jscs.test.js
@@ -612,4 +612,16 @@ describe('jscs', function () {
       }
     }])
   })
+
+  it('converts disallowArrowFunctions correctly', function () {
+    var fn = getFn('disallowArrowFunctions')
+
+    var fnBound = getFn('disallowArrowFunctions', [
+      'A', 'B'
+    ])
+
+    expect(fn('CLRF')).to.eql(['ArrowFunctionExpression'])
+
+    expect(fnBound('LF')).to.eql(['A', 'B', 'ArrowFunctionExpression'])
+  })
 })