diff --git a/.eslintrc b/.eslintrc index 4883780d..58edaf12 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,7 +5,8 @@ }, "rules": { // Possible errors - "no-extra-parens": 2, + "no-cond-assign": 2, // TODO: conflicts with no-extra-parens for while use case + "no-extra-parens": 0, // For now going with 0 since 1 does more harm than good "no-unexpected-multiline": 2, "valid-jsdoc": 2, "valid-typeof": 2, @@ -14,7 +15,7 @@ "accessor-pairs": 2, "block-scoped-var": 2, "complexity": 0, - "consistent-return": 2, + "consistent-return": 1, "curly": 2, "dot-location": [2, "property"], // defaults to "object" "dot-notation": 2, @@ -23,7 +24,7 @@ "no-alert": 1, // `2` is recommended "no-caller": 2, "no-div-regex": 2, - "no-else-return": 2, + "no-else-return": 0, // `2` may be ok, but indent consistency is better "no-empty-label": 2, "no-empty-pattern": 2, "no-eq-null": 2, @@ -32,14 +33,14 @@ "no-extra-bind": 2, "no-fallthrough": 1, // `2` is recommended "no-floating-decimal": 1, // `2` is recommended - "no-implicit-coercion": [1, {"boolean": true, "number": true, "string": false}], // `[2, {"boolean": true, "number": true, "string": true}],` is recommended + "no-implicit-coercion": [2, {"boolean": false, "number": true, "string": false}], // `[2, {"boolean": true, "number": true, "string": true}],` is recommended "no-implied-eval": 2, "no-invalid-this": 1, // `2` is recommended "no-iterator": 2, "no-labels": 2, "no-lone-blocks": 2, "no-loop-func": 2, - "no-magic-numbers": 1, + "no-magic-numbers": 0, // `1` would also be fine "no-multi-spaces": 2, "no-multi-str": 2, "no-native-reassign": 2, @@ -49,7 +50,7 @@ "no-octal-escape": 2, "no-octal": 2, "no-param-reassign": 2, - "no-process-env": 1, // `2` is recommended + "no-process-env": 0, // `2` is recommended "no-proto": 2, "no-redeclare": [2, {"builtinGlobals": true}], // `2` is recommended and actually defaults to `[2, {"builtinGlobals": false}]` "no-return-assign": [2, "except-parens"], @@ -64,7 +65,7 @@ "no-warning-comments": 1, // `[0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }]` is recommended "no-with": 2, "radix": 1, // `2` is recommended - "vars-on-top": 1, // `2` is recommended + "vars-on-top": 0, // `2` is recommended TODO: review this "wrap-iife": [2, "inside"], // `[2, "outside"]` is recommended "yoda": 2, // `[2, "never"]` is recommended, optionally set `[2, "never", {"exceptRange": true, "onlyEquality": false}] @@ -76,10 +77,10 @@ "no-delete-var": 2, "no-label-var": 2, "no-shadow-restricted-names": 2, - "no-shadow": 1, + "no-shadow": 0, // TODO: 1 may be ok "no-undefined": 2, "no-unused-vars": 1, - "no-use-before-define": 2, + "no-use-before-define": 1, // TODO: 0 or 2 may be ok, sometimes there are ciclic dependencies // Style "array-bracket-spacing": [2, "never"], // optionally set `[2, "never", {"singleValue": true, "objectsInArrays": true, "arraysInArrays": true}]` @@ -91,27 +92,28 @@ "computed-property-spacing": [2, "never"], "consistent-this": [2, "self"], "eol-last": 2, - "func-names": 1, // TODO: might be too much + "func-names": 0, "func-style": 0, // optionally set `[2, "expression"]` "id-length": 0, // optionally set `[2, {"min": 3, "max": 10, "properties": "never", "exceptions": ["x"]}]` "id-match": 0, // optionally set `[2, "^[a-z]+([A-Z][a-z]+)*$", {"properties": false}]` - "indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": 2}], // TODO: optionally set `[2, 2, {"SwitchCase": 1, "VariableDeclarator": {"var": 2, "let": 2, "const": 3}}]` + "indent": [0, 2, {"SwitchCase": 0, "VariableDeclarator": 2}], // TODO: optionally set `[2, 2, {"SwitchCase": 1, "VariableDeclarator": {"var": 2, "let": 2, "const": 3}}]` this gives too many errors "jsx-quotes": [2, "prefer-single"], "key-spacing": [2, {"beforeColon": false, "afterColon": true, "mode": "strict"}], // optionally set `[2, {"beforeColon": false, "afterColon": true, "mode": "strict", "align": "colon"}]` "lines-around-comment": 2, // optionally set `[2, {"beforeBlockComment": true, "beforeLineComment": true, "allowBlockStart": true}]` "linebreak-style": 0, // optionally set `[1, "unix"]` - "max-nested-callbacks": [1, 3], + "max-len": [2, 100, 2, {"ignoreComments": true, "ignoreUrls": true}], // NOTE: Our limit is 80 however ESLint does not have an ignoreStrings so lets have more buffer + "max-nested-callbacks": [1, 5], "new-cap": 2, // optionally set `[2, {"capIsNewExceptions": ["Person"]}]` "new-parens": 2, - "newline-after-var": [2, "always"], + "newline-after-var": [0, "always"], // TODO: 1 may be ok "no-array-constructor": 2, - "no-bitwise": 1, + "no-bitwise": 0, // We use them "no-continue": 1, "no-inline-comments": 0, - "no-lonely-if": 1, + "no-lonely-if": 0, // TODO: 1 may be ok "no-mixed-spaces-and-tabs": 2, // optionally set `[2, "smart-tabs"]` - "no-multiple-empty-lines": [1, {"max": 2, "maxEOF": 1}], - "no-negated-condition": 1, + "no-multiple-empty-lines": [1, {"max": 2}], + "no-negated-condition": 0, // Prioritize intent order over readability "no-nested-ternary": 2, "no-new-object": 2, // TODO: check this one "no-plusplus": 0, @@ -121,10 +123,10 @@ "no-trailing-spaces": [2, {"skipBlankLines": true}], "no-underscore-dangle": 0, "no-unneeded-ternary": [2, {"defaultAssignment": false}], - "object-curly-spacing": [2, "never"], // optionally set `[2, "always", {"objectsInObjects": false, "arraysInObjects": false}]` - "one-var": [2, {"uninitialized": "always", "initialized": "always"}], // optionally set `[2, {"var": "always", "let": "never", "const": "never"}]` + "object-curly-spacing": [2, "never"], // optionally set `[2, "always", {"objectsInObjects": false, "arraysInObjects": false}]` // TODO: check if always or never is being more used + "one-var": [2, {"uninitialized": "always", "initialized": "never"}], // optionally set `[2, {"var": "always", "let": "never", "const": "never"}]` "operator-assignment": [2, "always"], // optionally set `[2, "always"]` - "operator-linebreak": [2, "after"], // optionally set `[2, "before", {"overrides": {"?": "after"}}]` + "operator-linebreak": [2, "after"], // optionally set `[2, "before", {"overrides": {"?": "after"}}]` // TODO: check for conditionals "padded-blocks": [2, "never"], "quote-props": [2, "consistent-as-needed"], "quotes": [2, "single", "avoid-escape"], @@ -140,17 +142,17 @@ "space-infix-ops": 2, "space-return-throw-case": 2, "space-unary-ops": [2, {"words": true, "nonwords": false}], - "spaced-comment": [2, "always", {"exceptions": ["/"]}], // optionally set `[2, "always", {"exceptions": ["-", "+"], "markers": ["/"]}]` - "wrap-regex": 2, + "spaced-comment": [1, "always", {"exceptions": ["/"]}], // optionally set `[2, "always", {"exceptions": ["-", "+"], "markers": ["/"]}]` + "wrap-regex": 0, // TODO: 2 is ok but the division edge case is too edgy // Node.js / Common.js "callback-return": 1, // `2` is default, optionally set `[2, ["callback", "cb", "next"]]` - "global-require": 1, // `2` is default + "global-require": 0, // `2` is default "handle-callback-err": 1, // `2` is default, optionally set `[2, "^(err|error)$"]` - "no-mixed-requires": [1, {"grouping": true}], // [2, false] is default + "no-mixed-requires": [0, {"grouping": true}], // [2, false] is default "no-new-require": 2, // `2` is default "no-path-concat": 2, // `2` is default - "no-process-exit": 2, // `2` is default + "no-process-exit": 0, // `2` is default "no-restricted-modules": 0, // no default, optionally set `[2, "fs", "os"]` "no-sync": 1 // `2` is default }