2 title: no-arrow-condition
8 - no-constant-condition
11 Disallows arrow functions where test conditions are expected.
13 (removed) This rule was **removed** in ESLint v2.0 and **replaced** by a combination of the [no-confusing-arrow](no-confusing-arrow) and [no-constant-condition](no-constant-condition) rules.
15 Arrow functions (`=>`) are similar in syntax to some comparison operators (`>`, `<`, `<=`, and `>=`). This rule warns against using the arrow function syntax in places where a condition is expected. Even if the arguments of the arrow function are wrapped with parens, this rule still warns about it.
17 Here's an example where the usage of `=>` is most likely a typo:
20 // This is probably a typo
22 // And should instead be
26 There are also cases where the usage of `=>` can be ambiguous and should be rewritten to more clearly show the author's intent:
29 // The intent is not clear
30 var x = a => 1 ? 2 : 3
31 // Did the author mean this
32 var x = function (a) { return a >= 1 ? 2 : 3 }
34 var x = a <= 1 ? 2 : 3
39 Examples of **incorrect** code for this rule:
44 /*eslint no-arrow-condition: "error"*/
49 for (var a = 1; a => 10; a++) {}
52 var x = a => 1 ? 2 : 3
53 var x = (a) => 1 ? 2 : 3