I am currently using eslint func-names
.
What I want to achieve is as follow. Note that I do not want to use arrow function to mitigate the issue on (2).
How can this be configure?
// 1: Error unamed on es-lint (correct)
var foo = function () {};
// 4: No error (correct)
var foo = function foo() {};
// 2: Unexpected unamed function
// i want eslint ignore this unamed error completely for such usage of function
// Do not want to replace with arrow function
callbackFunction.then(function (res) { return res; });
array.map(function (o) { return o * 2} );
I do not see the justification where the eslint
allows arrow function to pass the checking but not otherwise, since both (2) and (3) are also anonymous function. Glad if anyone can justified the reasoning behind as well.
// 3: No error
callbackFunction.then((res) => { return res; });
array.map(o => o * 2);