'b' is defined but never used. Allowed unused args must match /^_/u
1// -- object for dragging sections --//
2
3function nuLoadReport (b) { 4 window.addEventListener('keydown', function (e) {
5 if (['ArrowUp', 'ArrowDown'].indexOf(e.key) > -1) {
6 e.preventDefault()
'event' is defined but never used. Allowed unused args must match /^_/u
274 nuLoadReport()
275 }
276
277 this.adjustSectionForMovedObjects = function (event) { 278 nuDrag.getSelected()
279
280 const sel = document.getElementsByClassName('nuDragSelected')
'nuCloneObjects' is defined but never used. Allowed unused vars must match /^_/u
532 nuLoadReport()
533}
534
535function nuCloneObjects () { 536 nuREPORT.selected = []
537
538 const sel = document.getElementsByClassName('nuDragSelected')
'nuSelectDialog' is defined but never used. Allowed unused vars must match /^_/u
557 nuLoadReport()
558}
559
560function nuSelectDialog () { 561 nuDIALOG.dialog = 'nuSelectDialog'
562
563 nuDragD.createDialog(200, window.scrollY + 50, 700, 600, opener.nuTranslate('Select Objects'))
't' is defined but never used. Allowed unused args must match /^_/u
1211 nuLoadReport()
1212}
1213
1214function nuDoNothing (t) {1215
1216}
1217
'nuUpdateReport' is defined but never used. Allowed unused vars must match /^_/u
1215
1216}
1217
1218function nuUpdateReport (t) {1219 const p = $('#paper').val() + $('#orientation').val()
1220 const a = []
1221
'nuBuildForm' is defined but never used. Allowed unused vars must match /^_/u
37
38let promot
39
40function nuBuildForm (f) { 41 window.nuOnSetSelect2Options = null // can be overwritten by nuAddJavaScript()
42 window.nuSERVERRESPONSE = f
43
'f' is defined but never used. Allowed unused args must match /^_/u
514 .attr('title', nuTranslate(title))
515}
516
517function nuAddedByLookup (f) { 518 const isEdit = nuFormType() == 'edit'
519 const isNewRecord = window.nuLASTRECORD == '-1'
520 const isLookup = window.nuTARGET != ''
'nuTotalHolderWidth' is defined but never used. Allowed unused vars must match /^_/u
596 return nuCSSPropertySum(id, arrProperties)
597}
598
599function nuTotalHolderWidth (id) { 600 const arrProperties = [
601 'padding-left',
602 'padding-right',
'isMobile' is defined but never used. Allowed unused args must match /^_/u
616 return v
617}
618
619function nuSearchFieldSetSearchType (isMobile) { 620 $('#nuSearchField')
621 .prop('type', 'search')
622 .attr('autocomplete', 'off')
'nuAddActionButtonSaveClose' is defined but never used. Allowed unused vars must match /^_/u
709 return $('#' + id)
710}
711
712function nuAddActionButtonSaveClose (caption) { 713 nuAddActionButton('SaveClose', nuTranslate(caption === undefined ? 'Save & Close' : caption), 'nuSaveAction(true)', '', 'nuSaveButton')
714 $('#nuSaveCloseButton').addClass('nuSaveButton')
715}
'nuLookupFocus' is defined but never used. Allowed unused vars must match /^_/u
1372 }
1373}
1374
1375function nuLookupFocus (e) {1376 const objT = $(e.target)
1377 const p = objT.attr('data-nu-prefix')
1378 const t = objT.attr('data-nu-type')
'nuCurrentRow' is defined but never used. Allowed unused vars must match /^_/u
1384 }
1385}
1386
1387function nuCurrentRow () {1388 return window.nuSubformRow
1389}
1390
'hasSelected' is assigned a value but never used. Allowed unused vars must match /^_/u
1693 $sel.append('<option value="' + obj.options[n][0] + '">' + opt + '</option>')
1694 } else {
1695 $sel.append('<option selected="selected "value="' + obj.options[n][0] + '">' + opt + '</option>')
1696 hasSelected = true1697 }
1698 }
1699 }
'nuSubformRowId' is defined but never used. Allowed unused vars must match /^_/u
1873 return nuFORM.subform(id)
1874}
1875
1876function nuSubformRowId (t) {1877 return $(t).parent().attr('data-nu-primary-key')
1878}
1879
'nuSubformRowObject' is defined but never used. Allowed unused vars must match /^_/u
1881 return $('#' + id).attr('data-nu-prefix').slice(-3)
1882}
1883
1884function nuSubformRowObject (id, column) {1885 const formCode = $('#' + id).attr('data-nu-form')
1886 return $('#' + formCode + nuSubformRowNumber(id) + column)
1887}
'nuSubformValue' is defined but never used. Allowed unused vars must match /^_/u
1886 return $('#' + formCode + nuSubformRowNumber(id) + column)
1887}
1888
1889function nuSubformValue (t, id) {1890 const p = $(t).attr('data-nu-prefix')
1891 return $('#' + p + id).val()
1892}
'nuSubformDisable' is defined but never used. Allowed unused vars must match /^_/u
1906 return a
1907}
1908
1909function nuSubformDisable (sf, ob) {1910 if (ob === undefined || ob === '') {
1911 $("[data-nu-form='" + sf + "']").nuDisable()
1912 return
'nuSubformEnable' is defined but never used. Allowed unused vars must match /^_/u
1917 }
1918}
1919
1920function nuSubformEnable (sf, ob, enable) {1921 if (ob === undefined || ob === '') {
1922 $("[data-nu-form='" + sf + "']").nuEnable(enable)
1923 return
'nuSubformHide' is defined but never used. Allowed unused vars must match /^_/u
1928 }
1929}
1930
1931function nuSubformHide (sf, ob) {1932 if (ob === undefined || ob === '') {
1933 $("[data-nu-form='" + sf + "']").nuHide()
1934 return
'nuSubformShow' is defined but never used. Allowed unused vars must match /^_/u
1939 }
1940}
1941
1942function nuSubformShow (sf, ob, show) {1943 if (ob === undefined || ob === '') {
1944 $("[data-nu-form='" + sf + "']").nuShow(true, false)
1945 return
'nuSubformHideHeader' is defined but never used. Allowed unused vars must match /^_/u
1950 }
1951}
1952
1953function nuSubformHideHeader (id) {1954 const scrollDiv = $('#' + id + 'scrollDiv')
1955 scrollDiv.css({ top: 0, height: $('#' + id).cssNumber('height') })
1956}
'nuSubformLastRow' is defined but never used. Allowed unused vars must match /^_/u
1955 scrollDiv.css({ top: 0, height: $('#' + id).cssNumber('height') })
1956}
1957
1958function nuSubformLastRow (t) {1959 const i = String($('#' + t.id).parent().attr('id'))
1960 const p = i.substr(0, i.length - 17)
1961 const s = parseInt(i.substr(11, 3), 10) + 1
'nuSubformFocusLastRow' is defined but never used. Allowed unused vars must match /^_/u
1964 return n == 0
1965}
1966
1967function nuSubformFocusLastRow (id, f) {1968 const sf = nuSubformObject(id)
1969 const c = f === undefined ? sf.fields[1] : sf.fields.indexOf(f)
1970 const r = sf.rows.length - 1
'nuSubformSetHeight' is defined but never used. Allowed unused vars must match /^_/u
1972 $('#' + id + nuPad3(r) + c).focus()
1973}
1974
1975function nuSubformSetHeight (i, height, minHeight, maxHeight) {1976 const div = $('#' + i + 'scrollDiv')
1977 const sf = $('#' + i)
1978
Description
Found variables that are declared but not used anywhere.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Currently, we don't support variables that are not explicitly exported, and are injected into other scripts by being included in an HTML file
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
Bad Practice
// Write-only variables are not considered as used.
let y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
let z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
Recommended
let x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}