This mirrors the work on QQmlJSVisitor, and has the same reason: It
becomes possible to track which calls update an existing scopes, and
which calls create a new one.
Change-Id: I98f13f8ed2da436510d11c0e2203ea4b23cdf8ed
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If a property binding is a js block without any statements, it could
mean that the user intended to create an object literal instead of an
empty block that returns undefined.
Task-number: QTBUG-129307
Change-Id: If242ddac140cce6479062194b785096ba1f6c0a6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
A test was slightly adapted as a result.
Task-number: QTBUG-129307
Change-Id: I07ac61b183d9d7d237e9cf51ce3a0c6c280daa45
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Two other tests needed to be updated as a result.
Task-number: QTBUG-129307
Change-Id: I1470a5ae93cc20ef90ffd63471bd36408b61af57
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Warn about ExpressionStatements that has no obvious effect in qmllint,
for example "x * 3;" is an expression statement that is either useless
or that potentially triggers user code with potential side-effects
during the custom coercion of "x". Warn that the expression statement
has no obvious effect.
Don't warn about expression statements inside of bindings: "y: x * 3" is
completely fine, for example.
Task-number: QTBUG-129307
Change-Id: I065ddce7394276296062545c1516ab9b4ad9f24d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The warnings should be part of the linting visitor.
Introduce a new warning category for the exising warning about
duplicate enum entries.
Amends bbce9ea73f
This also (re)moves the test for warnings about enums in inline
components from qmltc. These warnings should be generated by qmllint.
Some files that had enum inside of inline components may no longer fail
to compile because of the warning. This is fine as the enum is not
accessible anyways.
Amends f368be4320
Task-number: QTBUG-119890
Change-Id: I90f280e2e443504ab336b4c2ad85bf7e53e4544f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Implement the confusing pluses and minuses warnings. Those are triggered
for weird combinations of unary pluses and pre increments inside of
additions. (same for unary minuses and pre decrements).
Task-number: QTBUG-129307
Change-Id: I45c202efa58a588090d872f0bf8f43523c24a957
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Warn about usages of the void keyword. This warning is off by default,
mirroring the behavior of eslint.
Task-number: QTBUG-129307
Change-Id: Iba1cc09e028d5053ef1aa28f01f1694efa5c250f
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Implement the WarnXConstructor and complain about a specific set of
constructors.
Task-number: QTBUG-129307
Change-Id: I27e0cfcb1f061bb2efff1721da4a2bbdb01fcf2f
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Warn when comma expressions are used outside of for-loops.
Task-number: QTBUG-129307
Change-Id: Ic86bf3af7f122f73b70e18c728c72f64c355f982
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add a helper to retrieve the parent of the current node. It will be
needed in later commits to emit warnings.
Task-number: QTBUG-129307
Change-Id: Iaf6acd55db67e549ca8f34b5e20bf069d12349dd
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Move the stringliteral linting code into the new LinterImportVisitor
class.
Task-number: QTBUG-129307
Change-Id: I5f358f91c41e99383582be9fc1628814563848ed
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Add a visitor that creates warnings about qml and js code, to avoid
having all the warning-related but qqmljsscope-unrelated code in
qqmljsimportvisitor.
Task-number: QTBUG-129307
Change-Id: Icf56979d99855f11c5e72a0c9efbf9ecd629e42e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>