Skip to content

[no-implied-eval] False positive with callback: Function #2358

Closed
@tosmolka

Description

@tosmolka

Repro

module.exports = {
    "env": {
        "browser": true,
        "es2020": true
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": 11,
        "sourceType": "module",
        "project": "tsconfig.json"
    },
    "plugins": [
        "@typescript-eslint"
    ],
    "rules": {
        "@typescript-eslint/no-implied-eval": "error"
    }
};
const foo = (callback: Function) => {
    setTimeout(callback, 0);
};

Expected Result
ESLint detects 0 problems

Actual Result
2:16 error Implied eval. Consider passing a function @typescript-eslint/no-implied-eval

✖ 1 problem (1 error, 0 warnings)

Additional Info

Handler argument is parsed as Identifier but isFunctionType() returns for it false.

Versions

package version
@typescript-eslint/eslint-plugin 3.8.0
@typescript-eslint/parser 3.8.0
TypeScript 3.9.7
ESLint 7.6.0
node 14.6.0
npm 6.14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions