[no-magic-numbers] - Add an option to omit numbers check in array declaration
See original GitHub issueWhat rule do you want to change? no-magic-numbers Does this change cause the rule to produce more or fewer warnings? less How will the change be implemented? (New option, new default behavior, etc.)? new option to skip showing error Please provide some example code that this change will affect:
const arr = [0, 1, 2];
also here - https://github.com/eslint/eslint/issues/11383 What does the rule currently do for this code? shows error What will the rule do after it’s changed? not show error Are you willing to submit a pull request to implement this change? nope
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (6 by maintainers)
Top Results From Across the Web
no-magic-numbers - ESLint - Pluggable JavaScript Linter
'Magic numbers' are numbers that occur multiple times in code without an explicit meaning. They should preferably be replaced by named constants.
Read more >no-magic-numbers - TypeScript ESLint
See eslint/no-magic-numbers options. This rule adds the following options: interface Options extends BaseNoMagicNumbersOptions { ignoreEnums?: boolean;
Read more >eslint no-magic-numbers rule can't ignore checking number ...
I'm new to eslint. With "no-magic-numbers" rule turned on, declare an array with number literal can't be ignored.eg. let array = [1, 2,...
Read more >no-magic-numbers - Rule
Rule: no-magic-numbers Disallows the use constant number values outside of variable assignments. When no list of allowed values is specified, -1, 0 and...
Read more >Replace Magic Number with Symbolic Constant
Declare a constant and assign the value of the magic number to it. · Find all mentions of the magic number. · For...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still me and my team would like to have an option for arrays as I initially requested.
This case being reported does feel like a bug to me, because these are named. I agree it would be nice to update this rule to check for hard-coded numbers that are assigned using destructuring (both array and object).