[pve-devel] [PATCH manager 2/7] ui: qemu/HardwareView: eslint: enforce "max-len" rule
Aaron Lauterer
a.lauterer at proxmox.com
Wed Feb 3 10:54:59 CET 2021
On 2/3/21 10:50 AM, Aaron Lauterer wrote:
>
>
> 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 at 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
Of course, this won't work in this use case as they are not parameters. I'll keep looking if there is a rule for this situation that could help.
>
>>> remove_btn.setText(isUsedDisk && !isCloudInit ? remove_btn.altText : remove_btn.defaultText);
>>> remove_btn.RESTMethod = isUnusedDisk ? 'POST':'PUT';
>>>
>>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list