Skip to content

QML Linting

realstuffie edited this page Oct 28, 2026 · 2 revisions

QML Linting

Setup

Install Qt6 lint tools:

# Debian/Ubuntu
apt install qt6-declarative-dev-tools

# Fedora
dnf install qt6-qtdeclarative-devel

# openSUSE
zypper install qt6-declarative-devel

Verify:

qmllint --version

Must succeed and must not reference /usr/lib/qt5/bin/qmllint. On a machine that also has Qt 5 tools, qmllint can resolve to the Qt 5 wrapper. Call the Qt 6 binary directly then, for example /usr/lib/qt6/bin/qmllint on Ubuntu.

Linting the project

The repository has a .qmllint.ini that turns off the warnings about types from the C++ plugin and KDE modules, because qmllint cannot resolve them. Run it on the shipped QML:

/usr/lib/qt6/bin/qmllint $(git ls-files 'contents/ui/*.qml' 'contents/config/*.qml')

The QML in v0.9.2 lints with no warnings. CI does not run qmllint yet, so run it before a release.

Editor setup

The repository's .vscode/settings.json only sets the CMake source directory (contents/lib). To lint from your editor, point its QML extension at the Qt 6 qmllint and let it read .qmllint.ini from the project root.

If QtQuick still fails after fixing qmllint

Set the import paths if needed:

export QML2_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt6/qml:$PWD/contents/lib
export QML_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt6/qml:$PWD/contents/lib

Health check

which qmllint; qmllint --version 2>&1; ls -d /usr/lib/*/qt6/qml 2>/dev/null

Clone this wiki locally