close
The Wayback Machine - https://web.archive.org/web/20220820081832/https://github.com/airbnb/javascript/issues/2421
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

Remove Math.pow from no-restricted-properties and use prefer-exponentiation-operator instead. #2421

Open
aSqrd-eSqrd opened this issue May 4, 2021 · 1 comment

Comments

@aSqrd-eSqrd
Copy link

aSqrd-eSqrd commented May 4, 2021

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 theprefer-exponentiation-operator` rule exist it is a neat and tidy modification.

Thank you,
aSqrd-eSqrd

@ljharb
Copy link
Collaborator

ljharb commented May 4, 2021

That was added in eslint v6.7, and indeed, we will enable it when eslint 5 is dropped:

// TODO: enable, semver-major when eslint 5 is dropped

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

No branches or pull requests

3 participants
@ljharb @aSqrd-eSqrd and others