From 6185cc79d7e7c44eaccf9b16f4735fd6fe4cbcf6 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 10 Mar 2026 15:41:22 -0400 Subject: [PATCH] tooling: make qmllint auto-resolution smarter --- CONTRIBUTING.md | 4 +++- quickshell/README.md | 3 ++- quickshell/scripts/qmllint-entrypoints.sh | 23 ++++++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 873f2cac..1ba0db20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,9 @@ touch .qmlls.ini 4. Restart dms to generate the `.qmlls.ini` file -5. Make your changes, test, and open a pull request. +5. Run `make lint-qml` from the repo root to lint QML entrypoints (requires the `.qmlls.ini` generated above). The script needs the **Qt 6** `qmllint`; it checks `qmllint6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint` in `PATH`. If your Qt 6 binary lives elsewhere, set `QMLLINT=/path/to/qmllint`. + +6. Make your changes, test, and open a pull request. ### I18n/Localization diff --git a/quickshell/README.md b/quickshell/README.md index acf84d0d..49fe191d 100644 --- a/quickshell/README.md +++ b/quickshell/README.md @@ -27,7 +27,8 @@ quickshell -p quickshell/ **Code formatting:** ```bash qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml -make lint-qml # Run from repo root; requires a generated quickshell/.qmlls.ini VFS from `qs -p quickshell/` +make lint-qml # Run from repo root; requires quickshell/.qmlls.ini (generated by `qs -p quickshell/`) + # Uses Qt 6 qmllint. Override path with QMLLINT=/path/to/qmllint if needed. ``` ## Components diff --git a/quickshell/scripts/qmllint-entrypoints.sh b/quickshell/scripts/qmllint-entrypoints.sh index 676b466a..188b8db4 100755 --- a/quickshell/scripts/qmllint-entrypoints.sh +++ b/quickshell/scripts/qmllint-entrypoints.sh @@ -10,11 +10,28 @@ repo_root="$( cd -- "${script_dir}/../.." && pwd )" quickshell_dir="${repo_root}/quickshell" -qmllint_bin="${QMLLINT:-qmllint}" qmlls_config="${quickshell_dir}/.qmlls.ini" -if ! command -v -- "${qmllint_bin}" >/dev/null 2>&1; then - printf 'error: qmllint not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2 +# Resolve qmllint: honour QMLLINT, then try qmllint6, then the common Qt 6 +# install path, and finally bare qmllint. We need the Qt 6 build (>= 6.x) +# because older Qt 5 qmllint doesn't understand --ignore-settings / -W. +resolve_qmllint() { + if [[ -n "${QMLLINT:-}" ]]; then + printf '%s\n' "${QMLLINT}" + return + fi + local candidate + for candidate in qmllint6 /usr/lib/qt6/bin/qmllint qmllint; do + if command -v -- "${candidate}" >/dev/null 2>&1; then + printf '%s\n' "${candidate}" + return + fi + done + return 1 +} + +if ! qmllint_bin="$(resolve_qmllint)"; then + printf 'error: qmllint (Qt 6) not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2 exit 127 fi