disallowArrowFunctions

Disallows arrow functions.

Why enable this rule? Arrow functions might cause more problems than they solve:

  • Object-orientation may be better without ECMAScript's this.
  • You can't name an arrow function.
  • Arrow functions' syntax can cause maintenance issues; see disallowShorthandArrowFunctions.
  • Arrow functions shouldn't be used on prototypes, as objects' methods, as event listeners, or as anything polymorhpic- or mixin-related. See here.

Type: Boolean

Value: true

Version: ES6

Example

"disallowArrowFunctions": true
Valid
// function expression in a callback
[1, 2, 3].map(function (x) {
    return x * x;
});
Invalid
// arrow function
[1, 2, 3].map((x) => {
    return x * x;
});
Rule source
Test source