'index' is defined but never used
600 o.edited = []
601 o.deleted = []
602
603 $(sel).each(function (index) {604 const THIS = $(this)
605 const dnpk = $(this).attr('data-nu-primary-key')
606 let V = [dnpk]
'index' is defined but never used
514 subforms () {
515 const s = ['']
516
517 $("[data-nu-subform='true']").each(function (index) {518 s.push($(this)[0].id)
519 })
520
'index' is defined but never used
401 const t = []
402 const fld = []
403
404 $('.nuBox').each(function (index) {405 const b = $(this)[0].id
406 const T = $('#tablename' + b).val()
407 const A = $('#alias' + b).val()
'index' is defined but never used
378 const fld = []
379
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()
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;
}