#21319·eslint

Bug: prefer-exponentiation-operator autofix produces invalid syntax for an async function expression

Author: torjan0Created Sep 13, 2026Updated Sep 13, 2026
Labelsbugruleacceptedautofixrepro:yes

Environment

ESLint 10.10.0 and main commit 45ad79e54a39b54b4ce8eb47e612bd2f72a7a651; Node 22.23.2; Ubuntu.

Parser

Default (Espree).

What did you do?

javascript
const { Linter } = require("eslint");
const code = "Math.pow(async function handler(first, second) {}.length, 2);";
const result = new Linter().verifyAndFix(code, {
  languageOptions: { ecmaVersion: 2022, sourceType: "script" },
  rules: { "prefer-exponentiation-operator": "error" }
});
console.log(result);

What did you expect?

A syntactically valid fix preserving the input's result of 4.

What actually happened?

verifyAndFix() returns fixed: true with this output and a fatal Parsing error: Unexpected token . diagnostic:

javascript
async function handler(first, second) {}.length**2;

The equivalent synchronous function expression is correctly parenthesized. CLI file writes were not tested.

Link to Minimal Reproducible Example

ESLint Playground

AI acknowledgment

GPT-6 Astra assisted; I manually reviewed this report.