aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/doc/tools/pyside-qmllint.rst
blob: 54a72470ed94b099484a67d22018e3b0106a5350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
.. _pyside6-qmllint:

pyside6-qmllint
===============

``pyside6-qmllint`` is a command line tool that wraps `qmllint`_. This tool
verifies the syntatic validity of QML files and warns about some QML
anti-patterns.

It is automatically run by the :ref:`pyside6-project` tool
when passing the ``qmllint`` argument instructing it to check
the QML source files.

Usage
-----

The tool should normally not be invoked manually since it requires
a number of import paths and additional type information
generated by :ref:`pyside6-qmltyperegistrar` to function.

For example, for a ``.qml`` file like:

.. code-block:: javascript

    import QtQuick
    import QtQuick.Controls

    Item {
        Text {
            id: name
            text: qsTr("Hello World")
        }
    }

when running:

.. code-block:: bash

    pyside6-qmllint Main.qml

it would warn about unused imports:

.. code-block::

    Info: Main.qml:2:1: Unused import [unused-imports]
    import QtQuick.Controls
    ^^^^^^

.. _`qmllint`: https://doc.qt.io/qt-6/qtquick-tool-qmllint.html