Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

mathPowToExponentiation rewrites computed Math[pow] callees and drops parentheses

Open Beginner friendly
#257 0 comments 0 reactions 0 assignees View on GitHub

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from codingjoe/esupgrade

All issues in codingjoe/esupgrade

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.