Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@typescript-eslint/no-magic-numbers] enum's are treated as "magic numbers" #573

Closed
radical-edo opened this issue May 29, 2019 · 3 comments · Fixed by #543
Closed

[@typescript-eslint/no-magic-numbers] enum's are treated as "magic numbers" #573

radical-edo opened this issue May 29, 2019 · 3 comments · Fixed by #543
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@radical-edo
Copy link

Repro

    'no-magic-numbers': 'off',
    '@typescript-eslint/no-magic-numbers': ['error', { ignoreNumericLiteralTypes: true }],

Repro

enum HttpStatus {
  Ok = 200
}

Expected Result
Don't treat it as a magic number. It will be used in the code somewhere as HttpStatus.Ok that's definitely a defined number.

Actual Result
The value 200 is treated as a magic number. Probably because to define a different starting point for enum is to use = which confuses linter.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.9.0
@typescript-eslint/parser 1.9.0
TypeScript 3.3.3333
ESLint 5.16.0
node 10.15.3
npm 6.4.1
@radical-edo radical-edo added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels May 29, 2019
@bradzacher bradzacher added enhancement: plugin rule option New rule option for an existing eslint-plugin rule has pr there is a PR raised to close this and removed triage Waiting for maintainers to take a look labels May 29, 2019
@bradzacher
Copy link
Member

See #543

@radical-edo
Copy link
Author

Sweetness, can't wait to be merged.

@evgeniy-bond
Copy link

I am waiting for this merged too

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants