From f914f50c87061ab500f40fb5b17a937dd6e24f44 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Fri, 24 Aug 2018 20:26:07 +0200 Subject: [PATCH] Update tslint rules --- ui/tslint.json | 123 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 112 insertions(+), 11 deletions(-) diff --git a/ui/tslint.json b/ui/tslint.json index 2a25f54..74d2f7a 100644 --- a/ui/tslint.json +++ b/ui/tslint.json @@ -1,19 +1,120 @@ { - "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"], - "jsRules": { - "object-literal-sort-keys": false, - "no-console": false - }, + "extends": "tslint-sonarts", "rules": { - "object-literal-sort-keys": false, - "jsx-boolean-value": false, - "no-console": false, - "jsx-no-lambda": false + "array-type": [true, "array-simple"], + "arrow-return-shorthand": true, + "ban": [true, + {"name": "Array", "message": "tsstyle#array-constructor"} + ], + "ban-types": [true, + ["Object", "Use {} instead."], + ["String", "Use 'string' instead."], + ["Number", "Use 'number' instead."], + ["Boolean", "Use 'boolean' instead."], + ["Function", "Use (..) => .. instead."] + ], + "class-name": true, + "curly": [true], + "forin": true, + "label-position": true, + "member-access": [true], + "new-parens": true, + "no-angle-bracket-type-assertion": true, + "no-any": true, + "no-arg": true, + "no-conditional-assignment": true, + "no-construct": true, + "no-shadowed-variable": true, + "prefer-object-spread": true, + "no-debugger": true, + "no-default-export": false, + "no-duplicate-variable": true, + "no-inferrable-types": true, + "no-namespace": [true, "allow-declarations"], + "cyclomatic-complexity": [true, 13], + "no-duplicate-imports": true, + "no-reference": true, + "no-string-throw": true, + "no-unused-expression": true, + "no-var-keyword": true, + "object-literal-shorthand": true, + "only-arrow-functions": [true, "allow-declarations", "allow-named-functions"], + "prefer-const": true, + "radix": true, + "semicolon": [true, "always", "ignore-bound-class-methods"], + "switch-default": true, + "triple-equals": [true, "allow-null-check"], + "use-isnan": true, + "variable-name": [ + true, + "check-format", + "ban-keywords", + "allow-pascal-case", + "allow-leading-underscore", + "allow-trailing-underscore" + ], + + "cognitive-complexity": true, + "mccabe-complexity": true, + "no-duplicate-string": true, + "no-nested-incdec": false, + "no-all-duplicated-branches": true, + "consecutive-overloads": true, + "max-union-size": false, + "no-accessor-field-mismatch": true, + "no-array-delete": true, + "no-big-function": true, + "no-case-with-or": true, + "no-collection-size-mischeck": true, + "no-commented-code": true, + "no-dead-store": true, + "no-duplicate-in-composite": true, + "no-duplicated-branches": true, + "no-element-overwrite": true, + "no-empty-destructuring": true, + "no-empty-nested-blocks": true, + "no-extra-semicolon": true, + "no-gratuitous-expressions": true, + "no-hardcoded-credentials": true, + "no-identical-conditions": true, + "no-identical-expressions": true, + "no-identical-functions": true, + "no-ignored-initial-value": true, + "no-ignored-return": true, + "no-in-misuse": true, + "no-inconsistent-return": true, + "no-misleading-array-reverse": true, + "no-misspelled-operator": true, + "no-multiline-string-literals": true, + "no-nested-template-literals": true, + "no-redundant-boolean": true, + "no-redundant-jump": true, + "no-redundant-parentheses": true, + "no-return-type-any": true, + "no-same-line-conditional": true, + "no-self-assignment": true, + "no-small-switch": true, + "no-statements-same-line": true, + "no-unconditional-jump": true, + "no-undefined-argument": true, + "no-unenclosed-multiline-block": true, + "no-unthrown-error": true, + "no-unused-array": true, + "no-use-of-empty-return-value": true, + "no-useless-cast": true, + "no-useless-increment": true, + "no-useless-intersection": true, + "no-variable-usage-before-declaration": true, + "parameters-max-number": true, + "prefer-default-last": true, + "prefer-immediate-return": true, + "prefer-promise-shorthand": true, + "use-primitive-type": true, + "use-type-alias": true }, "linterOptions": { "exclude": [ - "config/**/*.js", "node_modules/**/*.ts" ] } -} +} \ No newline at end of file