mathPowToExponentiation rewrites computed Math[pow] callees and drops parentheses
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- tooling
Research direction
Read AGENTS.md and the mathPowToExponentiation transformer, especially its .find() pattern and argument-count filter. Add the computed Math[pow] rejection and tests covering both Math[pow](a, b) rejection and plain Math.pow acceptance; done means the computed call remains unchanged without parentheses issues.
Written by the indexing model from the issue text.
Description
Summary
mathPowToExponentiation matches calls by structural shape only, so a computed callee counts as Math.pow:
Math.pow(Math[pow](a, b), 2);
The .find() pattern (object: { name: "Math" }, property: { name: "pow" }) matches the computed member, and the filter only checks the argument count. The transformer rewrites the call even though Math[pow] is a dynamic property lookup, not Math.pow — which breaks the package's own rule that transformers only apply to statically verifiable types (AGENTS.md).
Actual
a ** b ** 2; // a ** (b ** 2), not (a ** b) ** 2
The parens came from isMathPow(base), which used to accept computed members too. After the guard dedupe on this branch it delegates to NodeTest#isMethodCall, which correctly rejects computed — so the base is no longer parenthesized while the inner call is still rewritten in the same pass. The narrowing is right; the find pattern is the bug.
Expected
The call is left alone, or at minimum Math[pow](a, b) is not treated as Math.pow:
Math.pow(Math[pow](a, b), 2);
Suggested fix
Reject computed callees in the filter, next to the argument-count check:
.filter((path) => !path.node.callee.computed && path.node.arguments.length === 2)
Add a test for Math[pow](a, b) (and a // @ts-expect-error-free plain Math.pow case) so the accept/reject set is pinned.
Context
Found while mapping the bloat-audit cut on this branch with inspectorJoe: real: bug … bet: 9/10 cooked: 2/10. Pre-existing on main — the old inline guard had no !computed check either — and the cut only makes one shape (base is a computed Math[pow] call) lose its parentheses.
- Dominant language
- JavaScript
- Stars
- 15
- Forks
- 2
- Avg merge
- 2h 53m
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from codingjoe/esupgrade
-
widely available
Difficulty 3/5 1-2 days Newbie friendliness 72/100
codingjoe/esupgrade#217 · 1 comment ·
Maintainers usually reply within 1 day
-
newly available
Difficulty 3/5 1-2 days Newbie friendliness 66/100
codingjoe/esupgrade#211 · 1 comment ·
Maintainers usually reply within 1 day
-
widely available
Difficulty 3/5 1-2 days Newbie friendliness 72/100
codingjoe/esupgrade#212 · 1 comment ·
Maintainers usually reply within 1 day
-
widely available
Difficulty 3/5 1-2 days Newbie friendliness 68/100
codingjoe/esupgrade#213 · 1 comment ·
Maintainers usually reply within 1 day
-
widely available
Difficulty 3/5 1-2 days Newbie friendliness 69/100
codingjoe/esupgrade#215 · 1 comment ·
Maintainers usually reply within 1 day
All issues in codingjoe/esupgrade
Similar issues
-
check:failed feeds:add
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
iptv-org/database#36278 · 1 comment ·
Maintainers usually reply within 3 days
-
fix
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
idean3885/claude-ops-agent#577 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 7 days
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
notionnext-org/NotionNext#4544 ·
Maintainers usually reply within 1 day