-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Hi there,
ReadonlyArray is regarded as Array in array-type
rule. Similarly, readonly T[] is regarded to be the same as T[].
- 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
Here is an example of 'array'
.
{
"rules": {
'@typescript-eslint/array-type': ['error', {
default: 'array',
readonly: 'array', // 'array' | 'generic' | 'array-simple'
}],
}
}
const foo: ReadonlyArray<string> = [];
Expected Result
4:12 error Array type using 'ReadonlyArray<string>' is forbidden. Use 'readonly string[]' instead @typescript-eslint/array-type
Actual Result
4:12 error Array type using 'Array<string>' is forbidden. Use 'string[]' instead @typescript-eslint/array-type
Additional Info
#4066
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
5.2.0 |
@typescript-eslint/parser |
5.2.0 |
TypeScript |
4.4.4 |
ESLint |
8.1.0 |
node |
16.13.0 |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomerspackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin