smalos / nubuilder_dev

Require template literals instead of string concatenation JS-0246
Anti-pattern
Minor
45 occurrences in this check
Unexpected string concatenation
909      const m = nuPad2(o.getMonth() + 1) + '-'
910      const a = nuPad2(o.getDate()) + ' '
911      const h = nuPad2(o.getHours()) + ':'
912      const n = nuPad2(o.getMinutes()) + ':'913      const s = nuPad2(o.getSeconds())
914
915      if (hasTime) {
Unexpected string concatenation
908      const y = String(o.getFullYear()) + '-'
909      const m = nuPad2(o.getMonth() + 1) + '-'
910      const a = nuPad2(o.getDate()) + ' '
911      const h = nuPad2(o.getHours()) + ':'912      const n = nuPad2(o.getMinutes()) + ':'
913      const s = nuPad2(o.getSeconds())
914
Unexpected string concatenation
907      var o = new Date(d.y, Number(d.m) - 1, d.d, Number(d.h), Number(d.n), Number(d.s), 0)
908      const y = String(o.getFullYear()) + '-'
909      const m = nuPad2(o.getMonth() + 1) + '-'
910      const a = nuPad2(o.getDate()) + ' '911      const h = nuPad2(o.getHours()) + ':'
912      const n = nuPad2(o.getMinutes()) + ':'
913      const s = nuPad2(o.getSeconds())
Unexpected string concatenation
906
907      var o = new Date(d.y, Number(d.m) - 1, d.d, Number(d.h), Number(d.n), Number(d.s), 0)
908      const y = String(o.getFullYear()) + '-'
909      const m = nuPad2(o.getMonth() + 1) + '-'910      const a = nuPad2(o.getDate()) + ' '
911      const h = nuPad2(o.getHours()) + ':'
912      const n = nuPad2(o.getMinutes()) + ':'
Unexpected string concatenation
905      }
906
907      var o = new Date(d.y, Number(d.m) - 1, d.d, Number(d.h), Number(d.n), Number(d.s), 0)
908      const y = String(o.getFullYear()) + '-'909      const m = nuPad2(o.getMonth() + 1) + '-'
910      const a = nuPad2(o.getDate()) + ' '
911      const h = nuPad2(o.getHours()) + ':'
Unexpected string concatenation
896        }
897        if (l == 'y') {
898          d.y = v[i]
899          if (d.y.length == 2) d.y = '20' + d.y900        }
901
902        if (l == 'h') { d.h = v[i] }
Unexpected string concatenation
771      if (isNaN(Number(v))) { return '' }
772      const splitNumber = v.split('.')
773      const decimals = splitNumber.length == 1 ? '' : splitNumber[1]
774      return String(CF[0] + ' ' + nuAddThousandSpaces(splitNumber[0], CF[1]) + CF[2] + decimals).trim()775    }
776
777    if (f[0] == 'D') {	// -- date
Unexpected string concatenation
640    for (let f = 0; f < o.fields.length - 1; f++) {
641      const c = []
642
643      titles.push($('#title_' + sf + o.fields[f]).html())644
645      for (let r = 0; r < o.rows.length; r++) {
646        if (o.rows[r][o.fields.length - 1] == 0) {
Unexpected string concatenation
606      let V = [dnpk]
607      let E = [0]
608      let C = 1
609      let chk = $('#' + this.id).prop('checked')610
611      THIS.children('[data-nu-data]').each(function () {
612        const children = cThis.subformCollectRecordChildren(this, sf, chk, deleteAll, V, E, F, C)
Unexpected string concatenation
583      sel = "[id*='" + sf + "'][id*='nuRECORD']"
584      table = $(sel).attr('data-nu-table')
585
586      const $sf = $('#' + sf)587      oi = $sf.attr('data-nu-object-id')
588      fk = $sf.attr('data-nu-foreign-key-name')
589      pk = $sf.attr('data-nu-primary-key-name')
Unexpected string concatenation
580        oi = nuFORM.getCurrent().form_id
581      }
582    } else {
583      sel = "[id*='" + sf + "'][id*='nuRECORD']"584      table = $(sel).attr('data-nu-table')
585
586      const $sf = $('#' + sf)
Unexpected string concatenation
522  }
523
524  subformCollectRecordChildren (t, sf, chk, deleteAll, V, E, F, C) {
525    const $this = $('#' + t.id)526    if (t.id.substr(-8) == 'nuDelete') {
527      chk = ($this.prop('checked') || deleteAll) ? 1 : 0
528    }
Unexpected string concatenation
463      var subform_name = field.split('.')[0]
464      var field_name = field.split('.')[1]
465    } else {
466      const o = $('#' + field)467      var f = o.attr('data-nu-format')
468      var v = o.val()
469
Unexpected string concatenation
413      const f = nuFORM.tableSchema[t[i].tablename].names
414
415      for (let I = 0; I < f.length; I++) {
416        fld.push(t[i].alias + '.' + f[I])417      }
418    }
419
Unexpected string concatenation
404    $('.nuBox').each(function (index) {
405      const b = $(this)[0].id
406      const T = $('#tablename' + b).val()
407      const A = $('#alias' + b).val()408
409      t.push({ tablename: T, alias: A })
410    })
Unexpected string concatenation
403
404    $('.nuBox').each(function (index) {
405      const b = $(this)[0].id
406      const T = $('#tablename' + b).val()407      const A = $('#alias' + b).val()
408
409      t.push({ tablename: T, alias: A })
Unexpected string concatenation
390      const f = nuFORM.tableSchema[t].names
391
392      for (let i = 0; i < f.length; i++) {
393        fld.push(a + '.' + f[i])394      }
395    })
396
Unexpected string concatenation
381    sqlFrameContents.find('.nuBox').each(function (index) {
382      const b = $(this)[0].id
383      let a = sqlFrameContents.find('#alias' + b).val()
384      const t = sqlFrameContents.find('#tablename' + b).html()385
386      if (a == '') {
387        a = t
Unexpected string concatenation
380    const sqlFrameContents = $('#sqlframe').contents()
381    sqlFrameContents.find('.nuBox').each(function (index) {
382      const b = $(this)[0].id
383      let a = sqlFrameContents.find('#alias' + b).val()384      const t = sqlFrameContents.find('#tablename' + b).html()
385
386      if (a == '') {
Unexpected string concatenation
324    sql = sql.replace(/[\n\r]/g, ' ')
325
326    for (let i = 0; i < tables.length; i++) {
327      if (sql.indexOf(' ' + tables[i] + ' ') != -1) {328        t.push(tables[i])
329      }
330    }
Unexpected string concatenation
320  tablesFromSQL (sql) {
321    const t = []
322    const tables = this.getTables()
323    sql = sql + ' '324    sql = sql.replace(/[\n\r]/g, ' ')
325
326    for (let i = 0; i < tables.length; i++) {
Unexpected string concatenation
259    const theindex = this.scroll[theid].index
260    const thevalue = s.list[theindex]
261
262    $('#' + e.target.id)263      .val(thevalue)
264      .change()
265
Unexpected string concatenation
180      if (D[i].type == 'lookup') {
181        $('#' + D[i].id + 'code').css({ top: D[i].top, left: D[i].left })
182        $('#' + D[i].id + 'button').css({ top: D[i].top, left: D[i].left + D[i].cwidth + 7 })
183        $('#' + D[i].id + 'description').css({ top: D[i].top, left: D[i].left + D[i].cwidth + 26 })184      }
185    }
186
Unexpected string concatenation
179
180      if (D[i].type == 'lookup') {
181        $('#' + D[i].id + 'code').css({ top: D[i].top, left: D[i].left })
182        $('#' + D[i].id + 'button').css({ top: D[i].top, left: D[i].left + D[i].cwidth + 7 })183        $('#' + D[i].id + 'description').css({ top: D[i].top, left: D[i].left + D[i].cwidth + 26 })
184      }
185    }
Unexpected string concatenation
178      $('#' + D[i].labelid).css({ top: D[i].top, left: D[i].lleft, width: D[i].lwidth, 'text-align': 'right' })
179
180      if (D[i].type == 'lookup') {
181        $('#' + D[i].id + 'code').css({ top: D[i].top, left: D[i].left })182        $('#' + D[i].id + 'button').css({ top: D[i].top, left: D[i].left + D[i].cwidth + 7 })
183        $('#' + D[i].id + 'description').css({ top: D[i].top, left: D[i].left + D[i].cwidth + 26 })
184      }