--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalidUnaryExpression.js --- # Input ```jsx // unary expressions are exception by the language - parens are required for the base to disambiguate operator precedence Math.pow(+a, b) Math.pow(a, +b) Math.pow(-a, b) Math.pow(a, -b) Math.pow(-2, 3) Math.pow(2, -3) async () => Math.pow(await a, b) async () => Math.pow(a, await b) ``` # Diagnostics ``` invalidUnaryExpression.js:2:1 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 1 │ // unary expressions are exception by the language - parens are required for the base to disambiguate operator precedence > 2 │ Math.pow(+a, b) │ ^^^^^^^^^^^^^^^ 3 │ Math.pow(a, +b) 4 │ Math.pow(-a, b) i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 1 1 │ // unary expressions are exception by the language - parens are required for the base to disambiguate operator precedence 2 │ - Math.pow(+a,·b) 2 │ + (+a)·**·b 3 3 │ Math.pow(a, +b) 4 4 │ Math.pow(-a, b) ``` ``` invalidUnaryExpression.js:3:1 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 1 │ // unary expressions are exception by the language - parens are required for the base to disambiguate operator precedence 2 │ Math.pow(+a, b) > 3 │ Math.pow(a, +b) │ ^^^^^^^^^^^^^^^ 4 │ Math.pow(-a, b) 5 │ Math.pow(a, -b) i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 1 1 │ // unary expressions are exception by the language - parens are required for the base to disambiguate operator precedence 2 2 │ Math.pow(+a, b) 3 │ - Math.pow(a,·+b) 3 │ + a·**·+b 4 4 │ Math.pow(-a, b) 5 5 │ Math.pow(a, -b) ``` ``` invalidUnaryExpression.js:4:1 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 2 │ Math.pow(+a, b) 3 │ Math.pow(a, +b) > 4 │ Math.pow(-a, b) │ ^^^^^^^^^^^^^^^ 5 │ Math.pow(a, -b) 6 │ Math.pow(-2, 3) i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 2 2 │ Math.pow(+a, b) 3 3 │ Math.pow(a, +b) 4 │ - Math.pow(-a,·b) 4 │ + (-a)·**·b 5 5 │ Math.pow(a, -b) 6 6 │ Math.pow(-2, 3) ``` ``` invalidUnaryExpression.js:5:1 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 3 │ Math.pow(a, +b) 4 │ Math.pow(-a, b) > 5 │ Math.pow(a, -b) │ ^^^^^^^^^^^^^^^ 6 │ Math.pow(-2, 3) 7 │ Math.pow(2, -3) i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 3 3 │ Math.pow(a, +b) 4 4 │ Math.pow(-a, b) 5 │ - Math.pow(a,·-b) 5 │ + a·**·-b 6 6 │ Math.pow(-2, 3) 7 7 │ Math.pow(2, -3) ``` ``` invalidUnaryExpression.js:6:1 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 4 │ Math.pow(-a, b) 5 │ Math.pow(a, -b) > 6 │ Math.pow(-2, 3) │ ^^^^^^^^^^^^^^^ 7 │ Math.pow(2, -3) 8 │ async () => Math.pow(await a, b) i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 4 4 │ Math.pow(-a, b) 5 5 │ Math.pow(a, -b) 6 │ - Math.pow(-2,·3) 6 │ + (-2)·**·3 7 7 │ Math.pow(2, -3) 8 8 │ async () => Math.pow(await a, b) ``` ``` invalidUnaryExpression.js:7:1 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 5 │ Math.pow(a, -b) 6 │ Math.pow(-2, 3) > 7 │ Math.pow(2, -3) │ ^^^^^^^^^^^^^^^ 8 │ async () => Math.pow(await a, b) 9 │ async () => Math.pow(a, await b) i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 5 5 │ Math.pow(a, -b) 6 6 │ Math.pow(-2, 3) 7 │ - Math.pow(2,·-3) 7 │ + 2·**·-3 8 8 │ async () => Math.pow(await a, b) 9 9 │ async () => Math.pow(a, await b) ``` ``` invalidUnaryExpression.js:8:13 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 6 │ Math.pow(-2, 3) 7 │ Math.pow(2, -3) > 8 │ async () => Math.pow(await a, b) │ ^^^^^^^^^^^^^^^^^^^^ 9 │ async () => Math.pow(a, await b) 10 │ i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 6 6 │ Math.pow(-2, 3) 7 7 │ Math.pow(2, -3) 8 │ - async·()·=>·Math.pow(await·a,·b) 8 │ + async·()·=>·(await·a)·**·b 9 9 │ async () => Math.pow(a, await b) 10 10 │ ``` ``` invalidUnaryExpression.js:9:13 lint/style/useExponentiationOperator FIXABLE ━━━━━━━━━━━━━━━━━━━━━━ ! Use the '**' operator instead of 'Math.pow'. 7 │ Math.pow(2, -3) 8 │ async () => Math.pow(await a, b) > 9 │ async () => Math.pow(a, await b) │ ^^^^^^^^^^^^^^^^^^^^ 10 │ i Unsafe fix: Use the '**' operator instead of 'Math.pow'. 7 7 │ Math.pow(2, -3) 8 8 │ async () => Math.pow(await a, b) 9 │ - async·()·=>·Math.pow(a,·await·b) 9 │ + async·()·=>·a·**·await·b 10 10 │ ```