diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/javascript.ts | 2 | ||||
-rw-r--r-- | src/rules/import/default.json | 25 | ||||
-rw-r--r-- | src/rules/sonarjs/default.json | 81 | ||||
-rw-r--r-- | src/rules/typescript/default.json | 56 | ||||
-rw-r--r-- | src/rules/unicorn/default.json | 9 | ||||
-rw-r--r-- | src/typescript.ts | 3 | ||||
-rw-r--r-- | src/vue-typescript.ts | 1 |
7 files changed, 173 insertions, 4 deletions
diff --git a/src/javascript.ts b/src/javascript.ts index bd02c45..b7917e2 100644 --- a/src/javascript.ts +++ b/src/javascript.ts @@ -1,6 +1,6 @@ import rComments from "./rules/eslint-comments/default.json"; -import rDefault from "./rules/javascript/default.json"; import rImport from "./rules/import/default.json"; +import rDefault from "./rules/javascript/default.json"; import rSecurity from "./rules/security/default.json"; import rSonarJS from "./rules/sonarjs/default.json"; import rUnicorn from "./rules/unicorn/default.json"; diff --git a/src/rules/import/default.json b/src/rules/import/default.json index 77ec282..291e45f 100644 --- a/src/rules/import/default.json +++ b/src/rules/import/default.json @@ -13,5 +13,30 @@ ], "import/no-webpack-loader-syntax": [ "error" + ], + "import/order": [ + "error", + { + "alphabetize": { + "caseInsensitive": false, + "order": "asc" + }, + "groups": [ + [ + "builtin", + "external" + ], + [ + "internal", + "parent", + "sibling" + ], + [ + "index" + ], + "unknown" + ], + "newlines-between": "always" + } ] } diff --git a/src/rules/sonarjs/default.json b/src/rules/sonarjs/default.json index 0967ef4..5c39836 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/prefer-immediate-return": [ + "error" + ], + "sonarjs/prefer-object-literal": [ + "error" + ], + "sonarjs/prefer-single-boolean-return": [ + "error" + ], + "sonarjs/prefer-while": [ + "error" + ] +} diff --git a/src/rules/typescript/default.json b/src/rules/typescript/default.json index 43ad740..fe556bc 100644 --- a/src/rules/typescript/default.json +++ b/src/rules/typescript/default.json @@ -2,6 +2,10 @@ "@typescript-eslint/await-thenable": [ "error" ], + "@typescript-eslint/class-literal-property-style": [ + "error", + "getters" + ], "@typescript-eslint/comma-spacing": [ "error", { @@ -64,6 +68,9 @@ "prefixWithI": "always" } ], + "@typescript-eslint/no-base-to-string": [ + "error" + ], "@typescript-eslint/no-empty-interface": [ "warn", { @@ -73,7 +80,7 @@ "@typescript-eslint/no-explicit-any": [ "warn", { - "fixToUnknown": false, + "fixToUnknown": true, "ignoreRestArgs": false } ], @@ -115,6 +122,26 @@ "allowTupleTypes": "in-unions-and-intersections" } ], + "@typescript-eslint/no-unnecessary-condition": [ + "error", + { + "allowConstantLoopConditions": false, + "checkArrayPredicates": true, + "ignoreRhs": true + } + ], + "@typescript-eslint/no-unnecessary-type-assertion": [ + "error" + ], + "@typescript-eslint/no-unsafe-call": [ + "error" + ], + "@typescript-eslint/no-unsafe-member-access": [ + "error" + ], + "@typescript-eslint/no-unsafe-return": [ + "error" + ], "@typescript-eslint/no-untyped-public-signature": [ "warn", { @@ -151,6 +178,12 @@ "@typescript-eslint/no-var-requires": [ "error" ], + "@typescript-eslint/prefer-readonly-parameter-types": [ + "error", + { + "checkParameterProperties": true + } + ], "@typescript-eslint/quotes": [ "error", "double", @@ -188,6 +221,8 @@ "@typescript-eslint/type-annotation-spacing": [ "error", { + "after": true, + "before": true, "overrides": { "arrow": { "after": true, @@ -196,6 +231,22 @@ "colon": { "after": true, "before": false + }, + "parameter": { + "after": true, + "before": true + }, + "property": { + "after": true, + "before": true + }, + "returnType": { + "after": true, + "before": true + }, + "variable": { + "after": true, + "before": true } } } @@ -209,7 +260,8 @@ "objectDestructuring": true, "parameter": true, "propertyDeclaration": true, - "variableDeclaration": true + "variableDeclaration": true, + "variableDeclarationIgnoreFunction": false } ], "comma-spacing": [ diff --git a/src/rules/unicorn/default.json b/src/rules/unicorn/default.json index 435ef7e..bf11b2b 100644 --- a/src/rules/unicorn/default.json +++ b/src/rules/unicorn/default.json @@ -17,6 +17,12 @@ "unicorn/no-console-spaces": [ "error" ], + "unicorn/prefer-number-properties": [ + "error" + ], + "unicorn/prefer-set-has": [ + "error" + ], "unicorn/prevent-abbreviations": [ "error", { @@ -31,5 +37,8 @@ "replacements": {}, "whitelist": {} } + ], + "unicorn/string-content": [ + "error" ] } diff --git a/src/typescript.ts b/src/typescript.ts index ace7ad7..6295159 100644 --- a/src/typescript.ts +++ b/src/typescript.ts @@ -9,6 +9,9 @@ module.exports = { "plugin:import/typescript", ], "parser": "@typescript-eslint/parser", + "parserOptions": { + createDefaultProgram: true, + }, "plugins": [ "@typescript-eslint", ], diff --git a/src/vue-typescript.ts b/src/vue-typescript.ts index bbef943..f44c6f2 100644 --- a/src/vue-typescript.ts +++ b/src/vue-typescript.ts @@ -10,6 +10,7 @@ module.exports = { ], "parser": "vue-eslint-parser", "parserOptions": { + createDefaultProgram: true, extraFileExtensions: [ ".vue", ], |