no-magic-numbers
Configuration
rslint.config.ts
Rule Details
Disallow magic numbers. A "magic number" is a numeric literal that is used in the code without explanation or assignment to a named constant. Magic numbers make code less readable and harder to maintain.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Examples of correct code for this rule with { "ignoreEnums": true }:
Examples of correct code for this rule with { "ignoreNumericLiteralTypes": true }:
Examples of correct code for this rule with { "ignoreReadonlyClassProperties": true }:
Examples of correct code for this rule with { "ignoreTypeIndexes": true }:
Original Documentation
ESLint - no-magic-numbers typescript-eslint - no-magic-numbers