microsoft/tslint-microsoft-contrib

Rule "no-function-expression" shall pass on named function expressions.

negin-z opened this issue · 1 comments

Bug Report

  • tslint-microsoft-contrib version "5.1.0"
  • TSLint version "5.11.0"
  • TypeScript version "3.2.1"
  • Running TSLint via: CLI

TypeScript code being linted

protected traverseTree() {
        const rootObjects = this.objects();
        // Arrow function cannot replace the following named function expression.
        rootObjects.forEach(function doSomthing(o: ObjectType) {
            o.processNode();
            o.children.forEach(doSomthing);
        });
    }

Actual behavior

ERROR: (no-function-expression) /path/to/code[x, y]: Use arrow function instead of function expression

Expected behavior

tslint passes

The need for recursive call is a legit case of preferring named function expression against arrow functions.

☠️ It's time! ☠️

Per #876, this repository is no longer accepting feature pull requests. TSLint is being deprecated and we recommend you switch to https://typescript-eslint.io.

Thanks for open sourcing with us, everyone!