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

Snippet in "JavaScript Types" section of "The QML Type System" page produces a warning in Creator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.9.7, 5.11.2
    • 5.9
    • Documentation
    • None

    Description

      http://doc.qt.io/qt-5/qtqml-typesystem-topic.html#javascript-types has the following example:

      import QtQuick 2.0
      
      Item {
          property var theArray: new Array()
          property var theDate: new Date()
      
          Component.onCompleted: {
              for (var i = 0; i < 10; i++)
                  theArray.push("Item " + i)
              console.log("There are", theArray.length, "items in the array")
              console.log("The time is", theDate.toUTCString())
          }
      }
      

      Creator highlights this with a warning:

      Do not use "Array" as a constructor

      More info:

      https://eslint.org/docs/rules/no-array-constructor
      https://stackoverflow.com/a/1273936/904422

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-65891
          # Subject Branch Project Status CR V

          Activity

            People

              paulwicking Paul Wicking
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes