[pve-devel] [PATCH manager 4/7] ui: qemu/HardwareView: eslint: enforce "no-shadow" rule

Aaron Lauterer a.lauterer at proxmox.com
Mon Feb 1 15:21:28 CET 2021


`confid` is overwritten in each step anyways, so it should be no
problem to use it in the outer scope.

Let's play it safe for `sm` and rename it in the function.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

Not sure if my solutions are okay or if another approach is preferable.
Didn't find any patches in the manager repo that deal with the
`no-shadow` rule as a guide though.

 www/manager6/qemu/HardwareView.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index cc707a2a..213a946f 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -220,7 +220,7 @@ Ext.define('PVE.qemu.HardwareView', {
 	};
 
 	PVE.Utils.forEachBus(undefined, function(type, id) {
-	    var confid = type + id;
+	    confid = type + id;
 	    rows[confid] = {
 		group: 10,
 		iconCls: 'hdd-o',
@@ -531,8 +531,8 @@ Ext.define('PVE.qemu.HardwareView', {
 	let isAtLimit = (type) => counts[type] >= PVE.Utils.hardware_counts[type];
 
 	var set_button_status = function() {
-	    var sm = me.getSelectionModel();
-	    var rec = sm.getSelection()[0];
+	    var selection_model = me.getSelectionModel();
+	    var rec = selection_model.getSelection()[0];
 
 	    // en/disable hardwarebuttons
 	    counts = {};
-- 
2.20.1





More information about the pve-devel mailing list