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.

范例

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
    }
}