smalos / nubuilder_dev

Use shorthand property syntax for object literals JS-0240
Anti-pattern
Minor
71 occurrences in this check
Expected method shorthand.
109    skin: useDarkMode ? 'oxide-dark' : 'oxide',
110    content_css: useDarkMode ? 'dark' : 'default',
111    cache_suffix: '?v=6.3.0',
112    setup: function (editor) {113      editor.on('init', function (e) {114        e.target.setContent(nuGetValue(id))115        if (window.nuTinyMCEOnInit) {116          nuTinyMCEOnInit(e, editor)117        }118      })119120      editor.on('change', function () {121        nuTinyMCEOnChangeHandler(editor)122      })123    }124  }
125
126  let mergedOptions = defaultOptions
Expected method shorthand.
2183      id: filterId,
2184      class: 'nuSubformFilter',
2185      on: {
2186        change: function () {2187          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))2188        },2189        focus: function () {
2190          nuSubformFilterAddValues(sfName, 'select', columnId)
2191          nuSubformFilterSortOptions(sfName, columnId)
Expected method shorthand.
2186        change: function () {
2187          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))
2188        },
2189        focus: function () {2190          nuSubformFilterAddValues(sfName, 'select', columnId)2191          nuSubformFilterSortOptions(sfName, columnId)2192        }2193      },
2194      append: [
2195        optionAll,
Expected method shorthand.
2206      type: 'search',
2207      class: 'nuSubformFilter',
2208      on: {
2209        input: function () {2210          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))2211        },2212        focus: function () {
2213          if (propDatalist === true) { nuSubformFilterAddValues(sfName, 'search', columnId) }
2214        }
Expected method shorthand.
2209        input: function () {
2210          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))
2211        },
2212        focus: function () {2213          if (propDatalist === true) { nuSubformFilterAddValues(sfName, 'search', columnId) }2214        }2215      },
2216      id: filterId
2217    })
Expected method shorthand.
 154}
 155
 156jQuery.fn.extend({
 157  nuEnable: function (enable) { 158    return this.each(function () { 159      nuEnable(this.id, enable) 160    }) 161  }, 162  nuDisable: function () {
 163    return this.each(function () {
 164      nuDisable(this.id)
Expected method shorthand.
 159      nuEnable(this.id, enable)
 160    })
 161  },
 162  nuDisable: function () { 163    return this.each(function () { 164      nuDisable(this.id) 165    }) 166  }, 167  nuShow: function (visible, openTab) {
 168    return this.each(function () {
 169      nuShow(this.id, visible, openTab)
Expected method shorthand.
 164      nuDisable(this.id)
 165    })
 166  },
 167  nuShow: function (visible, openTab) { 168    return this.each(function () { 169      nuShow(this.id, visible, openTab) 170    }) 171  }, 172  nuHide: function () {
 173    return this.each(function () {
 174      nuHide(this.id)
Expected method shorthand.
 169      nuShow(this.id, visible, openTab)
 170    })
 171  },
 172  nuHide: function () { 173    return this.each(function () { 174      nuHide(this.id) 175    }) 176  }, 177  nuRemove: function () {
 178    return this.each(function () {
 179      nuRemove(this.id)
Expected method shorthand.
 174      nuHide(this.id)
 175    })
 176  },
 177  nuRemove: function () { 178    return this.each(function () { 179      nuRemove(this.id) 180    }) 181  }, 182  nuSelectRemoveEmpty: function (setIndex) {
 183    return this.each(function () {
 184      nuSelectRemoveEmpty(this.id, setIndex)
Expected method shorthand.
 179      nuRemove(this.id)
 180    })
 181  },
 182  nuSelectRemoveEmpty: function (setIndex) { 183    return this.each(function () { 184      nuSelectRemoveEmpty(this.id, setIndex) 185    }) 186  }, 187  nuGetValue: function (method) {
 188    return nuGetValue(this.attr('id'), method)
 189  },
Expected method shorthand.
 184      nuSelectRemoveEmpty(this.id, setIndex)
 185    })
 186  },
 187  nuGetValue: function (method) { 188    return nuGetValue(this.attr('id'), method) 189  }, 190  nuSetValue: function (v, method, change) {
 191    return this.each(function () {
 192      return nuSetValue(this.id, v, method, change)
Expected method shorthand.
 187  nuGetValue: function (method) {
 188    return nuGetValue(this.attr('id'), method)
 189  },
 190  nuSetValue: function (v, method, change) { 191    return this.each(function () { 192      return nuSetValue(this.id, v, method, change) 193    }) 194  }, 195  nuGetText: function () {
 196    return nuGetValue(this.attr('id'), 'text')
 197  },
Expected method shorthand.
 192      return nuSetValue(this.id, v, method, change)
 193    })
 194  },
 195  nuGetText: function () { 196    return nuGetValue(this.attr('id'), 'text') 197  }, 198  nuSetText: function (v) {
 199    return this.each(function () {
 200      return nuSetValue(this.id, v, 'text')
Expected method shorthand.
 195  nuGetText: function () {
 196    return nuGetValue(this.attr('id'), 'text')
 197  },
 198  nuSetText: function (v) { 199    return this.each(function () { 200      return nuSetValue(this.id, v, 'text') 201    }) 202  }, 203  nuTranslate: function (method) {
 204    return this.each(function () {
 205      nuSetValue(this.id, nuTranslate(nuGetValue(this.id, method)), method)
Expected method shorthand.
 200      return nuSetValue(this.id, v, 'text')
 201    })
 202  },
 203  nuTranslate: function (method) { 204    return this.each(function () { 205      nuSetValue(this.id, nuTranslate(nuGetValue(this.id, method)), method) 206    }) 207  }, 208  nuRemoveFormatting: function () {
 209    return nuFORM.removeFormatting($(this).val(), $(this).attr('data-nu-format'))
 210  },
Expected method shorthand.
 205      nuSetValue(this.id, nuTranslate(nuGetValue(this.id, method)), method)
 206    })
 207  },
 208  nuRemoveFormatting: function () { 209    return nuFORM.removeFormatting($(this).val(), $(this).attr('data-nu-format')) 210  }, 211  nuIsVisible: function () {
 212    return nuIsVisible(this.attr('id'))
 213  },
Expected method shorthand.
 208  nuRemoveFormatting: function () {
 209    return nuFORM.removeFormatting($(this).val(), $(this).attr('data-nu-format'))
 210  },
 211  nuIsVisible: function () { 212    return nuIsVisible(this.attr('id')) 213  }, 214  nuIsHidden: function () {
 215    return nuIsHidden(this.attr('id'))
 216  },
Expected method shorthand.
 211  nuIsVisible: function () {
 212    return nuIsVisible(this.attr('id'))
 213  },
 214  nuIsHidden: function () { 215    return nuIsHidden(this.attr('id')) 216  }, 217  nuIsDisabled: function () {
 218    return nuIsDisabled(this.attr('id'))
 219  },
Expected method shorthand.
 214  nuIsHidden: function () {
 215    return nuIsHidden(this.attr('id'))
 216  },
 217  nuIsDisabled: function () { 218    return nuIsDisabled(this.attr('id')) 219  }, 220  nuIsEnabled: function () {
 221    return nuIsEnabled(this.attr('id'))
 222  },
Expected method shorthand.
 217  nuIsDisabled: function () {
 218    return nuIsDisabled(this.attr('id'))
 219  },
 220  nuIsEnabled: function () { 221    return nuIsEnabled(this.attr('id')) 222  }, 223  nuSetPlaceholder: function (placeholder, translate) {
 224    return nuSetPlaceholder(this.attr('id'), placeholder, translate)
 225  },
Expected method shorthand.
 220  nuIsEnabled: function () {
 221    return nuIsEnabled(this.attr('id'))
 222  },
 223  nuSetPlaceholder: function (placeholder, translate) { 224    return nuSetPlaceholder(this.attr('id'), placeholder, translate) 225  }, 226  nuTogglePassword: function (show) {
 227    return this.each(function () {
 228      const $input = $(this)
Expected method shorthand.
 223  nuSetPlaceholder: function (placeholder, translate) {
 224    return nuSetPlaceholder(this.attr('id'), placeholder, translate)
 225  },
 226  nuTogglePassword: function (show) { 227    return this.each(function () { 228      const $input = $(this) 229      let type = $input.attr('type') === 'password' ? 'text' : 'password' 230      if (show !== undefined) { 231        type = show ? 'text' : 'password' 232      } 233      $input.attr('type', type) 234    }) 235  } 236
 237})
 238
Expected method shorthand.
1305      number: function (item) {
1306        return util.txt(item)
1307      },
1308      regexp: function (item) {1309        const miniTable = util.table(['RegExp', null], 'regexp')1310        const flags = util.table()1311        const span = util.expander(1312          '/' + item.source + '/',1313          'Click to show more',1314          function () {1315            this.parentNode.appendChild(miniTable.node)1316          })13171318        flags1319          .addRow(['g', item.global])1320          .addRow(['i', item.ignoreCase])1321          .addRow(['m', item.multiline])13221323        miniTable1324          .addRow(['source', '/' + item.source + '/'])1325          .addRow(['flags', flags.node])1326          .addRow(['lastIndex', item.lastIndex])13271328        return settings.expanded ? miniTable.node : span1329      },1330      domelement: function (element, depth) {
1331        const miniTable = util.table(['DOMElement', null], 'domelement')
1332        const props = ['id', 'className', 'innerHTML', 'src', 'href']
Expected method shorthand.
 319const menuObject = {
 320  text: '',
 321  tag: 'Object',
 322  action: function (e) { 323    nuContextMenuCopyIdToClipboard() 324  } 325}
 326
 327const menuClone = {