'index' is defined but never used. Allowed unused args must match /^_/u
90
91function selectToValueArray (id) {
92 const a = []
93 $('#' + id + ' option:selected').each(function (index) { 94 if ($(this).text() !== '') {
95 a.push($(this).val())
96 }
'nuBeforeSave' is defined but never used. Allowed unused vars must match /^_/u
99 return a
100}
101
102function nuBeforeSave () {103 if ($('#set_language').hasClass('nuEdited')) {
104 $("#set_languages_included option[value='" + $('#set_language').val() + "']").prop('selected', true)
105 $('#set_languages_included').change()
'nuResizeSQL' is defined but never used. Allowed unused vars must match /^_/u
145 })
146}
147
148function nuResizeSQL () {149 if ($('#sqlframe').css('height') == '460px') {
150 $('#sqlframe').css('height', 700)
151 } else {
'nuAddSQLTable' is defined but never used. Allowed unused vars must match /^_/u
125 })
126}
127
128function nuAddSQLTable (e) {129 const s = $('#sqlframe')[0].contentWindow.nuSQL
130
131 s.addBox(e.target.value)
'index' is defined but never used. Allowed unused args must match /^_/u
107}
108
109function nuWhereClausesold () {
110 $("[id$='ssc_type']select").each(function (index) {111 const p = $(this).attr('data-nu-prefix')
112 const t = $(this).val()
113
'nuWhereClausesold' is defined but never used. Allowed unused vars must match /^_/u
106 })
107}
108
109function nuWhereClausesold () {110 $("[id$='ssc_type']select").each(function (index) {
111 const p = $(this).attr('data-nu-prefix')
112 const t = $(this).val()
'index' is defined but never used. Allowed unused args must match /^_/u
88}
89
90function nuWhereClauses () {
91 $("[id$='ssc_type']select").each(function (index) { 92 const p = $(this).attr('data-nu-prefix')
93 const t = $(this).val()
94
'nuBeforeSave' is defined but never used. Allowed unused vars must match /^_/u
82 $('#nuMessageDiv').css('text-align', 'left')
83}
84
85function nuBeforeSave () { 86 $('#sqlframe')[0].contentWindow.nuSQL.buildSQL()
87 return true
88}
'nuTempPHP' is defined but never used. Allowed unused vars must match /^_/u
64 parent.$('#dialogClose').click()
65}
66
67function nuTempPHP () { 68 const p = []
69
70 p.push('')
'nuCopySQL' is defined but never used. Allowed unused vars must match /^_/u
56
57nuWhereClauses()
58
59function nuCopySQL (target) { 60 const s = $('#sse_sql').val()
61
62 parent.$('#' + target).val(s).change()
'targ' is assigned a value but never used. Allowed unused vars must match /^_/u
27if (window.filter == 'justsql') {
28 const sid = String(nuFORM.getCurrent().record_id)
29 const from = sid.substring(sid.length - 2)
30 const targ = '#sfo_browse_sql' 31
32 $('#nuDeleteButton').remove()
33 $('#nuCloneButton').remove()
'nuFormColor' is defined but never used. Allowed unused vars must match /^_/u
47 }
48}
49
50function nuFormColor () { 51 let t = String($('#sfo_type').val())
52
53 const pb = 'previewbrowse'
'index' is defined but never used. Allowed unused args must match /^_/u
139}
140
141function addRowButtons (column) {
142 $("[data-nu-column='" + column + "']").each(function (index) {143 const pk = $(this).attr('data-nu-primary-key')
144 const r = $(this).attr('data-nu-row')
145 const formType = $('#nucell_' + r + '_1').html()
'e' is defined but never used. Allowed unused args must match /^_/u
14 colorObjectTypes()
15}
16
17function nuSortSubform (s, c, e) { 18}
19
20if (nuFormType() == 'edit') {
'c' is defined but never used. Allowed unused args must match /^_/u
14 colorObjectTypes()
15}
16
17function nuSortSubform (s, c, e) { 18}
19
20if (nuFormType() == 'edit') {
's' is defined but never used. Allowed unused args must match /^_/u
14 colorObjectTypes()
15}
16
17function nuSortSubform (s, c, e) { 18}
19
20if (nuFormType() == 'edit') {
'index' is defined but never used. Allowed unused args must match /^_/u
376function nuHideCalcObjects () {
377 const f = $('#sob_all_zzzzsys_form_id').val()
378
379 $('#add_total').children().each(function (index) {380 if ($(this).val() != f) {
381 $(this).hide()
382 }
'nuChartOnReady' is defined but never used. Allowed unused vars must match /^_/u
237 nuChart('google_chart', c, a, t, x, y, l, s)
238}
239
240function nuChartOnReady (i, wrapper) {241 // let wrapper = window["google_chart_wrapper"];
242 const options = { seriesType: wrapper.m.seriesType, chartArea: { left: '10%', width: '65%' } }
243 wrapper.setOptions(options)
'nuAddToFormula' is defined but never used. Allowed unused vars must match /^_/u
413 nuHasBeenEdited()
414}
415
416function nuAddToFormula (e) {417 const newValue = e.target.innerHTML
418 const oldValue = $('#sob_calc_formula').val()
419
'nuSetSelectIndex' is defined but never used. Allowed unused vars must match /^_/u
452 $('#add_total').html('<table>' + a.join('') + '</table>')
453}
454
455function nuSetSelectIndex (i, index) {456 $('#' + i).prop('selectedIndex', index).change()
457}
458
'index' is defined but never used. Allowed unused args must match /^_/u
353 if (t == 'nuDate' || t == 'nuNumber') {
354 nuShow('sob_input_format')
355
356 $('#sob_input_format').children().each(function (index) {357 $(this).show()
358
359 if ($(this).val()[0] == 'D' && t != 'nuDate') {
'nuTypeChanged' is defined but never used. Allowed unused vars must match /^_/u
306 $('#sob_all_type_input').val(v)
307}
308
309function nuTypeChanged () {310 nuShow('sob_all_type_open_button', sob_all_type.value !== '')
311 nuShow('sob_all_type_input', sob_all_type.value !== '')
312
'nuEventList' is defined but never used. Allowed unused vars must match /^_/u
99 $(this).addClass('nu_' + this.textContent)
100})
101
102function nuEventList () {103 if ($('sob_all_type').val() == 'subform') {
104 return ['onchange', 'onadd']
105 } else {
'menuSetupClick' is defined but never used. Allowed unused vars must match /^_/u
123 openMenu(event, menu, element)
124}
125
126function menuSetupClick (element, event) {127 const menu = [{
128 text: nuTranslate('Setup')
129 },
'nuBeforeSave' is defined but never used. Allowed unused vars must match /^_/u
17 $('#fast_report_sf' + f + 'title').val($(t).html()).change().select()
18}
19
20function nuBeforeSave () {21 if ($('#table').val() === '') {
22 nuMessage(['<b>Table Data</b>', nuTranslate('Cannot be left blank...')])
23 return false
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;
}