|
| 1 | +const tslintRules = { |
| 2 | + "align": [ |
| 3 | + true, |
| 4 | + "parameters", |
| 5 | + "arguments", |
| 6 | + "statements" |
| 7 | + ], |
| 8 | + "chai-vague-errors": true, |
| 9 | + "comment-format": [ |
| 10 | + true, |
| 11 | + "check-space" |
| 12 | + ], |
| 13 | + "create-async-actions": true, |
| 14 | + "export-name": false, |
| 15 | + "function-constructor": true, |
| 16 | + "function-name": [ |
| 17 | + true, |
| 18 | + { |
| 19 | + "method-regex": "^[a-z][\\w\\d]+$", |
| 20 | + "private-method-regex": "^[a-z][\\w\\d]+$", |
| 21 | + "static-method-regex": "^[a-z][\\w\\d]+$", |
| 22 | + "function-regex": "^[a-z][\\w\\d]+$" |
| 23 | + } |
| 24 | + ], |
| 25 | + "hex-format": true, |
| 26 | + "import-spacing": true, |
| 27 | + "increment-decrement": true, |
| 28 | + "jquery-deferred-must-complete": true, |
| 29 | + "jsdoc-format": true, |
| 30 | + "jsx-boolean-value": true, |
| 31 | + "jsx-curly-spacing": [ |
| 32 | + true, |
| 33 | + "never" |
| 34 | + ], |
| 35 | + "jsx-equals-spacing": [ |
| 36 | + true, |
| 37 | + "never" |
| 38 | + ], |
| 39 | + "jsx-key": true, |
| 40 | + "jsx-no-bind": true, |
| 41 | + "jsx-no-lambda": true, |
| 42 | + "jsx-no-multiline-js": true, |
| 43 | + "jsx-no-string-ref": true, |
| 44 | + "jsx-self-close": true, |
| 45 | + "jsx-space-before-closing-tag": [ |
| 46 | + true, |
| 47 | + "never" |
| 48 | + ], |
| 49 | + "jsx-wrap-multiline": true, |
| 50 | + "max-func-body-length": [ |
| 51 | + true, |
| 52 | + 150, |
| 53 | + { |
| 54 | + "ignore-parameters-to-function-regex": "describe" |
| 55 | + } |
| 56 | + ], |
| 57 | + "max-line-length": [ |
| 58 | + true, |
| 59 | + 120 |
| 60 | + ], |
| 61 | + "mocha-avoid-only": true, |
| 62 | + "no-backbone-get-set-outside-model": true, |
| 63 | + "no-cookies": true, |
| 64 | + "no-delete-expression": true, |
| 65 | + "no-disable-auto-sanitization": true, |
| 66 | + "no-document-domain": true, |
| 67 | + "no-document-write": true, |
| 68 | + "no-dup-actions": true, |
| 69 | + "no-duplicate-imports": true, |
| 70 | + "no-duplicate-variable": true, |
| 71 | + "no-exec-script": true, |
| 72 | + "no-for-in": true, |
| 73 | + "no-function-expression": true, |
| 74 | + "no-http-string": true, |
| 75 | + "no-implicit-dependencies": [ |
| 76 | + true, |
| 77 | + "dev" |
| 78 | + ], |
| 79 | + "no-inner-html": true, |
| 80 | + "no-jquery-raw-elements": true, |
| 81 | + "no-reference-import": true, |
| 82 | + "no-shadowed-variable": true, |
| 83 | + "no-string-based-set-immediate": true, |
| 84 | + "no-string-based-set-interval": true, |
| 85 | + "no-string-based-set-timeout": true, |
| 86 | + "no-trailing-whitespace": true, |
| 87 | + "no-unnecessary-local-variable": true, |
| 88 | + "no-unnecessary-override": true, |
| 89 | + "no-unused-expression": true, |
| 90 | + "no-with-statement": true, |
| 91 | + "object-literal-sort-keys": true, |
| 92 | + "one-line": [ |
| 93 | + true, |
| 94 | + "check-open-brace", |
| 95 | + "check-catch", |
| 96 | + "check-else", |
| 97 | + "check-whitespace" |
| 98 | + ], |
| 99 | + "only-arrow-functions": [ |
| 100 | + true, |
| 101 | + "allow-declarations", |
| 102 | + "allow-named-functions" |
| 103 | + ], |
| 104 | + "ordered-imports": [ |
| 105 | + true, |
| 106 | + { |
| 107 | + "import-sources-order": "case-insensitive", |
| 108 | + "module-source-path": "full", |
| 109 | + "named-imports-order": "case-insensitive" |
| 110 | + } |
| 111 | + ], |
| 112 | + "prefer-array-literal": true, |
| 113 | + "prefer-conditional-expression": true, |
| 114 | + "promise-must-complete": true, |
| 115 | + "quotemark": [ |
| 116 | + true, |
| 117 | + "double" |
| 118 | + ], |
| 119 | + "react-no-dangerous-html": [ |
| 120 | + true, |
| 121 | + [ |
| 122 | + { |
| 123 | + "file": "./src/app/containers/Html.tsx", |
| 124 | + "method": "render", |
| 125 | + "comment": "string comes from trusted source - our initial state" |
| 126 | + } |
| 127 | + ] |
| 128 | + ], |
| 129 | + "react-this-binding-issue": true, |
| 130 | + "semicolon": [ |
| 131 | + true, |
| 132 | + "always" |
| 133 | + ], |
| 134 | + "space-within-parens": [ |
| 135 | + true, |
| 136 | + 0 |
| 137 | + ], |
| 138 | + "trailing-comma": [ |
| 139 | + true, |
| 140 | + { |
| 141 | + "singleline": "never", |
| 142 | + "multiline": "never" |
| 143 | + } |
| 144 | + ], |
| 145 | + "triple-equals": [ |
| 146 | + true, |
| 147 | + "allow-null-check" |
| 148 | + ], |
| 149 | + "typedef": [ |
| 150 | + true, |
| 151 | + "call-signature", |
| 152 | + "parameter", |
| 153 | + "property-declaration", |
| 154 | + "member-variable-declaration" |
| 155 | + ], |
| 156 | + "unnecessary-bind": true, |
| 157 | + "use-named-parameter": true, |
| 158 | + "variable-name": [ |
| 159 | + true, |
| 160 | + "ban-keywords", |
| 161 | + "check-format", |
| 162 | + "allow-leading-underscore", |
| 163 | + "allow-pascal-case" |
| 164 | + ], |
| 165 | + "whitespace": [ |
| 166 | + true, |
| 167 | + "check-branch", |
| 168 | + "check-decl", |
| 169 | + "check-operator", |
| 170 | + "check-separator", |
| 171 | + "check-type" |
| 172 | + ] |
| 173 | +}; |
| 174 | + |
| 175 | +module.exports = { |
| 176 | + "env": { |
| 177 | + "browser": true, |
| 178 | + "node": true |
| 179 | + }, |
| 180 | + "overrides": [ |
| 181 | + { |
| 182 | + "files": ["*.stories.tsx"], |
| 183 | + "rules": { |
| 184 | + "@typescript-eslint/tslint/config": [ |
| 185 | + "error", |
| 186 | + { |
| 187 | + "rulesDirectory": [ |
| 188 | + "node_modules/tslint-react/rules", |
| 189 | + "node_modules/tslint-microsoft-contrib", |
| 190 | + "node_modules/@crazyfactory/tslint-rules/lib" |
| 191 | + ], |
| 192 | + "rules": { |
| 193 | + ...tslintRules, |
| 194 | + "jsx-no-lambda": false, |
| 195 | + "react-this-binding-issue": false, |
| 196 | + } |
| 197 | + } |
| 198 | + ] |
| 199 | + } |
| 200 | + } |
| 201 | + ], |
| 202 | + "parser": "@typescript-eslint/parser", |
| 203 | + "parserOptions": { |
| 204 | + "project": "tsconfig.json", |
| 205 | + "sourceType": "module" |
| 206 | + }, |
| 207 | + "plugins": [ |
| 208 | + "@typescript-eslint", |
| 209 | + "@typescript-eslint/tslint" |
| 210 | + ], |
| 211 | + "rules": { |
| 212 | + "@typescript-eslint/adjacent-overload-signatures": "error", |
| 213 | + "@typescript-eslint/array-type": "error", |
| 214 | + "@typescript-eslint/ban-types": "error", |
| 215 | + "@typescript-eslint/class-name-casing": "error", |
| 216 | + "@typescript-eslint/consistent-type-assertions": "error", |
| 217 | + "@typescript-eslint/explicit-member-accessibility": [ |
| 218 | + "error", |
| 219 | + { |
| 220 | + "overrides": { |
| 221 | + "constructors": "off" |
| 222 | + } |
| 223 | + } |
| 224 | + ], |
| 225 | + "@typescript-eslint/indent": [ |
| 226 | + "error", |
| 227 | + 2 |
| 228 | + ], |
| 229 | + "@typescript-eslint/interface-name-prefix": [ |
| 230 | + "error", |
| 231 | + { |
| 232 | + "prefixWithI": "always" |
| 233 | + } |
| 234 | + ], |
| 235 | + "@typescript-eslint/member-ordering": "error", |
| 236 | + "@typescript-eslint/no-empty-function": "error", |
| 237 | + "@typescript-eslint/no-empty-interface": "error", |
| 238 | + "@typescript-eslint/no-explicit-any": "off", |
| 239 | + "@typescript-eslint/no-extraneous-class": "error", |
| 240 | + "@typescript-eslint/no-inferrable-types": "off", |
| 241 | + "@typescript-eslint/no-misused-new": "error", |
| 242 | + "@typescript-eslint/no-namespace": "off", |
| 243 | + "@typescript-eslint/no-parameter-properties": "off", |
| 244 | + "@typescript-eslint/no-require-imports": "off", |
| 245 | + "@typescript-eslint/no-this-alias": "error", |
| 246 | + "@typescript-eslint/no-use-before-declare": "off", |
| 247 | + "@typescript-eslint/no-var-requires": "off", |
| 248 | + "@typescript-eslint/prefer-for-of": "error", |
| 249 | + "@typescript-eslint/prefer-function-type": "error", |
| 250 | + "@typescript-eslint/prefer-namespace-keyword": "off", |
| 251 | + "@typescript-eslint/type-annotation-spacing": "error", |
| 252 | + "@typescript-eslint/unified-signatures": "error", |
| 253 | + "arrow-parens": [ |
| 254 | + "error", |
| 255 | + "always" |
| 256 | + ], |
| 257 | + "complexity": "off", |
| 258 | + "constructor-super": "error", |
| 259 | + "curly": "error", |
| 260 | + "default-case": "error", |
| 261 | + "dot-notation": "error", |
| 262 | + "eol-last": "off", |
| 263 | + "guard-for-in": "error", |
| 264 | + "max-classes-per-file": [ |
| 265 | + "error", |
| 266 | + 1 |
| 267 | + ], |
| 268 | + "member-ordering": "off", |
| 269 | + "new-parens": "error", |
| 270 | + "no-bitwise": "error", |
| 271 | + "no-caller": "error", |
| 272 | + "no-cond-assign": "error", |
| 273 | + "no-console": [ |
| 274 | + "error", |
| 275 | + { |
| 276 | + "allow": [ |
| 277 | + "error", |
| 278 | + "debug", |
| 279 | + "info", |
| 280 | + "time", |
| 281 | + "timeEnd", |
| 282 | + "trace", |
| 283 | + "warn" |
| 284 | + ] |
| 285 | + } |
| 286 | + ], |
| 287 | + "no-constant-condition": "error", |
| 288 | + "no-control-regex": "error", |
| 289 | + "no-debugger": "error", |
| 290 | + "no-duplicate-case": "error", |
| 291 | + "no-empty": "error", |
| 292 | + "no-empty-function": "off", |
| 293 | + "no-eval": "error", |
| 294 | + "no-extra-bind": "error", |
| 295 | + "no-extra-semi": "error", |
| 296 | + "no-fallthrough": "off", |
| 297 | + "no-invalid-regexp": "error", |
| 298 | + "no-invalid-this": "error", |
| 299 | + "no-multi-str": "off", |
| 300 | + "no-multiple-empty-lines": "error", |
| 301 | + "no-new-func": "error", |
| 302 | + "no-new-wrappers": "error", |
| 303 | + "no-octal": "error", |
| 304 | + "no-octal-escape": "error", |
| 305 | + "no-regex-spaces": "error", |
| 306 | + "no-return-await": "error", |
| 307 | + "no-sequences": "error", |
| 308 | + "no-sparse-arrays": "error", |
| 309 | + "no-template-curly-in-string": "error", |
| 310 | + "no-throw-literal": "error", |
| 311 | + "no-undef-init": "error", |
| 312 | + "no-unsafe-finally": "error", |
| 313 | + "no-unused-labels": "error", |
| 314 | + "no-var": "error", |
| 315 | + "object-shorthand": "error", |
| 316 | + "one-var": "off", |
| 317 | + "prefer-const": "error", |
| 318 | + "prefer-object-spread": "error", |
| 319 | + "quote-props": [ |
| 320 | + "error", |
| 321 | + "consistent-as-needed" |
| 322 | + ], |
| 323 | + "radix": "error", |
| 324 | + "space-before-function-paren": [ |
| 325 | + "error", |
| 326 | + "never" |
| 327 | + ], |
| 328 | + "use-isnan": "error", |
| 329 | + "valid-typeof": "off", |
| 330 | + "@typescript-eslint/tslint/config": [ |
| 331 | + "error", |
| 332 | + { |
| 333 | + "rulesDirectory": [ |
| 334 | + "node_modules/tslint-react/rules", |
| 335 | + "node_modules/tslint-microsoft-contrib", |
| 336 | + "node_modules/@crazyfactory/tslint-rules/lib" |
| 337 | + ], |
| 338 | + "rules": tslintRules |
| 339 | + } |
| 340 | + ] |
| 341 | + } |
| 342 | +}; |
0 commit comments