-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.10.0
-
282446da4 (dev), 617621657 (6.10)
Code
Based on QTBUG-11030:
import QtQuick import QtQml Window { height: 400 width: 600 visible: true Component.onCompleted: { console.log("Assigning constants...") let [a, b] = [1, 2] console.log(a, b) console.log("Swapping variables...");;; [a, b] = [b, a] console.log(a, b) } }
Steps to reproduce
- Save the code above into Main.qml
- In that folder, run qmlformat --write-defaults
- Run qmlformat Main.qml
- Edit .qmlformat.ini to change SortImports from "false" to "true" and repeat #3
- Edit .qmlformat.ini to change SemicolonRule from "always" to "essential" and repeat #3
- Run qmlformat --semicolon-rule=essential Main.qml
Outcomes
- (Step #3) The import order is not sorted, every line in Console.onCompleted has a single semicolon (Expected)
- (Step #4) The import order is now sorted (Expected)
- (Step #5) Same as Step #4 (Not Expected)
- (Step #6) Only the "Swapping variables..." line has a semicolon (Expected)