Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
snebjorn opened this issue Apr 13, 2020 · 1 comment
Closed

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

snebjorn opened this issue Apr 13, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@snebjorn
Copy link

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
@snebjorn snebjorn added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Apr 13, 2020
@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Apr 13, 2020
@bradzacher
Copy link
Member

See discussion on #848

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants