Closed scottohara closed 5 years ago
What version of ESLint are you using? 5.11.1
What version of TypeScript are you using? 3.1.1
What version of typescript-eslint-parser are you using? Any version from 20.1.0 onwards
typescript-eslint-parser
What code were you trying to parse?
{ "parser": "typescript-eslint-parser", "rules": { "no-magic-numbers": "error" } }
type Amount = 10 | -10; const amount: Amount = 10;
What did you expect to happen? No errors
What happened? In typescript-eslint-parser@20.0.0, code passes with no errors.
typescript-eslint-parser@20.0.0
With typescript-eslint-parser@20.1.0 onwards, the errors below occur:
typescript-eslint-parser@20.1.0
1:15 error No magic number: 10 no-magic-numbers 1:20 error No magic number: -10 no-magic-numbers
The magic numbers that the rule is complaining about are the allowed values of the Typescript numeric literal type type Amount = 10 | -10.
type Amount = 10 | -10
I'm not aware of any way to define a numeric literal type that doesn't violate the magic numbers rule?
issue is solved in #584
584 turned into #596 and has been merged
What version of ESLint are you using? 5.11.1
What version of TypeScript are you using? 3.1.1
What version of
typescript-eslint-parser
are you using? Any version from 20.1.0 onwardsWhat code were you trying to parse?
What did you expect to happen? No errors
What happened? In
typescript-eslint-parser@20.0.0
, code passes with no errors.With
typescript-eslint-parser@20.1.0
onwards, the errors below occur:The magic numbers that the rule is complaining about are the allowed values of the Typescript numeric literal type
type Amount = 10 | -10
.I'm not aware of any way to define a numeric literal type that doesn't violate the magic numbers rule?