Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99449

qmlformat errors when JS array has trailing comma

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 6.3.0
    • Fix Version/s: 6.3, 6.4.0 Beta1
    • Component/s: QML: Tooling
    • Labels:
    • Platform/s:
      All
    • Commits:
      43041ebbf3 (qt/qtdeclarative/dev) 43041ebbf3 (qt/tqtc-qtdeclarative/dev)

      Description

      When using Qt 6.3.0 built from the latest dev branch, qmlformat fails to format when a Javascript array has a trailing comma.

      Repro.qml copied (from attachment) here:

      import QtQuick
      
      Item {
        Component.onCompleted: {
          let someList = [
            "item1",
            "item2",
          ];
        }
      }
      

       

      Running the attached minimally reproducible example:

      qmlformat -i ./Repro.qml
      

      This fails with a lot of output text and no clear explanation as to why (output log attached).

      This level of output seems better reserved for a high verbosity level.

        Attachments

        1. repro_output.png
          repro_output.png
          1.01 MB
        2. Repro.qml
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qtqmlteam Qt Qml Team User
            Reporter:
            jclay Joel Clay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes