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

[ban-types] support banning `[]` #2582

Closed
papb opened this issue Sep 19, 2020 · 0 comments
Closed

[ban-types] support banning `[]` #2582

papb opened this issue Sep 19, 2020 · 0 comments

Comments

@papb
Copy link
Contributor

@papb papb commented Sep 19, 2020

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/ban-types": [
      "error",
      {
        "extendDefaults": true,
        "types": {
          "[]": "Don't use the empty array type `[]`, it will only allow empty arrays. Use `SomeType[]` instead.",
          "[[]]": "Don't use `[[]]`, it would only allow an array with a single element which is an empty array. Use `SomeType[][]` instead.",
          "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead."
        }
      }
    ]
  }
}
type X = [];
// tsconfig.json
{
	"compilerOptions": {
		"module": "commonjs",
		"strict": true,
		"target": "es2017",
		"outDir": "./dist",
	}
}

Expected Result

The custom ban to work

Actual Result

No errors

Additional Info

None

Versions

package version
@typescript-eslint/eslint-plugin 3.10.1
@typescript-eslint/parser 3.10.1
TypeScript 4.0.2
ESLint 7.9.0
node 12.18.0
bradzacher pushed a commit that referenced this issue Oct 25, 2020
Jonas
fix #2582
This was referenced Oct 26, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.