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

qmlformat should not force multiline with arrow functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.15.1
    • Fix Version/s: 6.2
    • Component/s: QML: Tooling
    • Commits:
      61417ad3525d33c41e7d8423103e876a922d5f8b (qt/qtdeclarative/dev)

      Description

      Hi,

      qmlformat does this :

       

      a = () => updateDB(params)
      
      //becomes
      
      a = () => {
          return updateDB(params);
      };

       

      Arrow functions are cool to write small inline code so adding the braces for small expression adds two more line of code (total 3 instead of one) and is less readable than a oneliner.  As a consequence  `return` is added even for oneline which is useless.

       

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            max.goldstein Maximilian Goldstein
            Reporter:
            jgirardet Jimmy Gir
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes