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

New: Add prefer-exponentiation-operator rule (fixes #10482) #12360

Merged
merged 2 commits into from Nov 1, 2019

Conversation

@mdjermanovic
Copy link
Member

mdjermanovic commented Oct 2, 2019

What is the purpose of this pull request? (put an "X" next to item)

[X] New rule #10482

Examples of incorrect code for this rule:

/*eslint prefer-exponentiation-operator: "error"*/

const foo = Math.pow(2, 8);

const bar = Math.pow(a, b);

let baz = Math.pow(a + b, c + d);

let quux = Math.pow(-1, n);

Examples of correct code for this rule:

/*eslint prefer-exponentiation-operator: "error"*/

const foo = 2 ** 8;

const bar = a ** b;

let baz = (a + b) ** (c + d);

let quux = (-1) ** n;

What changes did you make? (Give an overview)

New prefer-exponentiation-operator rule with the autofix.

Is there anything you'd like reviewers to focus on?

  • The category should be "Stylistic Issues"?
  • Should the autofix add spaces around **?
@eslint eslint bot added the triage label Oct 2, 2019
@mdjermanovic mdjermanovic added accepted feature rule and removed triage labels Oct 2, 2019
Copy link
Member

mysticatea left a comment

LGTM, thank you!

Copy link
Member

platinumazure left a comment

Looks good!

No need to worry about space around the exponentiation operator: that responsibility probably belongs to space-infix-ops.

Copy link
Member

kaicataldo left a comment

LGTM, thanks!

@kaicataldo kaicataldo merged commit de65de6 into master Nov 1, 2019
16 checks passed
16 checks passed
Verify Files
Details
Test (ubuntu-latest, 8.x)
Details
Test (ubuntu-latest, 10.x)
Details
Test (ubuntu-latest, 12.x)
Details
Test (windows-latest, 12.x)
Details
Test (macOS-latest, 12.x)
Details
Browser Test
Details
commit-message PR title follows commit message guidelines
Details
continuous-integration Build #20191002.8 succeeded
Details
continuous-integration (Test on Node.js 10 (Linux)) Test on Node.js 10 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Linux)) Test on Node.js 12 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Windows)) Test on Node.js 12 (Windows) succeeded
Details
continuous-integration (Test on Node.js 12 (macOS)) Test on Node.js 12 (macOS) succeeded
Details
continuous-integration (Test on Node.js 8 (Linux)) Test on Node.js 8 (Linux) succeeded
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
@kaicataldo kaicataldo deleted the prefer-exponentiation branch Nov 1, 2019
@eslint eslint bot locked and limited conversation to collaborators May 1, 2020
@eslint eslint bot added the archived due to age label May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.