From a40468c437f05bb9d974250de2d433611037d588 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 20:04:51 +0400 Subject: Updated Unicorn to v18.0.0 Signed-off-by: Valentin Popov --- ROADMAP.md | 3 ++- package.json | 4 ++-- src/rules/unicorn/default.json | 9 +++++++ yarn.lock | 53 +++++++++++------------------------------- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 6e21048..4ab6b9c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -507,9 +507,11 @@ - [ ] "prefer-negative-index" - [ ] "prefer-node-append" - [ ] "prefer-node-remove" +- [X] "prefer-number-properties" - [ ] "prefer-query-selector" - [ ] "prefer-reflect-apply" - [ ] "prefer-replace-all" +- [X] "prefer-set-has" - [ ] "prefer-spread" - [ ] "prefer-starts-ends-with" - [ ] "prefer-string-slice" @@ -517,7 +519,6 @@ - [ ] "prefer-trim-start-end" - [ ] "prefer-type-error" - [X] "prevent-abbreviations" -- [ ] "regex-shorthand" - [ ] "throw-new-error" ## Vue diff --git a/package.json b/package.json index 1ecdd14..37b6584 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "eslint-plugin-import": "^2.20.1", "eslint-plugin-security": "^1.4.0", "eslint-plugin-sonarjs": "^0.5.0", - "eslint-plugin-unicorn": "^16.1.1", + "eslint-plugin-unicorn": "^18.0.0", "eslint-plugin-vue": "^6.2.1", "rollup": "^1.31.1", "rollup-plugin-terser": "^5.2.0", @@ -35,7 +35,7 @@ "eslint-plugin-import": "^2.20.1", "eslint-plugin-security": "^1.4.0", "eslint-plugin-sonarjs": "^0.5.0", - "eslint-plugin-unicorn": "^16.1.1", + "eslint-plugin-unicorn": "^18.0.0", "eslint-plugin-vue": "^6.1.2" }, "dependencies": {} diff --git a/src/rules/unicorn/default.json b/src/rules/unicorn/default.json index 7a7dc1b..bb3abab 100644 --- a/src/rules/unicorn/default.json +++ b/src/rules/unicorn/default.json @@ -11,6 +11,12 @@ "unicorn/no-console-spaces": [ "error" ], + "unicorn/prefer-number-properties": [ + "error" + ], + "unicorn/prefer-set-has": [ + "error" + ], "unicorn/prevent-abbreviations": [ "error", { @@ -25,5 +31,8 @@ "replacements": {}, "whitelist": {} } + ], + "unicorn/string-content": [ + "error" ] } diff --git a/yarn.lock b/yarn.lock index 5a3a87a..eb928f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -431,27 +431,22 @@ eslint-plugin-sonarjs@^0.5.0: resolved "https://registry.yarnpkg.com/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.5.0.tgz#ce17b2daba65a874c2862213a9e38e8986ad7d7d" integrity sha512-XW5MnzlRjhXpIdbULC/qAdJYHWw3rRLws/DyawdlPU/IdVr9AmRK1r2LaCvabwKOAW2XYYSo3kDX58E4MrB7PQ== -eslint-plugin-unicorn@^16.1.1: - version "16.1.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-16.1.1.tgz#012c598d71914ef30f5d386dd85110e59f2ef999" - integrity sha512-IMxCsntb0T8s660Irc40gtzXtxuXHcOn36G9G8OYKfiseBD/kNrA1cNJhsJ0xQteDASGrFwqdzBsYEkUvczhOA== +eslint-plugin-unicorn@^18.0.0: + version "18.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-18.0.0.tgz#94a8477d47f4d25fc931a27658dff44c0fcbc192" + integrity sha512-2mk3Cz6H2LCsKSEmJ7Wmqm/XbMAQ55+PjSBFM2Yh1/A7uk2gryNNhdfbFDycsjs/ylqk0m7LJ4qPpK9OlP8f9A== dependencies: ci-info "^2.0.0" clean-regexp "^1.0.0" eslint-ast-utils "^1.1.0" eslint-template-visitor "^1.1.0" import-modules "^2.0.0" - lodash.camelcase "^4.3.0" - lodash.defaultsdeep "^4.6.1" - lodash.kebabcase "^4.1.1" - lodash.snakecase "^4.1.1" - lodash.upperfirst "^4.3.1" + lodash "^4.17.15" read-pkg-up "^7.0.1" - regexp-tree "^0.1.17" - regexpp "^3.0.0" + regexp-tree "^0.1.21" reserved-words "^0.1.2" safe-regex "^2.1.1" - semver "^7.1.2" + semver "^7.1.3" eslint-plugin-vue@^6.2.1: version "6.2.1" @@ -929,36 +924,11 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash.camelcase@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" - integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= - -lodash.defaultsdeep@^4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6" - integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA== - lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= -lodash.kebabcase@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" - integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= - -lodash.snakecase@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" - integrity sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40= - -lodash.upperfirst@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" - integrity sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984= - lodash.zip@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020" @@ -1256,7 +1226,12 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -regexp-tree@^0.1.17, regexp-tree@~0.1.1: +regexp-tree@^0.1.21: + version "0.1.21" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.21.tgz#55e2246b7f7d36f1b461490942fa780299c400d7" + integrity sha512-kUUXjX4AnqnR8KRTCrayAo9PzYMRKmVoGgaz2tBuz0MF3g1ZbGebmtW0yFHfFK9CmBjQKeYIgoL22pFLBJY7sw== + +regexp-tree@~0.1.1: version "0.1.19" resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.19.tgz#9326e91d8d1d23298dd33a78cf5e788f57cdc359" integrity sha512-mVeVLF/qg5qFbZSW0f7pXbuVX73dKIjuhOyC2JLKxzmpya75O4qLcvI9j0jp31Iz7IAkEVHa1UErDCAqaLKo5A== @@ -1378,7 +1353,7 @@ semver@^6.1.2, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.1.2: +semver@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6" integrity sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA== -- cgit v1.2.3 From 09caa0dcba54156523309186a5e08e57d30e154d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 20:36:44 +0400 Subject: Updated TypeScript to v2.25.0 Signed-off-by: Valentin Popov --- ROADMAP.md | 10 ++++++-- package.json | 8 +++--- src/rules/typescript/default.json | 54 ++++++++++++++++++++++++++++++++++++++- yarn.lock | 49 ++++++++++++++++++++--------------- 4 files changed, 93 insertions(+), 28 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 4ab6b9c..d47b7fb 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -389,6 +389,7 @@ - [ ] "ban-types" - [ ] "brace-style" - [ ] "camelcase" +- [X] "class-literal-property-style" - [ ] "class-name-casing" - [X] "comma-spacing" - [ ] "consistent-type-assertions" @@ -406,6 +407,7 @@ - [ ] "member-ordering" - [ ] "naming-convention" - [ ] "no-array-constructor" +- [X] "no-base-to-string" - [ ] "no-dupe-class-members" - [ ] "no-dynamic-delete" - [ ] "no-empty-function" @@ -431,10 +433,13 @@ - [ ] "no-throw-literal" - [X] "no-type-alias" - [ ] "no-unnecessary-boolean-literal-compare" -- [ ] "no-unnecessary-condition" +- [X] "no-unnecessary-condition" - [ ] "no-unnecessary-qualifier" - [ ] "no-unnecessary-type-arguments" -- [ ] "no-unnecessary-type-assertion" +- [X] "no-unnecessary-type-assertion" +- [X] "no-unsafe-call" +- [X] "no-unsafe-member-access" +- [X] "no-unsafe-return" - [X] "no-untyped-public-signature" - [ ] "no-unused-expressions" - [X] "no-unused-vars" @@ -450,6 +455,7 @@ - [ ] "prefer-nullish-coalescing" - [ ] "prefer-optional-chain" - [ ] "prefer-readonly" +- [X] "prefer-readonly-parameter-types" - [ ] "prefer-regexp-exec" - [ ] "prefer-string-starts-ends-with" - [ ] "promise-function-async" diff --git a/package.json b/package.json index 37b6584..ac8bae0 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "devDependencies": { "@rollup/plugin-json": "^4.0.2", "@rollup/plugin-typescript": "^3.0.0", - "@typescript-eslint/eslint-plugin": "^2.20.0", - "@typescript-eslint/parser": "^2.20.0", + "@typescript-eslint/eslint-plugin": "^2.25.0", + "@typescript-eslint/parser": "^2.25.0", "eslint": "^6.8.0", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-import": "^2.20.1", @@ -28,8 +28,8 @@ "typescript": "^3.7.5" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^2.19.0", - "@typescript-eslint/parser": "^2.19.0", + "@typescript-eslint/eslint-plugin": "^2.25.0", + "@typescript-eslint/parser": "^2.25.0", "eslint": "^6.8.0", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-import": "^2.20.1", diff --git a/src/rules/typescript/default.json b/src/rules/typescript/default.json index 43ad740..a580318 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", { @@ -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/yarn.lock b/yarn.lock index eb928f7..2ce11af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -65,40 +65,40 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== -"@typescript-eslint/eslint-plugin@^2.20.0": - version "2.20.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.20.0.tgz#a522d0e1e4898f7c9c6a8e1ed3579b60867693fa" - integrity sha512-cimIdVDV3MakiGJqMXw51Xci6oEDEoPkvh8ggJe2IIzcc0fYqAxOXN6Vbeanahz6dLZq64W+40iUEc9g32FLDQ== +"@typescript-eslint/eslint-plugin@^2.25.0": + version "2.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.25.0.tgz#0b60917332f20dcff54d0eb9be2a9e9f4c9fbd02" + integrity sha512-W2YyMtjmlrOjtXc+FtTelVs9OhuR6OlYc4XKIslJ8PUJOqgYYAPRJhAqkYRQo3G4sjvG8jSodsNycEn4W2gHUw== dependencies: - "@typescript-eslint/experimental-utils" "2.20.0" - eslint-utils "^1.4.3" + "@typescript-eslint/experimental-utils" "2.25.0" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.20.0": - version "2.20.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz#3b6fa5a6b8885f126d5a4280e0d44f0f41e73e32" - integrity sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag== +"@typescript-eslint/experimental-utils@2.25.0": + version "2.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.25.0.tgz#13691c4fe368bd377b1e5b1e4ad660b220bf7714" + integrity sha512-0IZ4ZR5QkFYbaJk+8eJ2kYeA+1tzOE1sBjbwwtSV85oNWYUBep+EyhlZ7DLUCyhMUGuJpcCCFL0fDtYAP1zMZw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.20.0" + "@typescript-eslint/typescript-estree" "2.25.0" eslint-scope "^5.0.0" + eslint-utils "^2.0.0" -"@typescript-eslint/parser@^2.20.0": - version "2.20.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.20.0.tgz#608e5bb06ba98a415b64ace994c79ab20f9772a9" - integrity sha512-o8qsKaosLh2qhMZiHNtaHKTHyCHc3Triq6aMnwnWj7budm3xAY9owSZzV1uon5T9cWmJRJGzTFa90aex4m77Lw== +"@typescript-eslint/parser@^2.25.0": + version "2.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.25.0.tgz#abfb3d999084824d9a756d9b9c0f36fba03adb76" + integrity sha512-mccBLaBSpNVgp191CP5W+8U1crTyXsRziWliCqzj02kpxdjKMvFHGJbK33NroquH3zB/gZ8H511HEsJBa2fNEg== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.20.0" - "@typescript-eslint/typescript-estree" "2.20.0" + "@typescript-eslint/experimental-utils" "2.25.0" + "@typescript-eslint/typescript-estree" "2.25.0" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/typescript-estree@2.20.0": - version "2.20.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz#90a0f5598826b35b966ca83483b1a621b1a4d0c9" - integrity sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A== +"@typescript-eslint/typescript-estree@2.25.0": + version "2.25.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.25.0.tgz#b790497556734b7476fa7dd3fa539955a5c79e2c" + integrity sha512-VUksmx5lDxSi6GfmwSK7SSoIKSw9anukWWNitQPqt58LuYrKalzsgeuignbqnB+rK/xxGlSsCy8lYnwFfB6YJg== dependencies: debug "^4.1.1" eslint-visitor-keys "^1.1.0" @@ -481,6 +481,13 @@ eslint-utils@^1.4.3: dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd" + integrity sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA== + dependencies: + eslint-visitor-keys "^1.1.0" + eslint-visitor-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" -- cgit v1.2.3 From 3c922848220e0e86145121ab5564b1afce163343 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 20:39:09 +0400 Subject: Updated Vue plugin to v6.2.2 Signed-off-by: Valentin Popov --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ac8bae0..13aeba1 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "eslint-plugin-security": "^1.4.0", "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-unicorn": "^18.0.0", - "eslint-plugin-vue": "^6.2.1", + "eslint-plugin-vue": "^6.2.2", "rollup": "^1.31.1", "rollup-plugin-terser": "^5.2.0", "tslib": "^1.10.0", @@ -36,7 +36,7 @@ "eslint-plugin-security": "^1.4.0", "eslint-plugin-sonarjs": "^0.5.0", "eslint-plugin-unicorn": "^18.0.0", - "eslint-plugin-vue": "^6.1.2" + "eslint-plugin-vue": "^6.2.2" }, "dependencies": {} } diff --git a/yarn.lock b/yarn.lock index 2ce11af..32755eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -448,10 +448,10 @@ eslint-plugin-unicorn@^18.0.0: safe-regex "^2.1.1" semver "^7.1.3" -eslint-plugin-vue@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.2.1.tgz#ca802df5c33146aed1e56bb21d250c1abb6120a3" - integrity sha512-MiIDOotoWseIfLIfGeDzF6sDvHkVvGd2JgkvjyHtN3q4RoxdAXrAMuI3SXTOKatljgacKwpNAYShmcKZa4yZzw== +eslint-plugin-vue@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.2.2.tgz#27fecd9a3a24789b0f111ecdd540a9e56198e0fe" + integrity sha512-Nhc+oVAHm0uz/PkJAWscwIT4ijTrK5fqNqz9QB1D35SbbuMG1uB6Yr5AJpvPSWg+WOw7nYNswerYh0kOk64gqQ== dependencies: natural-compare "^1.4.0" semver "^5.6.0" -- cgit v1.2.3 From 5d9c8c8b4e0874b0acb3a63159040e994b511887 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 20:43:49 +0400 Subject: fix(typescript): no-explicit-any Signed-off-by: Valentin Popov --- src/rules/typescript/default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules/typescript/default.json b/src/rules/typescript/default.json index a580318..fe556bc 100644 --- a/src/rules/typescript/default.json +++ b/src/rules/typescript/default.json @@ -80,7 +80,7 @@ "@typescript-eslint/no-explicit-any": [ "warn", { - "fixToUnknown": false, + "fixToUnknown": true, "ignoreRestArgs": false } ], -- cgit v1.2.3 From 582698ebfaa399e7d728380bd665ee81fb06cbeb Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 20:49:19 +0400 Subject: Fixed TypeScript error after create new file Signed-off-by: Valentin Popov --- src/typescript.ts | 3 +++ src/vue-typescript.ts | 1 + 2 files changed, 4 insertions(+) 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", ], -- cgit v1.2.3 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 From 4925f485eafcd63b4a60204911a16d405069b1b3 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 21:32:18 +0400 Subject: feat(import): order Signed-off-by: Valentin Popov --- ROADMAP.md | 2 +- src/rules/import/default.json | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ROADMAP.md b/ROADMAP.md index c85dd63..e381ebe 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -331,7 +331,7 @@ - [ ] "no-unused-modules" - [ ] "no-useless-path-segments" - [X] "no-webpack-loader-syntax" -- [ ] "order" +- [X] "order" - [ ] "prefer-default-export" - [ ] "unambiguous" 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" + } ] } -- cgit v1.2.3 From 9ba18706cdcd61618ad1e92f14587fb855deb1c8 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 21:34:11 +0400 Subject: fix(sonarjs): prefer-immediate-return Signed-off-by: Valentin Popov --- src/rules/sonarjs/default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules/sonarjs/default.json b/src/rules/sonarjs/default.json index cc5897a..5c39836 100644 --- a/src/rules/sonarjs/default.json +++ b/src/rules/sonarjs/default.json @@ -65,7 +65,7 @@ "sonarjs/no-useless-catch": [ "warn" ], - "sonarjs/please-immediate-return": [ + "sonarjs/prefer-immediate-return": [ "error" ], "sonarjs/prefer-object-literal": [ -- cgit v1.2.3 From 78586ee73c94168978b4567c8692fd3172e7400d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 21:35:39 +0400 Subject: fix(javascript): Formatted file Signed-off-by: Valentin Popov --- src/javascript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"; -- cgit v1.2.3 From a03e6513cbc252daff5874bd028cb470690c5bc8 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 21:44:40 +0400 Subject: feat(project): Updated "README.md" Signed-off-by: Valentin Popov --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/README.md b/README.md index fbbcddd..d2dc37c 100644 --- a/README.md +++ b/README.md @@ -1 +1,56 @@ # Personal ESLint configuration + +## Configurations + +* `javascript` +* `typescript` +* `vue-javascript` +* `vue-typescript` + +## Example + +* Install dependencies: + +```shell script +npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser \ + @valentineus/eslint-config eslint eslint-plugin-eslint-comments \ + eslint-plugin-import eslint-plugin-security eslint-plugin-sonarjs \ + eslint-plugin-unicorn eslint-plugin-vue + +# or +yarn add --dev @typescript-eslint/eslint-plugin @typescript-eslint/parser \ + @valentineus/eslint-config eslint eslint-plugin-eslint-comments \ + eslint-plugin-import eslint-plugin-security eslint-plugin-sonarjs \ + eslint-plugin-unicorn eslint-plugin-vue +``` + +* Create config file: + +```json +{ + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "@valentineus/eslint-config/vue-typescript" + ], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "createDefaultProgram": true, + "ecmaVersion": 2020, + "project": "tsconfig.json", + "sourceType": "module", + "tsconfigRootDir": "." + }, + "rules": {} +} +``` + +## License + +[Apache-2.0](LICENSE.txt). +Copyright (c) [Valentin Popov](mailto:info@valentineus.link). -- cgit v1.2.3 From 838f58e1cdbd395e7a25e87b97ac506e9d9931c5 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 21:45:48 +0400 Subject: Bump version Signed-off-by: Valentin Popov --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13aeba1..42a24ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@valentineus/eslint-config", - "version": "0.0.12", + "version": "0.0.13", "description": "Personal ESLint configuration", "main": "index.js", "repository": "git@code.valentineus.link:eslint-config.git", -- cgit v1.2.3 From e214aeb8a58cec914fc0483990b0e1db99b137f0 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 22:16:28 +0400 Subject: Add GitHub Action Signed-off-by: Valentin Popov --- .editorconfig | 2 -- .github/workflows/publish.yml | 21 +++++++++++++++++++++ .gitlab-ci.yml | 19 ------------------- 3 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .gitlab-ci.yml diff --git a/.editorconfig b/.editorconfig index d058e45..2c83ce3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,9 +12,7 @@ tab_width = 4 trim_trailing_whitespace = true [*.json] -indent_size = 2 indent_style = space [*.yml] -indent_size = 2 indent_style = space diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a73e8ea --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: CI + +on: + create: + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: install + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: build + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: publish diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 6c8df84..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,19 +0,0 @@ -image: "node:latest" - -cache: - paths: - - node_modules/ - -job-publish: - only: - - tags - - before_script: - - curl -o- -L https://yarnpkg.com/install.sh | bash - - export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" - - script: - - yarn install - - yarn run build - - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc - - npm publish -- cgit v1.2.3 From c2ad7f211efca19666f950529830f8d979ec0844 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 22:24:06 +0400 Subject: fix(actions): Added auth token Signed-off-by: Valentin Popov --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a73e8ea..c812440 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,5 +17,6 @@ jobs: with: cmd: build - uses: borales/actions-yarn@v2.0.0 + auth-token: ${{ secrets.NPM_AUTH_TOKEN }} with: cmd: publish -- cgit v1.2.3 From 4431cd50b1846557e79ef005ff4b7f7c93b4e654 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 22:25:32 +0400 Subject: fix(actions): Updated auth token Signed-off-by: Valentin Popov --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c812440..29001f1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: CI +name: Publish on: create: @@ -17,6 +17,6 @@ jobs: with: cmd: build - uses: borales/actions-yarn@v2.0.0 - auth-token: ${{ secrets.NPM_AUTH_TOKEN }} + "auth-token": ${{ secrets.NPM_AUTH_TOKEN }} with: cmd: publish -- cgit v1.2.3 From f12fa08c4587dc862a17c781cff64ee9f17698bc Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 22:31:34 +0400 Subject: fix(actions): Used node action Signed-off-by: Valentin Popov --- .github/workflows/publish.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 29001f1..2eb82a2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,13 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: borales/actions-yarn@v2.0.0 + - uses: actions/setup-node@v1 with: - cmd: install - - uses: borales/actions-yarn@v2.0.0 - with: - cmd: build - - uses: borales/actions-yarn@v2.0.0 - "auth-token": ${{ secrets.NPM_AUTH_TOKEN }} - with: - cmd: publish + node-version: '13.x' + - run: yarn install + - run: yarn run build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} -- cgit v1.2.3 From bbc0fca98585049b28a61767ce6fafca2160cc60 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 22:36:31 +0400 Subject: fix(actions): Update auth action Signed-off-by: Valentin Popov --- .github/workflows/publish.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2eb82a2..a588b42 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,6 +15,5 @@ jobs: node-version: '13.x' - run: yarn install - run: yarn run build - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc + - run: npm publish -- cgit v1.2.3 From 2bdf5c87990e7ebcd338f15245ca1e937a361750 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Mar 2020 22:38:04 +0400 Subject: Bump version Signed-off-by: Valentin Popov --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 42a24ee..d9ff48a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@valentineus/eslint-config", - "version": "0.0.13", + "version": "0.0.14", "description": "Personal ESLint configuration", "main": "index.js", "repository": "git@code.valentineus.link:eslint-config.git", -- cgit v1.2.3