From 04ebef34d29acdd8f2878c272974a87ab604cd18 Mon Sep 17 00:00:00 2001 From: Christoph Werner Date: Thu, 23 Jun 2016 15:07:09 +0200 Subject: [PATCH] Update: Fix #226, adjust `space-infix-ops` Test fails and i have no clue how i'm supposed to add `babel-eslint` to the testing stack for single tests. --- lib/rules/space-infix-ops.js | 4 ++++ tests/lib/rules/space-infix-ops.js | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/rules/space-infix-ops.js b/lib/rules/space-infix-ops.js index bea82ba0b65..0c2bed3c040 100644 --- a/lib/rules/space-infix-ops.js +++ b/lib/rules/space-infix-ops.js @@ -106,6 +106,10 @@ module.exports = { * @private */ function checkBinary(node) { + if (node.left.typeAnnotation) { + return; + } + var nonSpacedNode = getFirstNonSpacedToken(node.left, node.right); if (nonSpacedNode) { diff --git a/tests/lib/rules/space-infix-ops.js b/tests/lib/rules/space-infix-ops.js index c17fc22d61b..a8a3099e2c7 100644 --- a/tests/lib/rules/space-infix-ops.js +++ b/tests/lib/rules/space-infix-ops.js @@ -29,6 +29,7 @@ ruleTester.run("space-infix-ops", rule, { { code: "const my_object = {key: 'value'};", parserOptions: { ecmaVersion: 6 } }, { code: "var {a = 0} = bar;", parserOptions: { ecmaVersion: 6 } }, { code: "function foo(a = 0) { }", parserOptions: { ecmaVersion: 6 } }, + { code: "function foo(a: number = 0) { }", parserOptions: { ecmaVersion: 6 } }, { code: "a ** b", parserOptions: { ecmaVersion: 7 } }, { code: "a|0", options: [{ int32Hint: true }] }, { code: "a |0", options: [{ int32Hint: true }] }