This warning category is spelled
[confusing-pluses]
by qmllint.
JavaScript code uses a combination of operators written with '+' in a confusing way. The neighboring '+' operators may be difficult to distinguish. This can be made worse by unconventional spacing.
It makes the code more difficult to read and may cause confusion.
import QtQuick Item { function f(a: int, b: int) { let x = a++ + b let y = a + +b let z = a + ++b return x + y + z } }
To fix this warning, rewrite the code so that it doesn't contain similar '+' operators next to each other. Simplify expressions where possible. Remove redundant unary operators and spacing, and use parentheses to isolate subexpressions.
Be mindful that these operators may perform coercions. An expression like
a + +b
may not be equivalent to
a + b
depending on the type of b.
import QtQuick Item { function f(a: int, b: int) { let x = (a++) + b let y = a + b let z = a + b + 1 return x + y + z } }