From 46d05009cc38f7c1c97f5bb42d3c018cb606b681 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 21:12:27 +0400 Subject: feat(sonarjs): Added rules Signed-off-by: Valentin Popov --- ROADMAP.md | 50 +++++++++++++------------- src/rules/sonarjs/default.json | 81 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 26 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index d47b7fb..c85dd63 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -353,31 +353,31 @@ ## SonarJS -- [ ] "cognitive-complexity" -- [ ] "max-switch-cases" -- [ ] "no-all-duplicated-branches" -- [ ] "no-collapsible-if" -- [ ] "no-collection-size-mischeck" -- [ ] "no-duplicate-string" -- [ ] "no-duplicated-branches" -- [ ] "no-element-overwrite" -- [ ] "no-extra-arguments" -- [ ] "no-identical-conditions" -- [ ] "no-identical-expressions" -- [ ] "no-identical-functions" -- [ ] "no-inverted-boolean-check" -- [ ] "no-one-iteration-loop" -- [ ] "no-redundant-boolean" -- [ ] "no-redundant-jump" -- [ ] "no-same-line-conditional" -- [ ] "no-small-switch" -- [ ] "no-unused-collection" -- [ ] "no-use-of-empty-return-value" -- [ ] "no-useless-catch" -- [ ] "prefer-immediate-return" -- [ ] "prefer-object-literal" -- [ ] "prefer-single-boolean-return" -- [ ] "prefer-while" +- [X] "cognitive-complexity" +- [X] "max-switch-cases" +- [X] "no-all-duplicated-branches" +- [X] "no-collapsible-if" +- [X] "no-collection-size-mischeck" +- [X] "no-duplicate-string" +- [X] "no-duplicated-branches" +- [X] "no-element-overwrite" +- [X] "no-extra-arguments" +- [X] "no-identical-conditions" +- [X] "no-identical-expressions" +- [X] "no-identical-functions" +- [X] "no-inverted-boolean-check" +- [X] "no-one-iteration-loop" +- [X] "no-redundant-boolean" +- [X] "no-redundant-jump" +- [X] "no-same-line-conditional" +- [X] "no-small-switch" +- [X] "no-unused-collection" +- [X] "no-use-of-empty-return-value" +- [X] "no-useless-catch" +- [X] "prefer-immediate-return" +- [X] "prefer-object-literal" +- [X] "prefer-single-boolean-return" +- [X] "prefer-while" ## TypeScript diff --git a/src/rules/sonarjs/default.json b/src/rules/sonarjs/default.json index 0967ef4..cc5897a 100644 --- a/src/rules/sonarjs/default.json +++ b/src/rules/sonarjs/default.json @@ -1 +1,80 @@ -{} +{ + "sonarjs/cognitive-complexity": [ + "warn", + 25 + ], + "sonarjs/max-switch-cases": [ + "warn", + 30 + ], + "sonarjs/no-all-duplicated-branches": [ + "error" + ], + "sonarjs/no-collapsible-if": [ + "error" + ], + "sonarjs/no-collection-size-mischeck": [ + "error" + ], + "sonarjs/no-duplicate-string": [ + "warn", + 5 + ], + "sonarjs/no-duplicated-branches": [ + "error" + ], + "sonarjs/no-element-overwrite": [ + "error" + ], + "sonarjs/no-extra-arguments": [ + "error" + ], + "sonarjs/no-identical-conditions": [ + "error" + ], + "sonarjs/no-identical-expressions": [ + "error" + ], + "sonarjs/no-identical-functions": [ + "error" + ], + "sonarjs/no-inverted-boolean-check": [ + "error" + ], + "sonarjs/no-one-iteration-loop": [ + "error" + ], + "sonarjs/no-redundant-boolean": [ + "error" + ], + "sonarjs/no-redundant-jump": [ + "error" + ], + "sonarjs/no-same-line-conditional": [ + "error" + ], + "sonarjs/no-small-switch": [ + "error" + ], + "sonarjs/no-unused-collection": [ + "error" + ], + "sonarjs/no-use-of-empty-return-value": [ + "error" + ], + "sonarjs/no-useless-catch": [ + "warn" + ], + "sonarjs/please-immediate-return": [ + "error" + ], + "sonarjs/prefer-object-literal": [ + "error" + ], + "sonarjs/prefer-single-boolean-return": [ + "error" + ], + "sonarjs/prefer-while": [ + "error" + ] +} -- cgit v1.2.3