smalos / nubuilder_dev

Use shorthand property syntax for object literals JS-0240
Anti-pattern
Minor
70 occurrences in this check
Expected method shorthand.
2208      id: filterId,
2209      class: 'nuSubformFilter',
2210      on: {
2211        change: function () {2212          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))2213        },2214        focus: function () {
2215          nuSubformFilterAddValues(sfName, 'select', columnId)
2216          nuSubformFilterSortOptions(sfName, columnId)
Expected method shorthand.
2211        change: function () {
2212          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))
2213        },
2214        focus: function () {2215          nuSubformFilterAddValues(sfName, 'select', columnId)2216          nuSubformFilterSortOptions(sfName, columnId)2217        }2218      },
2219      append: [
2220        optionAll,
Expected method shorthand.
2231      type: 'search',
2232      class: 'nuSubformFilter',
2233      on: {
2234        input: function () {2235          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))2236        },2237        focus: function () {
2238          if (propDatalist === true) { nuSubformFilterAddValues(sfName, 'search', columnId) }
2239        }
Expected method shorthand.
2234        input: function () {
2235          nuSubformFilterRows(sfName, nuSubformFilterArray(sfName, filter[sfName]))
2236        },
2237        focus: function () {2238          if (propDatalist === true) { nuSubformFilterAddValues(sfName, 'search', columnId) }2239        }2240      },
2241      id: filterId
2242    })
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.
1568      null: function () {
1569        return util.txt('NULL')
1570      },
1571      default: function () {1572        /* When a type cannot be found */1573        return util.txt('prettyPrint: TypeNotFound Error')1574      }1575    }
1576
1577    container.appendChild(typeDealer[(settings.forceObject) ? 'object' : util.type(obj)](obj, currentDepth))
Expected method shorthand.
1565      undefined: function () {
1566        return util.txt('UNDEFINED')
1567      },
1568      null: function () {1569        return util.txt('NULL')1570      },1571      default: function () {
1572        /* When a type cannot be found */
1573        return util.txt('prettyPrint: TypeNotFound Error')
Expected method shorthand.
1562      boolean: function (bool) {
1563        return util.txt(bool.toString().toUpperCase())
1564      },
1565      undefined: function () {1566        return util.txt('UNDEFINED')1567      },1568      null: function () {
1569        return util.txt('NULL')
1570      },