From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <a.lauterer@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id E5C9F6CEBC
 for <pve-devel@lists.proxmox.com>; Wed,  3 Feb 2021 10:50:33 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id D89AE18A9D
 for <pve-devel@lists.proxmox.com>; Wed,  3 Feb 2021 10:50:33 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id E8F9A18A8F
 for <pve-devel@lists.proxmox.com>; Wed,  3 Feb 2021 10:50:32 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B6C16457F2
 for <pve-devel@lists.proxmox.com>; Wed,  3 Feb 2021 10:50:32 +0100 (CET)
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20210201142131.30024-1-a.lauterer@proxmox.com>
 <20210201142131.30024-3-a.lauterer@proxmox.com>
 <391d702f-766b-0c5d-c9e1-b7d3fab6dca4@proxmox.com>
From: Aaron Lauterer <a.lauterer@proxmox.com>
Message-ID: <3dfa74fd-ccd4-b1b4-7b16-94b1e3d4a095@proxmox.com>
Date: Wed, 3 Feb 2021 10:50:31 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.7.0
MIME-Version: 1.0
In-Reply-To: <391d702f-766b-0c5d-c9e1-b7d3fab6dca4@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.069 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.178 Looks like a legit reply (A)
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [eslint.org]
Subject: Re: [pve-devel] [PATCH manager 2/7] ui: qemu/HardwareView: eslint:
 enforce "max-len" rule
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 03 Feb 2021 09:50:33 -0000



On 2/3/21 8:40 AM, Thomas Lamprecht wrote:
> On 01.02.21 15:21, Aaron Lauterer wrote:
>> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
>> ---
>>   www/manager6/qemu/HardwareView.js | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
>> index 51c77246..fa72d9d3 100644
>> --- a/www/manager6/qemu/HardwareView.js
>> +++ b/www/manager6/qemu/HardwareView.js
>> @@ -593,7 +593,9 @@ Ext.define('PVE.qemu.HardwareView', {
>>   
>>   	    var isEfi = key === 'efidisk0';
>>   
>> -	    remove_btn.setDisabled(rec.data.delete || rowdef.never_delete === true || (isUnusedDisk && !diskCap));
>> +	    remove_btn.setDisabled(rec.data.delete ||
>> +				   rowdef.never_delete === true ||
>> +				   (isUnusedDisk && !diskCap));
> 
> If a method call is split over multiple lines the first line should only
> be the method itself.
> 
> As we have an expression here, not really multiple parameters, either of the
> following two would be fine:
> 
> remove_btn.setDisabled(
>      rec.data.delete || rowdef.never_delete === true || (isUnusedDisk && !diskCap)
> );
> 
> or:
> 
> remove_btn.setDisabled(
>      rec.data.delete ||
>      rowdef.never_delete === true ||
>      (isUnusedDisk && !diskCap)
> );
> 
> 

Maybe we want to add a eslint rule to catch these? I am usually getting this wrong and having a linter rule will help to catch it early on. AFAICT the 'function-paren-newline' set to 'multiline' or 'multiline-arguments' [0] should work.


[0] https://eslint.org/docs/rules/function-paren-newline

>>   	    remove_btn.setText(isUsedDisk && !isCloudInit ? remove_btn.altText : remove_btn.defaultText);
>>   	    remove_btn.RESTMethod = isUnusedDisk ? 'POST':'PUT';
>>   
>>
>