1{ 2 "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], 3 "parser": "@typescript-eslint/parser", 4 "parserOptions": { 5 "ecmaVersion": "latest", 6 "sourceType": "module", 7 "project": true 8 }, 9 "plugins": ["@typescript-eslint", "@stylistic", "import", "n"], 10 "rules": { 11 // suggestions 12 "accessor-pairs": "error", 13 "arrow-body-style": ["error", "always"], 14 "camelcase": "off", // we use naming-convention rule to enforce naming scheme 15 "class-methods-use-this": ["error", { "exceptMethods": [], "enforceForClassFields": true }], 16 "complexity": ["error", { "max": 15 }], 17 "consistent-return": ["error", { "treatUndefinedAsUnspecified": false }], 18 "curly": ["error", "all"], 19 "default-case": "error", 20 "default-param-last": "warn", 21 "dot-notation": "error", 22 "eqeqeq": ["error", "smart"], 23 "func-style": ["error", "declaration", {"allowArrowFunctions": true}], 24 "max-depth": ["error", { "max": 4 }], 25 "max-lines-per-function": ["error", { "max": 50 }], 26 "max-params": ["error", 5], 27 "multiline-comment-style": ["error", "starred-block"], 28 "no-else-return": ["error", { "allowElseIf": true }], 29 "no-eval": ["error", {"allowIndirect": false} ], 30 "no-extra-bind": "error", 31 "no-implied-eval": "error", 32 "no-lonely-if": "error", 33 "no-nested-ternary": "warn", 34 "no-param-reassign": "warn", 35 "no-prototype-builtins": "error", 36 "no-regex-spaces": "error", 37 "no-return-await": "error", 38 "no-throw-literal": "error", 39 "no-undef-init": "error", 40 "no-unneeded-ternary": "error", 41 "no-useless-return": "error", 42 "no-var": "error", 43 "one-var": ["error", "never"], 44 "one-var-declaration-per-line": "error", 45 "prefer-const": "error", 46 "prefer-named-capture-group": "warn", 47 "prefer-rest-params": "error", 48 "strict": "error", 49 "spaced-comment": ["error", "always"], 50 "vars-on-top": "error", 51 52 // imports 53 "import/no-absolute-path": "error", 54 "n/file-extension-in-import": ["error", "never"], 55 56 // style 57 "@stylistic/array-bracket-newline": ["error", "consistent"], 58 "@stylistic/array-bracket-spacing": ["error", "never"], 59 "@stylistic/array-element-newline": ["error", "consistent"], 60 "@stylistic/arrow-parens": ["error", "always"], 61 "@stylistic/arrow-spacing": ["error", { "before": true, "after": true }], 62 "@stylistic/block-spacing": ["error", "always"], 63 "@stylistic/brace-style": ["error", "1tbs", { "allowSingleLine": true }], 64 "@stylistic/comma-dangle": [ 65 "error", 66 { 67 "arrays": "never", 68 "objects": "never", 69 "imports": "never", 70 "exports": "never", 71 "functions": "never" 72 } 73 ], 74 "@stylistic/comma-spacing": ["error", { "before": false, "after": true }], 75 "@stylistic/comma-style": ["error", "last"], 76 "@stylistic/computed-property-spacing": ["error", "never", { "enforceForClassMembers": true }], 77 "@stylistic/dot-location": ["error", "object"], 78 "@stylistic/eol-last": ["error", "always"], 79 "@stylistic/no-confusing-arrow": "error", 80 "@stylistic/no-floating-decimal": "error", 81 "@stylistic/func-call-spacing": ["error", "never"], 82 "@stylistic/function-call-argument-newline": ["error", "consistent"], 83 "@stylistic/function-paren-newline": ["error", "consistent"], 84 "@stylistic/generator-star-spacing": ["error", { "before": true, "after": false }], 85 "@stylistic/implicit-arrow-linebreak": ["error", "beside"], 86 "@stylistic/indent": [ 87 "error", 88 2, 89 { 90 "ignoredNodes": [], 91 "SwitchCase": 1, 92 "VariableDeclarator": 1, 93 "outerIIFEBody": 1, 94 "MemberExpression": 1, 95 "FunctionDeclaration": { 96 "parameters": 1, 97 "body": 1 98 }, 99 "FunctionExpression": { 100 "parameters": 1, 101 "body": 1 102 }, 103 "CallExpression": { 104 "arguments": 1 105 }, 106 "ArrayExpression": 1, 107 "ObjectExpression": 1, 108 "ImportDeclaration": 1, 109 "flatTernaryExpressions": true, 110 "offsetTernaryExpressions": false, 111 "ignoreComments": false 112 } 113 ], 114 "@stylistic/jsx-quotes": ["error", "prefer-double"], 115 "@stylistic/keyword-spacing": ["error", { "before": true, "after": true }], 116 "line-comment-position": ["error", { "position": "above" }], 117 "@stylistic/linebreak-style": ["error", "unix"], 118 "@stylistic/lines-around-comment": ["error", { "beforeBlockComment": true }], 119 "@stylistic/lines-between-class-members": [ 120 "error", 121 { 122 "enforce": [ 123 { "blankLine": "always", "prev": "*", "next": "method" }, 124 { "blankLine": "always", "prev": "method", "next": "*" } 125 ] 126 } 127 ], 128 "@stylistic/max-len": ["error", { "code": 120, "tabWidth": 2, "ignoreComments": true, "ignoreStrings": true }], 129 "@stylistic/max-statements-per-line": ["error", { "max": 1 }], 130 "@stylistic/multiline-ternary": ["error", "always-multiline"], 131 "@stylistic/new-parens": ["error", "always"], 132 "@stylistic/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }], 133 "@stylistic/no-extra-parens": ["error", "all"], 134 "@stylistic/no-mixed-spaces-and-tabs": "error", 135 "@stylistic/no-multi-spaces": "error", 136 "@stylistic/no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }], 137 "@stylistic/no-tabs": "error", 138 "@stylistic/no-trailing-spaces": ["error", { "skipBlankLines": false, "ignoreComments": false }], 139 "@stylistic/no-whitespace-before-property": "error", 140 "@stylistic/nonblock-statement-body-position": ["error", "beside"], 141 "@stylistic/object-curly-newline": ["error", { "consistent": true }], 142 "@stylistic/object-curly-spacing": ["error", "always"], 143 "@stylistic/operator-linebreak": ["error", "after"], 144 // disable due to conflict with required rule 'lines-around-comment' 145 "@stylistic/padded-blocks": "off", 146 "@stylistic/quotes": ["error", "single"], 147 "@stylistic/rest-spread-spacing": ["error", "never"], 148 "@stylistic/semi": ["error", "always"], 149 "@stylistic/semi-spacing": ["error", { "before": false, "after": true }], 150 "@stylistic/semi-style": ["error", "last"], 151 "@stylistic/space-before-blocks": ["error", "always"], 152 "@stylistic/space-before-function-paren": ["error", "never"], 153 "@stylistic/space-in-parens": ["error", "never"], 154 "@stylistic/space-infix-ops": ["error"], 155 "@stylistic/space-unary-ops": ["error", { "words": true, "nonwords": false, "overrides": {} }], 156 "@stylistic/switch-colon-spacing": ["error", { "after": true, "before": false }], 157 "@stylistic/template-curly-spacing": ["error", "never"], 158 "@stylistic/template-tag-spacing": ["error", "never"], 159 "unicode-bom": ["error", "never"], 160 "@stylistic/wrap-iife": ["error", "outside"], 161 "@stylistic/wrap-regex": "error", 162 "@stylistic/yield-star-spacing": ["error", { "before": true, "after": false }], 163 164 // typescript 165 "@typescript-eslint/explicit-function-return-type": "error", 166 "@typescript-eslint/adjacent-overload-signatures": "error", 167 "@typescript-eslint/consistent-type-exports": "error", 168 "@typescript-eslint/await-thenable": "error", 169 "@typescript-eslint/no-dynamic-delete": "error", 170 "@typescript-eslint/no-this-alias": "error", 171 "@typescript-eslint/explicit-member-accessibility": [ 172 "error", 173 { 174 "accessibility": "no-public" 175 } 176 ], 177 "@typescript-eslint/method-signature-style": "error", 178 "@typescript-eslint/no-confusing-non-null-assertion": "error", 179 "@typescript-eslint/no-confusing-void-expression": "error", 180 // FIXME(knazarov) 181 // need to do something about this 182 "@typescript-eslint/no-explicit-any": "warn", 183 // Produce too many warning caused by 'any' usage 184// "@typescript-eslint/no-unsafe-member-access": "warn", 185// "@typescript-eslint/no-unsafe-assignment": "warn", 186 "@typescript-eslint/no-unsafe-call": "warn", 187 "@typescript-eslint/no-unsafe-argument": "warn", 188 "@typescript-eslint/no-unsafe-return": "warn", 189 "no-unsafe-finally": "error", 190 "@typescript-eslint/no-extra-non-null-assertion": "error", 191 "@typescript-eslint/no-meaningless-void-operator": "error", 192 "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error", 193 // FIXME(knazarov) 194 // disabled due to many cases, where typescript deduces non-undefined value, but we can recieve one from the api 195 "@typescript-eslint/no-unnecessary-condition": "off", 196 "@typescript-eslint/no-unnecessary-type-assertion": "error", 197 "@typescript-eslint/prefer-as-const": "error", 198 "@typescript-eslint/prefer-optional-chain": "error", 199 "@typescript-eslint/prefer-readonly": "error", 200 "@typescript-eslint/consistent-type-imports": "error", 201 // FIXME(knazarov) 202 // need to change metadata in cookbook accordingle. so do it later 203 "@typescript-eslint/naming-convention": [ 204 "off", 205 { 206 "selector": "default", 207 "format": ["camelCase"] 208 }, 209 { 210 "selector": "enumMember", 211 "format": ["UPPER_CASE"] 212 }, 213 { 214 "selector": "variable", 215 "format": ["camelCase", "UPPER_CASE"] 216 }, 217 { 218 "selector": "typeLike", 219 "format": ["PascalCase"] 220 }, 221 { 222 "selector": "memberLike", 223 "format": ["camelCase"] 224 } 225 ] 226 } 227} 228