]> git.proxmox.com Git - pve-eslint.git/commitdiff
improve no-extra-parens rule
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 6 Jun 2020 13:19:39 +0000 (15:19 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 6 Jun 2020 14:29:00 +0000 (16:29 +0200)
We use both, 'no-extra-parens' and 'no-mixed-operators' rules and
those can conflict. Thus follow eslints recommendation[0] and allow
parenthesis in nestedBinaryExpressions to avoid the linter
complaining either way. Do this also fo enforceForArrowConditionals
as there I saw the issue already in practice for me.

[0]: https://eslint.org/docs/rules/no-mixed-operators#rule-details

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/app.js

index 5530615f06664acd5714063b66a8ad42d40c6145..34749b1d5c22e178955fa22ba97008d2b0f83854 100644 (file)
@@ -145,7 +145,11 @@ const defaultConfig = {
        "no-extend-native": "error",
        "no-extra-bind": "error",
        "no-extra-label": "error",
-       "no-extra-parens": "error",
+       "no-extra-parens": ["error", "all", {
+           "conditionalAssign": false, // useful for if ((match = str.match(/.../))) lines
+           "enforceForArrowConditionals": false,
+           "nestedBinaryExpressions": false,
+       }],
        "no-floating-decimal": "error",
        "no-implicit-coercion": ["error", { allow: ["!!"] }],
        "no-implicit-globals": "error",