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

Dominik Csapak d.csapak at proxmox.com
Tue Feb 2 14:07:44 CET 2021


the global confid variable is only there
so we could reuse the name

so i'd prefer we remove that
and use 'let confid' in the relevant blocks
(with var this would have failed)

On 2/1/21 3:21 PM, Aaron Lauterer wrote:
> `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 = {};
> 





More information about the pve-devel mailing list