Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
New Rule: prefer-exponentiation-operator #10482
Please describe what the rule should do:
ES2016 adds an exponentiation operator
What category of rule is this? (place an "X" next to just one item)
[ ] Enforces code style
Provide 2-3 code examples that this rule will warn about:
// Good const a = 5 ** 7 // Bad const a = Math.pow(5, 7)
Why should this rule be included in ESLint (instead of a plugin)?
This is a ES2016 feature, which can replace an older way of doing things. There should be a rule to force upgrading code; similar to how ESLint has
I don't know is it relevant for the decision to implement the rule, but it seems that the bug hasn't been fixed yet:
I'm working on this.
From the specification, it seems that the only difference is when both arguments evaluate to bigint, as
Re the autofix, I think it's an acceptable change in behavior