javascript
javascript copied to clipboard
Remove Math.pow from `no-restricted-properties` and use `prefer-exponentiation-operator` instead.
Since ESlint has the helpful prefer-exponentiation-operator
rule it would be nice if Math.pow
was removed from the no-restricted-properties
definitions in rules/best-practices.js
in favor of the prefer-exponentiation-operator
rule.
This has the benefit to us stubborn folks who want to use the eslint-config-airbnb
or eslint-config-airbnb-base
packages but want to override the rule to allow the use of Math.pow
. The no-restricted-properties
ESlint rule can't be selectively modified, eslint/eslint#7957. It has to be completely duplicated and the desired change made in the duplicate. The Math.pow
entry in no-restricted-properties
doesn't really fit in with the "intent" of the other entries in the no-restricted-propertiesobjects and since the
prefer-exponentiation-operator` rule exist it is a neat and tidy modification.
Thank you, aSqrd-eSqrd
That was added in eslint v6.7, and indeed, we will enable it when eslint 5 is dropped: https://github.com/airbnb/javascript/blob/1eadb93e377da1e56c3f91f26610e5d0a00738a9/packages/eslint-config-airbnb-base/rules/style.js#L444
I'd like to help with this issue if it is still open for changes.
This was done in f3d3a075c
This was done in f3d3a07
It looks like the README.md has not been updated yet to reflect that change (https://github.com/airbnb/javascript#es2016-properties--exponentiation-operator)
@SpraxDev you're right; want to send a PR updating that?
I've created #2768 @ljharb ^^