Open Conaclos opened 1 month ago
@fellipeutaka Could you add a comment on this task. I am not able to assign you to the task if you don't participate here.
@fellipeutaka Could you add a comment on this task. I am not able to assign you to the task if you don't participate here.
Oh, sorry. I'm ready to contribute to this task :)
Oh, sorry. I'm ready to contribute to this task :)
No problem. I was not aware of this limitation on GitHub ^^ I guess this is to avoid assigning a wrong person.
Description
Implement eslint/no-magic-numbers and typescript-eslint/no-magic-numbers.
Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.
See the related discussion for context.
The ESLint rule has many options. I suggest implementing a single option
ignoreIntegers
(See theOptions
section) for the time being.Here are the exceptions we should bake in:
ignore assignment to constant-like variables, i.e.
const
,var
, and static class propertiesIgnore common numbers We should always ignore
0
/0n
/0.
, and maybe2
/2n
,1
/1n
, and-1
/-1n
.Should we ignore more integers?
Ignore integer indexing (corresponds setting ESLints'
ignoreArrayIndexes
andignoreTypeIndexes
totrue
)Ignore integer Enum values (corresponds setting ESLint's
ignoreEnums
totrue
)ignore numeric types (corresponds setting ESLint's
ignoreNumericLiteralTypes
totrue
)Ignore integer binary operations
Others?
Options
We could introduce an
ignoreIntegers
option (turned off by default). When the option is set to true, all integers values are ignored: