Repository: brenolf/polyjuice (js)

Issue:
Add `validateCommentPosition` rule
http://jscs.info/rule/validateCommentPosition

Pull request description:
Resolves #38

Patch:
diff --git a/lib/dictionaries/jscs/validateCommentPosition.js b/lib/dictionaries/jscs/validateCommentPosition.js
new file mode 100644
index 0000000..a0cf868
--- /dev/null
+++ b/lib/dictionaries/jscs/validateCommentPosition.js
@@ -0,0 +1,22 @@
+/**
+* @fileoverview Translation for `validateCommentPosition` (JSCS) to ESLint
+* @author Breno Lima de Freitas <https://breno.io>
+* @copyright 2016 Breno Lima de Freitas. All rights reserved.
+* See LICENSE file in root directory for full license.
+*/
+
+'use strict'
+
+//------------------------------------------------------------------------------
+// Rule Translation Definition
+//------------------------------------------------------------------------------
+
+module.exports = function(__current__, value) {
+  if (value.position === 'beside') {
+    return {
+      'no-inline-comments': 2
+    }
+  }
+
+  return {}
+};


Test patch:
diff --git a/test/dictionaries/jscs/validateCommentPosition.test.js b/test/dictionaries/jscs/validateCommentPosition.test.js
new file mode 100644
index 0000000..0427b01
--- /dev/null
+++ b/test/dictionaries/jscs/validateCommentPosition.test.js
@@ -0,0 +1,34 @@
+/**
+ * @fileoverview Tests for `validateCommentPosition` (JSCS) translation
+ * @author Breno Lima de Freitas <https://breno.io>
+ * @copyright 2016 Breno Lima de Freitas. All rights reserved.
+ * See LICENSE file in root directory for full license.
+ */
+
+'use strict'
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+var lib = require('../../../lib/dictionaries/jscs/validateCommentPosition.js')
+
+var getFn = caller(lib)
+
+describe('jscs#validateCommentPosition', function() {
+  it('converts the rule correctly', function() {
+    var fn = getFn()
+
+    expect(fn({
+      position: 'above',
+      allExcept: ['pragma']
+    })).to.be.empty
+
+    expect(fn({
+      position: 'beside',
+      allExcept: ['pragma']
+    })).to.eql({
+      'no-inline-comments': 2
+    })
+  })
+})