Closed
Description
- 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/no-magic-numbers": [
"error",
{ "ignoreArrayIndexes": true }
],
}
}
type Foo = ["bar", "baz"];
function foo(bar: string, baz: number) {}
// No magic number: 1. eslint(@typescript-eslint/no-magic-numbers)
type Oof1 = Foo[1];
// No magic number: 1. eslint(@typescript-eslint/no-magic-numbers)
type Oof2 = Parameters<typeof foo>[1];
Expected Result
I expect the array index access to be ignored.
Actual Result
No magic number: 1. eslint(@typescript-eslint/no-magic-numbers)
Additional Info
An alternative would be to add an additional option for this if you don’t think it should be covered under “ignoreArrayIndexes”.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
5.17.0 |
@typescript-eslint/parser |
5.17.0 |
TypeScript |
4.6.3 |
ESLint |
8.12.0 |
node |
17.8.0 |