From d527b2d6769bdc0d2cd6744f1bda9d8da74ef6a6 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Wed, 18 Nov 2015 12:24:32 +0000 Subject: Rename local variables to unique private names When a local variable shares the same name with a variable in its scope, it can cause confusion to the reader and make it impossible to access the global variable. Disallow shadowing. Fixes ESLint no-shadow errors using airbnb/legacy config. Suggested-by: marc --- js/pomf.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js/pomf.js') diff --git a/js/pomf.js b/js/pomf.js index f1b23f3..4c2f9fe 100644 --- a/js/pomf.js +++ b/js/pomf.js @@ -100,13 +100,13 @@ $(function() { var UPLOAD_ERR_FAILED = 'Something went wrong; try again later.'; var up = files.upload('upload.php'); - var eachRow = function(files, fn) { + var eachRow = function(_files, fn) { var hits = {}; - files.forEach(function(file) { + _files.forEach(function(file) { var row = $($('li[data-filename="' + escape(file.name) + '"]')[hits[file.name] || 0]); ++hits[file.name]; - fn.call(row, row, file, files); + fn.call(row, row, file, _files); }); }; @@ -124,12 +124,12 @@ $(function() { return; } - up.on('uploadprogress', function(evt, files) { - eachRow(files, function(row, file) { + up.on('uploadprogress', function(evt, _files) { + eachRow(_files, function(row, file) { $('.progress-inner', row).width((file.percentUploaded * 100) + '%'); }); - $('.progress-inner', totalRow).width((files.percentUploaded * 100) + '%'); + $('.progress-inner', totalRow).width((_files.percentUploaded * 100) + '%'); }); up.on('uploadcomplete', function() { -- cgit v1.2.3