Comma

This warning category is spelled [comma] by qmllint.

Do not use comma expressions

What happened?

A JavaScript comma expression was used outside of a for loop.

Why is this bad?

Comma expressions reduce readability of the code and obscure side-effects.

Example

import QtQuick

Item {
    Component.onCompleted: init(config, true), enableLogging(categories), run(1000) // millis
}

To fix this warning, refactor the code to use distinct statements for each operation. This way, each side effect is explicit instead of happening as part of another unrelated operation:

import QtQuick

Item {
    Component.onCompleted: {
        init(config, true)
        enableLogging(categories)
        run(1000) // millis
    }
}

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.