Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

no-magic-number regression starting with v20.1.0 #588

Closed
scottohara opened this issue Dec 28, 2018 · 2 comments
Closed

no-magic-number regression starting with v20.1.0 #588

scottohara opened this issue Dec 28, 2018 · 2 comments
Labels

Comments

@scottohara
Copy link

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

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 [email protected], code passes with no errors.

With [email protected] onwards, the errors below occur:

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.

I'm not aware of any way to define a numeric literal type that doesn't violate the magic numbers rule?

@armano2
Copy link
Contributor

armano2 commented Dec 28, 2018

issue is solved in #584

@JamesHenry
Copy link
Member

584 turned into #596 and has been merged

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants