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, 3]; I looked up eslint's documentation and can't find a way to ignore this case.So I must turn off "no-magic-numbers" rule,am I right?Thx in advance.
Turning of a complete rule to fix one error is not a good idea.
If its just one case you can deactivate this rule for just one line like:
// eslint-disable-next-line no-magic-numbers
let array = [1, 2, 3];
If you don't like the idea of that rule in general you off course can turn it off completely. Have a look at the documentation to get a better overview: https://eslint.org/docs/rules/no-magic-numbers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With