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

Closed
aSqrd-eSqrd opened this issue May 4, 2021 · 6 comments

Comments

@aSqrd-eSqrd
Copy link

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

@frazie
Copy link

frazie commented Jan 4, 2023

I'd like to help with this issue if it is still open for changes.

@ljharb
Copy link
Collaborator

ljharb commented Jan 4, 2023

This was done in f3d3a07

@ljharb ljharb closed this as completed Jan 4, 2023
@SpraxDev
Copy link
Contributor

SpraxDev commented May 2, 2023

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)

@ljharb
Copy link
Collaborator

ljharb commented May 2, 2023

@SpraxDev you're right; want to send a PR updating that?

@SpraxDev
Copy link
Contributor

SpraxDev commented May 2, 2023

I've created #2768 @ljharb ^^

Binary-Ninja-007 pushed a commit to Binary-Ninja-007/JavaScript_Style_Guide that referenced this issue Aug 13, 2023
The change itself has already been made in f3d3a075cda2acc02011e71991c10bb5b4a15278
(tracked in/acording to airbnb/javascript#2421 (comment)).


#2421
Remove Math.pow from `no-restricted-properties` and use `prefer-exponentiation-operator` instead.
harry908nilson pushed a commit to marcolane/Javascriipt that referenced this issue Sep 1, 2023
The change itself has already been made in f3d3a075cda2acc02011e71991c10bb5b4a15278
(tracked in/acording to airbnb/javascript#2421 (comment)).


#2421
Remove Math.pow from `no-restricted-properties` and use `prefer-exponentiation-operator` instead.
noakosar515 pushed a commit to noakosar515/JavaScript that referenced this issue Sep 14, 2023
The change itself has already been made in f3d3a075cda2acc02011e71991c10bb5b4a15278
(tracked in/acording to airbnb/javascript#2421 (comment)).


#2421
Remove Math.pow from `no-restricted-properties` and use `prefer-exponentiation-operator` instead.
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

5 participants
@ljharb @SpraxDev @frazie @aSqrd-eSqrd and others