Skip to content

[@typescript-eslint/ban-types] Function is not banned by default #1896

Closed
@snebjorn

Description

@snebjorn

Repro

{
  "rules": {
    "@typescript-eslint/ban-types": ["error"]
  }
}
function isFunction(value: any): value is Function {
  return typeof value === 'function';
}

Expected Result

The tslint:recommended ruleset for ban-types includes Function
https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts#L23

So I would expect it to be the same in @typescript-eslint/recommended.
I was unable to find any issues about it being intentionally removed.

Actual Result

Function type usage is not banned

Additional Info

To match TSLint I have to do this

"@typescript-eslint/ban-types": [
  "error",
  {
    "types": { 
      "Function": { 
        "message": "Prefer a specific function type, like `() => void`." 
      } 
    }
  }
]

Versions

package version
@typescript-eslint/eslint-plugin 2.27.0
@typescript-eslint/parser 2.27.0
TypeScript 3.8.3
ESLint 6.8.0
node 13.12.0
npm X.Y.Z
yarn 1.22.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existspackage: 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