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
3 tasks done
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@papb
Copy link
Contributor

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
@papb papb added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Sep 19, 2020
@bradzacher bradzacher added enhancement: plugin rule option New rule option for an existing eslint-plugin rule and removed triage Waiting for maintainers to take a look labels Sep 19, 2020
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.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
2 participants