diff --git a/package.json b/package.json index 3884f3f9..22028086 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "@types/node": "~18.7.23", "@types/prettier": "~2.7.1", "@typescript-eslint/eslint-plugin": "~5.38.1", + "@typescript-eslint/experimental-utils": "^5.38.1", "@typescript-eslint/parser": "~5.38.1", "change-case": "~4.1.2", "eslint": "~8.24.0", @@ -66,6 +67,7 @@ "eslint-plugin-mdx": "~2.0.5", "eslint-plugin-node": "~11.1.0", "eslint-plugin-prettier": "~4.2.1", + "eslint-plugin-sonarjs": "~0.15.0", "eslint-plugin-spellcheck": "~0.0.19", "eslint-plugin-unicorn": "~44.0.0", "eslint-plugin-vue": "~9.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7cec1ae..437ff06b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,7 @@ specifiers: '@types/node': ~18.7.23 '@types/prettier': ~2.7.1 '@typescript-eslint/eslint-plugin': ~5.38.1 + '@typescript-eslint/experimental-utils': ^5.38.1 '@typescript-eslint/parser': ~5.38.1 change-case: ~4.1.2 eslint: ~8.24.0 @@ -18,6 +19,7 @@ specifiers: eslint-plugin-mdx: ~2.0.5 eslint-plugin-node: ~11.1.0 eslint-plugin-prettier: ~4.2.1 + eslint-plugin-sonarjs: ~0.15.0 eslint-plugin-spellcheck: ~0.0.19 eslint-plugin-unicorn: ~44.0.0 eslint-plugin-vue: ~9.5.1 @@ -38,6 +40,7 @@ devDependencies: '@types/node': 18.7.23 '@types/prettier': 2.7.1 '@typescript-eslint/eslint-plugin': 5.38.1_c7qepppml3d4ahu5cnfwqe6ltq + '@typescript-eslint/experimental-utils': 5.38.1_ypn2ylkkyfa5i233caldtndbqa '@typescript-eslint/parser': 5.38.1_ypn2ylkkyfa5i233caldtndbqa change-case: 4.1.2 eslint: 8.24.0 @@ -49,6 +52,7 @@ devDependencies: eslint-plugin-mdx: 2.0.5_eslint@8.24.0 eslint-plugin-node: 11.1.0_eslint@8.24.0 eslint-plugin-prettier: 4.2.1_cfn5x6ujhhgzv3423d6k7r2zzm + eslint-plugin-sonarjs: 0.15.0_eslint@8.24.0 eslint-plugin-spellcheck: 0.0.19_eslint@8.24.0 eslint-plugin-unicorn: 44.0.0_eslint@8.24.0 eslint-plugin-vue: 9.5.1_eslint@8.24.0 @@ -85,8 +89,8 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/runtime/7.19.0: - resolution: {integrity: sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA==} + /@babel/runtime/7.18.9: + resolution: {integrity: sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.13.9 @@ -113,12 +117,12 @@ packages: /@esbuild-kit/cjs-loader/2.3.3: resolution: {integrity: sha512-Rt4O1mXlPEDVxvjsHLgbtHVdUXYK9C1/6ThpQnt7FaXIjUOsI6qhHYMgALhNnlIMZffag44lXd6Dqgx3xALbpQ==} dependencies: - '@esbuild-kit/core-utils': 2.3.2 + '@esbuild-kit/core-utils': 2.3.0 get-tsconfig: 4.2.0 dev: true - /@esbuild-kit/core-utils/2.3.2: - resolution: {integrity: sha512-aQwy1Hdd02ymjyMyyrhtyuZGv5W+mVZmj3DTKFV0TnB1AUgMBV40tXySpsGySe8vLvSe0c0TaqTc2FUo8/YlNQ==} + /@esbuild-kit/core-utils/2.3.0: + resolution: {integrity: sha512-JL73zt/LN/qqziHuod4/bM2xBNNofDZu1cbwT6KIn6B11lA4cgDXkoSHOfNCbZMZOnh0Aqf0vW/gNQC+Z18hKQ==} dependencies: esbuild: 0.15.10 source-map-support: 0.5.21 @@ -127,7 +131,7 @@ packages: /@esbuild-kit/esm-loader/2.4.2: resolution: {integrity: sha512-N9dPKAj8WOx6djVnStgILWXip4fjDcBk9L7azO0/uQDpu8Ee0eaL78mkN4Acid9BzvNAKWwdYXFJZnsVahNEew==} dependencies: - '@esbuild-kit/core-utils': 2.3.2 + '@esbuild-kit/core-utils': 2.3.0 get-tsconfig: 4.2.0 dev: true @@ -149,6 +153,23 @@ packages: dev: true optional: true + /@eslint/eslintrc/1.3.1: + resolution: {integrity: sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + ajv: 6.12.6 + debug: 4.3.4 + espree: 9.4.0 + globals: 13.17.0 + ignore: 5.2.0 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + dev: true + /@eslint/eslintrc/1.3.2: resolution: {integrity: sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -213,7 +234,7 @@ packages: peerDependencies: eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - '@eslint/eslintrc': 1.3.2 + '@eslint/eslintrc': 1.3.1 '@intlify/core-base': 9.2.2 '@intlify/message-compiler': 9.2.2 debug: 4.3.4 @@ -225,7 +246,7 @@ packages: json5: 2.2.1 jsonc-eslint-parser: 2.1.0 lodash: 4.17.21 - parse5: 7.1.1 + parse5: 7.0.0 semver: 7.3.7 vue-eslint-parser: 9.1.0_eslint@8.24.0 yaml-eslint-parser: 1.1.0 @@ -323,7 +344,7 @@ packages: /@types/glob/7.2.0: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: - '@types/minimatch': 5.1.2 + '@types/minimatch': 5.1.0 '@types/node': 18.7.23 dev: true @@ -341,8 +362,8 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true - /@types/lodash/4.14.186: - resolution: {integrity: sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==} + /@types/lodash/4.14.184: + resolution: {integrity: sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==} dev: true /@types/mdast/3.0.10: @@ -351,8 +372,8 @@ packages: '@types/unist': 2.0.6 dev: true - /@types/minimatch/5.1.2: - resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} + /@types/minimatch/5.1.0: + resolution: {integrity: sha512-0RJHq5FqDWo17kdHe+SMDJLfxmLaqHbWnqZ6gNKzDvStUlrmx/eKIY17+ifLS1yybo7X86aUshQMlittDOVNnw==} dev: true /@types/ms/0.7.31: @@ -405,6 +426,19 @@ packages: - supports-color dev: true + /@typescript-eslint/experimental-utils/5.38.1_ypn2ylkkyfa5i233caldtndbqa: + resolution: {integrity: sha512-Zv0EcU0iu64DiVG3pRZU0QYCgANO//U1fS3oEs3eqHD1eIVVcQsFd/T01ckaNbL2H2aCqRojY2xZuMAPcOArEA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@typescript-eslint/utils': 5.38.1_ypn2ylkkyfa5i233caldtndbqa + eslint: 8.24.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/parser/5.38.1_ypn2ylkkyfa5i233caldtndbqa: resolution: {integrity: sha512-LDqxZBVFFQnQRz9rUZJhLmox+Ep5kdUmLatLQnCRR6523YV+XhRjfYzStQ4MheFA8kMAfUlclHSbu+RKdRwQKw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -567,8 +601,8 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 - get-intrinsic: 1.1.3 + es-abstract: 1.20.1 + get-intrinsic: 1.1.2 is-string: 1.0.7 dev: true @@ -583,7 +617,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 + es-abstract: 1.20.1 es-shim-unscopables: 1.0.0 dev: true @@ -593,7 +627,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 + es-abstract: 1.20.1 es-shim-unscopables: 1.0.0 dev: true @@ -642,7 +676,7 @@ packages: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: function-bind: 1.1.1 - get-intrinsic: 1.1.3 + get-intrinsic: 1.1.2 dev: true /call-me-maybe/1.0.1: @@ -790,7 +824,7 @@ packages: dev: true /concat-map/0.0.1: - resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true /constant-case/3.0.4: @@ -929,8 +963,8 @@ packages: tslib: 2.4.0 dev: true - /entities/4.4.0: - resolution: {integrity: sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==} + /entities/4.3.1: + resolution: {integrity: sha512-o4q/dYJlmyjP2zfnaWDUC6A3BQFmVTX+tZPezK7k0GLSU9QYCauscf5Y+qcEPzKL+EixVouYDgLQK5H9GrLpkg==} engines: {node: '>=0.12'} dev: true @@ -940,21 +974,21 @@ packages: is-arrayish: 0.2.1 dev: true - /es-abstract/1.20.3: - resolution: {integrity: sha512-AyrnaKVpMzljIdwjzrj+LxGmj8ik2LckwXacHqrJJ/jxz6dDDBcZ7I7nlHM0FvEW8MfbWJwOd+yT2XzYW49Frw==} + /es-abstract/1.20.1: + resolution: {integrity: sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==} engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 es-to-primitive: 1.2.1 function-bind: 1.1.1 function.prototype.name: 1.1.5 - get-intrinsic: 1.1.3 + get-intrinsic: 1.1.2 get-symbol-description: 1.0.0 has: 1.0.3 has-property-descriptors: 1.0.0 has-symbols: 1.0.3 internal-slot: 1.0.3 - is-callable: 1.2.7 + is-callable: 1.2.4 is-negative-zero: 2.0.2 is-regex: 1.1.4 is-shared-array-buffer: 1.0.2 @@ -964,7 +998,6 @@ packages: object-keys: 1.1.1 object.assign: 4.1.4 regexp.prototype.flags: 1.4.3 - safe-regex-test: 1.0.0 string.prototype.trimend: 1.0.5 string.prototype.trimstart: 1.0.5 unbox-primitive: 1.0.2 @@ -980,7 +1013,7 @@ packages: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} dependencies: - is-callable: 1.2.7 + is-callable: 1.2.4 is-date-object: 1.0.5 is-symbol: 1.0.4 dev: true @@ -1007,7 +1040,7 @@ packages: resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} dependencies: d: 1.0.1 - ext: 1.7.0 + ext: 1.6.0 dev: true /es6-weak-map/2.0.3: @@ -1257,7 +1290,7 @@ packages: array.prototype.flatmap: 1.3.0 debug: 4.3.4 eslint: 8.24.0 - fast-glob: 3.2.12 + fast-glob: 3.2.11 transitivePeerDependencies: - supports-color dev: true @@ -1291,7 +1324,7 @@ packages: unified: 10.1.2 unist-util-visit: 4.1.1 uvu: 0.5.6 - vfile: 5.3.5 + vfile: 5.3.4 transitivePeerDependencies: - supports-color dev: true @@ -1417,7 +1450,7 @@ packages: remark-stringify: 10.0.2 tslib: 2.4.0 unified: 10.1.2 - vfile: 5.3.5 + vfile: 5.3.4 transitivePeerDependencies: - supports-color dev: true @@ -1454,6 +1487,15 @@ packages: prettier-linter-helpers: 1.0.0 dev: true + /eslint-plugin-sonarjs/0.15.0_eslint@8.24.0: + resolution: {integrity: sha512-LuxHdAe6VqSbi1phsUvNjbmXLuvlobmryQJJNyQYbdubCfz6K8tmgoqNiJPnz0pP2AbYDbtuPm0ajOMgMrC+dQ==} + engines: {node: '>=12'} + peerDependencies: + eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + eslint: 8.24.0 + dev: true + /eslint-plugin-spellcheck/0.0.19_eslint@8.24.0: resolution: {integrity: sha512-Vau+oCLT3IGx+inJV5rkuKlIwgka9L2is1SkztviIHN3apNnT2OrZoGy9Jt3gbcjjkfkIFMFSZjB+ijHCimbNA==} peerDependencies: @@ -1676,8 +1718,8 @@ packages: es5-ext: 0.10.62 dev: true - /ext/1.7.0: - resolution: {integrity: sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==} + /ext/1.6.0: + resolution: {integrity: sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==} dependencies: type: 2.7.2 dev: true @@ -1694,8 +1736,8 @@ packages: resolution: {integrity: sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==} dev: true - /fast-glob/3.2.12: - resolution: {integrity: sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==} + /fast-glob/3.2.11: + resolution: {integrity: sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==} engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 @@ -1783,7 +1825,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 + es-abstract: 1.20.1 functions-have-names: 1.2.3 dev: true @@ -1791,8 +1833,8 @@ packages: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} dev: true - /get-intrinsic/1.1.3: - resolution: {integrity: sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==} + /get-intrinsic/1.1.2: + resolution: {integrity: sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==} dependencies: function-bind: 1.1.1 has: 1.0.3 @@ -1809,7 +1851,7 @@ packages: engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 - get-intrinsic: 1.1.3 + get-intrinsic: 1.1.2 dev: true /get-tsconfig/4.2.0: @@ -1879,7 +1921,7 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.2.12 + fast-glob: 3.2.11 ignore: 5.2.0 merge2: 1.4.1 slash: 3.0.0 @@ -1910,7 +1952,7 @@ packages: /has-property-descriptors/1.0.0: resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} dependencies: - get-intrinsic: 1.1.3 + get-intrinsic: 1.1.2 dev: true /has-symbols/1.0.3: @@ -1990,7 +2032,7 @@ packages: resolution: {integrity: sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.1.3 + get-intrinsic: 1.1.2 has: 1.0.3 side-channel: 1.0.4 dev: true @@ -2047,8 +2089,8 @@ packages: builtin-modules: 3.3.0 dev: true - /is-callable/1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + /is-callable/1.2.4: + resolution: {integrity: sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==} engines: {node: '>= 0.4'} dev: true @@ -2109,7 +2151,7 @@ packages: /is-language-code/3.1.0: resolution: {integrity: sha512-zJdQ3QTeLye+iphMeK3wks+vXSRFKh68/Pnlw7aOfApFSEIOhYa8P9vwwa6QrImNNBMJTiL1PpYF0f4BxDuEgA==} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.18.9 dev: true /is-negative-zero/2.0.2: @@ -2214,7 +2256,7 @@ packages: dependencies: '@bcherny/json-schema-ref-parser': 9.0.9 '@types/json-schema': 7.0.11 - '@types/lodash': 4.14.186 + '@types/lodash': 4.14.184 '@types/prettier': 2.7.1 cli-color: 2.0.3 get-stdin: 8.0.0 @@ -2356,8 +2398,8 @@ packages: - supports-color dev: true - /mdast-util-mdx-expression/1.3.1: - resolution: {integrity: sha512-TTb6cKyTA1RD+1su1iStZ5PAv3rFfOUKcoU5EstUpv/IZo63uDX03R8+jXjMEhcobXnNOiG6/ccekvVl4eV1zQ==} + /mdast-util-mdx-expression/1.3.0: + resolution: {integrity: sha512-9kTO13HaL/ChfzVCIEfDRdp1m5hsvsm6+R8yr67mH+KS2ikzZ0ISGLPTbTswOFpLLlgVHO9id3cul4ajutCvCA==} dependencies: '@types/estree-jsx': 1.0.0 '@types/hast': 2.3.4 @@ -2386,7 +2428,7 @@ packages: /mdast-util-mdx/2.0.0: resolution: {integrity: sha512-M09lW0CcBT1VrJUaF/PYxemxxHa7SLDHdSn94Q9FhxjCQfuW7nMAWKWimTmA3OyDMSTH981NN1csW1X+HPSluw==} dependencies: - mdast-util-mdx-expression: 1.3.1 + mdast-util-mdx-expression: 1.3.0 mdast-util-mdx-jsx: 2.1.0 mdast-util-mdxjs-esm: 1.3.0 transitivePeerDependencies: @@ -2653,8 +2695,8 @@ packages: micromark-util-types: 1.0.2 dev: true - /micromark-util-sanitize-uri/1.1.0: - resolution: {integrity: sha512-RoxtuSCX6sUNtxhbmsEFQfWzs8VN7cTctmBPvYivo98xb/kDEoTCtJQX5wyzIYEmk/lvNFTat4hL8oW0KndFpg==} + /micromark-util-sanitize-uri/1.0.0: + resolution: {integrity: sha512-cCxvBKlmac4rxCGx6ejlIviRaMKZc0fWm5HdCHEeDWRSkn44l6NdYVRyU+0nT1XC72EQJMZV8IPHF+jTr56lAg==} dependencies: micromark-util-character: 1.1.0 micromark-util-encode: 1.0.1 @@ -2702,7 +2744,7 @@ packages: micromark-util-encode: 1.0.1 micromark-util-normalize-identifier: 1.0.0 micromark-util-resolve-all: 1.0.0 - micromark-util-sanitize-uri: 1.1.0 + micromark-util-sanitize-uri: 1.0.0 micromark-util-subtokenize: 1.0.2 micromark-util-symbol: 1.0.1 micromark-util-types: 1.0.2 @@ -2832,7 +2874,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 + es-abstract: 1.20.1 dev: true /once/1.4.0: @@ -2943,10 +2985,10 @@ packages: lines-and-columns: 1.2.4 dev: true - /parse5/7.1.1: - resolution: {integrity: sha512-kwpuwzB+px5WUg9pyK0IcK/shltJN5/OVhQagxhCQNtT9Y9QRZqNY2e1cmbu/paRh5LMnz/oVTVLBpjFmMZhSg==} + /parse5/7.0.0: + resolution: {integrity: sha512-y/t8IXSPWTuRZqXc0ajH/UwDj4mnqLEbSttNbThcFhGrZuOyoyvNBO85PBp2jQa55wY9d07PBNjsK8ZP3K5U6g==} dependencies: - entities: 4.4.0 + entities: 4.3.1 dev: true /pascal-case/3.1.2: @@ -3170,14 +3212,6 @@ packages: mri: 1.2.0 dev: true - /safe-regex-test/1.0.0: - resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} - dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.1.3 - is-regex: 1.1.4 - dev: true - /safe-regex/2.1.1: resolution: {integrity: sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==} dependencies: @@ -3226,7 +3260,7 @@ packages: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: call-bind: 1.0.2 - get-intrinsic: 1.1.3 + get-intrinsic: 1.1.2 object-inspect: 1.12.2 dev: true @@ -3281,7 +3315,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 + es-abstract: 1.20.1 dev: true /string.prototype.trimstart/1.0.5: @@ -3289,7 +3323,7 @@ packages: dependencies: call-bind: 1.0.2 define-properties: 1.1.4 - es-abstract: 1.20.3 + es-abstract: 1.20.1 dev: true /stringify-entities/4.0.3: @@ -3424,7 +3458,7 @@ packages: hasBin: true dependencies: '@esbuild-kit/cjs-loader': 2.3.3 - '@esbuild-kit/core-utils': 2.3.2 + '@esbuild-kit/core-utils': 2.3.0 '@esbuild-kit/esm-loader': 2.4.2 optionalDependencies: fsevents: 2.3.2 @@ -3484,7 +3518,7 @@ packages: is-buffer: 2.0.5 is-plain-obj: 4.1.0 trough: 2.1.0 - vfile: 5.3.5 + vfile: 5.3.4 dev: true /unist-util-is/5.1.1: @@ -3575,7 +3609,7 @@ packages: resolution: {integrity: sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==} dependencies: '@types/unist': 2.0.6 - vfile: 5.3.5 + vfile: 5.3.4 dev: true /vfile-message/3.1.2: @@ -3585,8 +3619,8 @@ packages: unist-util-stringify-position: 3.0.2 dev: true - /vfile/5.3.5: - resolution: {integrity: sha512-U1ho2ga33eZ8y8pkbQLH54uKqGhFJ6GYIHnnG5AhRpAh3OWjkrRHKa/KogbmQn8We+c0KVV3rTOgR9V/WowbXQ==} + /vfile/5.3.4: + resolution: {integrity: sha512-KI+7cnst03KbEyN1+JE504zF5bJBZa+J+CrevLeyIMq0aPU681I2rQ5p4PlnQ6exFtWiUrg26QUdFMnAKR6PIw==} dependencies: '@types/unist': 2.0.6 is-buffer: 2.0.5 diff --git a/scripts/generate-rule-files.ts b/scripts/generate-rule-files.ts index 3c8edfe2..d9497505 100644 --- a/scripts/generate-rule-files.ts +++ b/scripts/generate-rule-files.ts @@ -12,6 +12,7 @@ import eslintPluginJSDoc from 'eslint-plugin-jsdoc'; import * as eslintPluginMdx from 'eslint-plugin-mdx'; // @ts-expect-error import eslintPluginNode from 'eslint-plugin-node'; +import * as eslintPluginSonarjs from 'eslint-plugin-sonarjs'; // @ts-expect-error import eslintPluginSpellcheck from 'eslint-plugin-spellcheck'; // @ts-expect-error @@ -68,6 +69,10 @@ const generationMap: Record = { name: 'Node', rules: (eslintPluginNode as Plugin).rules, }, + sonarjs: { + name: 'Sonarjs', + rules: eslintPluginSonarjs.rules, + }, spellcheck: { name: 'Spellcheck', rules: (eslintPluginSpellcheck as Plugin).rules, diff --git a/src/extends/eslint-plugin-sonarjs.d.ts b/src/extends/eslint-plugin-sonarjs.d.ts new file mode 100644 index 00000000..6456feac --- /dev/null +++ b/src/extends/eslint-plugin-sonarjs.d.ts @@ -0,0 +1,6 @@ +/** + * Eslint Sonarjs extensions. + * + * @see [Eslint Sonarjs extensions](https://github.com/SonarSource/eslint-plugin-sonarjs#available-configurations) + */ +export type SonarjsExtensions = 'plugin:sonarjs/recommended'; diff --git a/src/extends/index.d.ts b/src/extends/index.d.ts index b3b00db5..30ce18de 100644 --- a/src/extends/index.d.ts +++ b/src/extends/index.d.ts @@ -5,6 +5,7 @@ import type { JsdocExtensions } from './eslint-plugin-jsdoc'; import type { MdxExtensions } from './eslint-plugin-mdx'; import type { NodeExtensions } from './eslint-plugin-node'; import type { PrettierExtensions } from './eslint-plugin-prettier'; +import type { SonarjsExtensions } from './eslint-plugin-sonarjs'; import type { UnicornExtensions } from './eslint-plugin-unicorn'; import type { VueExtensions } from './eslint-plugin-vue'; import type { VuePugExtensions } from './eslint-plugin-vue-pug'; @@ -22,6 +23,7 @@ export type KnownExtensions = LiteralUnion< | MdxExtensions | NodeExtensions | PrettierExtensions + | SonarjsExtensions | TypescriptEslintExtensions | UnicornExtensions | VueExtensions diff --git a/src/plugin.d.ts b/src/plugin.d.ts index b0d3fea6..ce0c724f 100644 --- a/src/plugin.d.ts +++ b/src/plugin.d.ts @@ -8,6 +8,7 @@ export type Plugin = LiteralUnion< | 'jsdoc' | 'mdx' | 'prettier' + | 'sonarjs' | 'spellcheck' | 'unicorn' | 'vue' diff --git a/src/rules/index.d.ts b/src/rules/index.d.ts index ef397d27..cbd74f8d 100644 --- a/src/rules/index.d.ts +++ b/src/rules/index.d.ts @@ -3,6 +3,7 @@ import type { ImportRules } from './import'; import type { JSDocRules } from './jsdoc'; import type { NodeRules } from './node'; import type { RuleConfig } from './rule-config'; +import type { SonarjsRules } from './sonarjs'; import type { SpellcheckRules } from './spellcheck'; import type { TypeScriptRules } from './typescript-eslint'; import type { UnicornRules } from './unicorn'; @@ -20,6 +21,7 @@ export type Rules = Partial< ImportRules & JSDocRules & NodeRules & + SonarjsRules & SpellcheckRules & TypeScriptRules & UnicornRules & diff --git a/src/rules/sonarjs/cognitive-complexity.d.ts b/src/rules/sonarjs/cognitive-complexity.d.ts new file mode 100644 index 00000000..8e762320 --- /dev/null +++ b/src/rules/sonarjs/cognitive-complexity.d.ts @@ -0,0 +1,41 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Config. + */ +export type CognitiveComplexityConfig = 'sonar-runtime' | 'metric'; + +/** + * Option. + */ +export type CognitiveComplexityOption = number; + +/** + * Options. + */ +export type CognitiveComplexityOptions = [ + CognitiveComplexityOption?, + CognitiveComplexityConfig?, +]; + +/** + * Cognitive Complexity of functions should not be too high. + * + * @see [cognitive-complexity](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/cognitive-complexity.md) + */ +export type CognitiveComplexityRuleConfig = + RuleConfig; + +/** + * Cognitive Complexity of functions should not be too high. + * + * @see [cognitive-complexity](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/cognitive-complexity.md) + */ +export interface CognitiveComplexityRule { + /** + * Cognitive Complexity of functions should not be too high. + * + * @see [cognitive-complexity](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/cognitive-complexity.md) + */ + 'sonarjs/cognitive-complexity': CognitiveComplexityRuleConfig; +} diff --git a/src/rules/sonarjs/elseif-without-else.d.ts b/src/rules/sonarjs/elseif-without-else.d.ts new file mode 100644 index 00000000..1a61b4a5 --- /dev/null +++ b/src/rules/sonarjs/elseif-without-else.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * "if ... else if" constructs should end with "else" clauses. + * + * @see [elseif-without-else](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/elseif-without-else.md) + */ +export type ElseifWithoutElseRuleConfig = RuleConfig<[]>; + +/** + * "if ... else if" constructs should end with "else" clauses. + * + * @see [elseif-without-else](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/elseif-without-else.md) + */ +export interface ElseifWithoutElseRule { + /** + * "if ... else if" constructs should end with "else" clauses. + * + * @see [elseif-without-else](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/elseif-without-else.md) + */ + 'sonarjs/elseif-without-else': ElseifWithoutElseRuleConfig; +} diff --git a/src/rules/sonarjs/index.d.ts b/src/rules/sonarjs/index.d.ts new file mode 100644 index 00000000..7b8e342e --- /dev/null +++ b/src/rules/sonarjs/index.d.ts @@ -0,0 +1,68 @@ +import type { CognitiveComplexityRule } from './cognitive-complexity'; +import type { ElseifWithoutElseRule } from './elseif-without-else'; +import type { MaxSwitchCasesRule } from './max-switch-cases'; +import type { NoAllDuplicatedBranchesRule } from './no-all-duplicated-branches'; +import type { NoCollapsibleIfRule } from './no-collapsible-if'; +import type { NoCollectionSizeMischeckRule } from './no-collection-size-mischeck'; +import type { NoDuplicateStringRule } from './no-duplicate-string'; +import type { NoDuplicatedBranchesRule } from './no-duplicated-branches'; +import type { NoElementOverwriteRule } from './no-element-overwrite'; +import type { NoEmptyCollectionRule } from './no-empty-collection'; +import type { NoExtraArgumentsRule } from './no-extra-arguments'; +import type { NoGratuitousExpressionsRule } from './no-gratuitous-expressions'; +import type { NoIdenticalConditionsRule } from './no-identical-conditions'; +import type { NoIdenticalExpressionsRule } from './no-identical-expressions'; +import type { NoIdenticalFunctionsRule } from './no-identical-functions'; +import type { NoIgnoredReturnRule } from './no-ignored-return'; +import type { NoInvertedBooleanCheckRule } from './no-inverted-boolean-check'; +import type { NoNestedSwitchRule } from './no-nested-switch'; +import type { NoNestedTemplateLiteralsRule } from './no-nested-template-literals'; +import type { NoOneIterationLoopRule } from './no-one-iteration-loop'; +import type { NoRedundantBooleanRule } from './no-redundant-boolean'; +import type { NoRedundantJumpRule } from './no-redundant-jump'; +import type { NoSameLineConditionalRule } from './no-same-line-conditional'; +import type { NoSmallSwitchRule } from './no-small-switch'; +import type { NoUnusedCollectionRule } from './no-unused-collection'; +import type { NoUseOfEmptyReturnValueRule } from './no-use-of-empty-return-value'; +import type { NoUselessCatchRule } from './no-useless-catch'; +import type { NonExistentOperatorRule } from './non-existent-operator'; +import type { PreferImmediateReturnRule } from './prefer-immediate-return'; +import type { PreferObjectLiteralRule } from './prefer-object-literal'; +import type { PreferSingleBooleanReturnRule } from './prefer-single-boolean-return'; +import type { PreferWhileRule } from './prefer-while'; + +/** + * All Sonarjs rules. + */ +export type SonarjsRules = CognitiveComplexityRule & + ElseifWithoutElseRule & + MaxSwitchCasesRule & + NoAllDuplicatedBranchesRule & + NoCollapsibleIfRule & + NoCollectionSizeMischeckRule & + NoDuplicateStringRule & + NoDuplicatedBranchesRule & + NoElementOverwriteRule & + NoEmptyCollectionRule & + NoExtraArgumentsRule & + NoGratuitousExpressionsRule & + NoIdenticalConditionsRule & + NoIdenticalExpressionsRule & + NoIdenticalFunctionsRule & + NoIgnoredReturnRule & + NoInvertedBooleanCheckRule & + NoNestedSwitchRule & + NoNestedTemplateLiteralsRule & + NoOneIterationLoopRule & + NoRedundantBooleanRule & + NoRedundantJumpRule & + NoSameLineConditionalRule & + NoSmallSwitchRule & + NoUnusedCollectionRule & + NoUseOfEmptyReturnValueRule & + NoUselessCatchRule & + NonExistentOperatorRule & + PreferImmediateReturnRule & + PreferObjectLiteralRule & + PreferSingleBooleanReturnRule & + PreferWhileRule; diff --git a/src/rules/sonarjs/max-switch-cases.d.ts b/src/rules/sonarjs/max-switch-cases.d.ts new file mode 100644 index 00000000..c52fc58b --- /dev/null +++ b/src/rules/sonarjs/max-switch-cases.d.ts @@ -0,0 +1,32 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type MaxSwitchCasesOption = number; + +/** + * Options. + */ +export type MaxSwitchCasesOptions = [MaxSwitchCasesOption?]; + +/** + * "switch" statements should not have too many "case" clauses. + * + * @see [max-switch-cases](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/max-switch-cases.md) + */ +export type MaxSwitchCasesRuleConfig = RuleConfig; + +/** + * "switch" statements should not have too many "case" clauses. + * + * @see [max-switch-cases](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/max-switch-cases.md) + */ +export interface MaxSwitchCasesRule { + /** + * "switch" statements should not have too many "case" clauses. + * + * @see [max-switch-cases](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/max-switch-cases.md) + */ + 'sonarjs/max-switch-cases': MaxSwitchCasesRuleConfig; +} diff --git a/src/rules/sonarjs/no-all-duplicated-branches.d.ts b/src/rules/sonarjs/no-all-duplicated-branches.d.ts new file mode 100644 index 00000000..b64252d7 --- /dev/null +++ b/src/rules/sonarjs/no-all-duplicated-branches.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * All branches in a conditional structure should not have exactly the same implementation. + * + * @see [no-all-duplicated-branches](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-all-duplicated-branches.md) + */ +export type NoAllDuplicatedBranchesRuleConfig = RuleConfig<[]>; + +/** + * All branches in a conditional structure should not have exactly the same implementation. + * + * @see [no-all-duplicated-branches](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-all-duplicated-branches.md) + */ +export interface NoAllDuplicatedBranchesRule { + /** + * All branches in a conditional structure should not have exactly the same implementation. + * + * @see [no-all-duplicated-branches](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-all-duplicated-branches.md) + */ + 'sonarjs/no-all-duplicated-branches': NoAllDuplicatedBranchesRuleConfig; +} diff --git a/src/rules/sonarjs/no-collapsible-if.d.ts b/src/rules/sonarjs/no-collapsible-if.d.ts new file mode 100644 index 00000000..2ad4252a --- /dev/null +++ b/src/rules/sonarjs/no-collapsible-if.d.ts @@ -0,0 +1,32 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoCollapsibleIfOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoCollapsibleIfOptions = [NoCollapsibleIfOption?]; + +/** + * Collapsible "if" statements should be merged. + * + * @see [no-collapsible-if](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-collapsible-if.md) + */ +export type NoCollapsibleIfRuleConfig = RuleConfig; + +/** + * Collapsible "if" statements should be merged. + * + * @see [no-collapsible-if](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-collapsible-if.md) + */ +export interface NoCollapsibleIfRule { + /** + * Collapsible "if" statements should be merged. + * + * @see [no-collapsible-if](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-collapsible-if.md) + */ + 'sonarjs/no-collapsible-if': NoCollapsibleIfRuleConfig; +} diff --git a/src/rules/sonarjs/no-collection-size-mischeck.d.ts b/src/rules/sonarjs/no-collection-size-mischeck.d.ts new file mode 100644 index 00000000..2fc98bca --- /dev/null +++ b/src/rules/sonarjs/no-collection-size-mischeck.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Collection sizes and array length comparisons should make sense. + * + * @see [no-collection-size-mischeck](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-collection-size-mischeck.md) + */ +export type NoCollectionSizeMischeckRuleConfig = RuleConfig<[]>; + +/** + * Collection sizes and array length comparisons should make sense. + * + * @see [no-collection-size-mischeck](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-collection-size-mischeck.md) + */ +export interface NoCollectionSizeMischeckRule { + /** + * Collection sizes and array length comparisons should make sense. + * + * @see [no-collection-size-mischeck](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-collection-size-mischeck.md) + */ + 'sonarjs/no-collection-size-mischeck': NoCollectionSizeMischeckRuleConfig; +} diff --git a/src/rules/sonarjs/no-duplicate-string.d.ts b/src/rules/sonarjs/no-duplicate-string.d.ts new file mode 100644 index 00000000..cad61034 --- /dev/null +++ b/src/rules/sonarjs/no-duplicate-string.d.ts @@ -0,0 +1,40 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Config. + */ +export type NoDuplicateStringConfig = 'sonar-runtime'; + +/** + * Option. + */ +export type NoDuplicateStringOption = number; + +/** + * Options. + */ +export type NoDuplicateStringOptions = [ + NoDuplicateStringOption?, + NoDuplicateStringConfig?, +]; + +/** + * String literals should not be duplicated. + * + * @see [no-duplicate-string](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicate-string.md) + */ +export type NoDuplicateStringRuleConfig = RuleConfig; + +/** + * String literals should not be duplicated. + * + * @see [no-duplicate-string](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicate-string.md) + */ +export interface NoDuplicateStringRule { + /** + * String literals should not be duplicated. + * + * @see [no-duplicate-string](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicate-string.md) + */ + 'sonarjs/no-duplicate-string': NoDuplicateStringRuleConfig; +} diff --git a/src/rules/sonarjs/no-duplicated-branches.d.ts b/src/rules/sonarjs/no-duplicated-branches.d.ts new file mode 100644 index 00000000..7e38348e --- /dev/null +++ b/src/rules/sonarjs/no-duplicated-branches.d.ts @@ -0,0 +1,33 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoDuplicatedBranchesOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoDuplicatedBranchesOptions = [NoDuplicatedBranchesOption?]; + +/** + * Two branches in a conditional structure should not have exactly the same implementation. + * + * @see [no-duplicated-branches](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicated-branches.md) + */ +export type NoDuplicatedBranchesRuleConfig = + RuleConfig; + +/** + * Two branches in a conditional structure should not have exactly the same implementation. + * + * @see [no-duplicated-branches](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicated-branches.md) + */ +export interface NoDuplicatedBranchesRule { + /** + * Two branches in a conditional structure should not have exactly the same implementation. + * + * @see [no-duplicated-branches](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-duplicated-branches.md) + */ + 'sonarjs/no-duplicated-branches': NoDuplicatedBranchesRuleConfig; +} diff --git a/src/rules/sonarjs/no-element-overwrite.d.ts b/src/rules/sonarjs/no-element-overwrite.d.ts new file mode 100644 index 00000000..32ad10f6 --- /dev/null +++ b/src/rules/sonarjs/no-element-overwrite.d.ts @@ -0,0 +1,33 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoElementOverwriteOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoElementOverwriteOptions = [NoElementOverwriteOption?]; + +/** + * Collection elements should not be replaced unconditionally. + * + * @see [no-element-overwrite](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-element-overwrite.md) + */ +export type NoElementOverwriteRuleConfig = + RuleConfig; + +/** + * Collection elements should not be replaced unconditionally. + * + * @see [no-element-overwrite](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-element-overwrite.md) + */ +export interface NoElementOverwriteRule { + /** + * Collection elements should not be replaced unconditionally. + * + * @see [no-element-overwrite](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-element-overwrite.md) + */ + 'sonarjs/no-element-overwrite': NoElementOverwriteRuleConfig; +} diff --git a/src/rules/sonarjs/no-empty-collection.d.ts b/src/rules/sonarjs/no-empty-collection.d.ts new file mode 100644 index 00000000..87f3dd6f --- /dev/null +++ b/src/rules/sonarjs/no-empty-collection.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Empty collections should not be accessed or iterated. + * + * @see [no-empty-collection](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-empty-collection.md) + */ +export type NoEmptyCollectionRuleConfig = RuleConfig<[]>; + +/** + * Empty collections should not be accessed or iterated. + * + * @see [no-empty-collection](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-empty-collection.md) + */ +export interface NoEmptyCollectionRule { + /** + * Empty collections should not be accessed or iterated. + * + * @see [no-empty-collection](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-empty-collection.md) + */ + 'sonarjs/no-empty-collection': NoEmptyCollectionRuleConfig; +} diff --git a/src/rules/sonarjs/no-extra-arguments.d.ts b/src/rules/sonarjs/no-extra-arguments.d.ts new file mode 100644 index 00000000..575e5fa5 --- /dev/null +++ b/src/rules/sonarjs/no-extra-arguments.d.ts @@ -0,0 +1,32 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoExtraArgumentsOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoExtraArgumentsOptions = [NoExtraArgumentsOption?]; + +/** + * Function calls should not pass extra arguments. + * + * @see [no-extra-arguments](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-extra-arguments.md) + */ +export type NoExtraArgumentsRuleConfig = RuleConfig; + +/** + * Function calls should not pass extra arguments. + * + * @see [no-extra-arguments](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-extra-arguments.md) + */ +export interface NoExtraArgumentsRule { + /** + * Function calls should not pass extra arguments. + * + * @see [no-extra-arguments](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-extra-arguments.md) + */ + 'sonarjs/no-extra-arguments': NoExtraArgumentsRuleConfig; +} diff --git a/src/rules/sonarjs/no-gratuitous-expressions.d.ts b/src/rules/sonarjs/no-gratuitous-expressions.d.ts new file mode 100644 index 00000000..ea865ecc --- /dev/null +++ b/src/rules/sonarjs/no-gratuitous-expressions.d.ts @@ -0,0 +1,33 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoGratuitousExpressionsOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoGratuitousExpressionsOptions = [NoGratuitousExpressionsOption?]; + +/** + * Boolean expressions should not be gratuitous. + * + * @see [no-gratuitous-expressions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-gratuitous-expressions.md) + */ +export type NoGratuitousExpressionsRuleConfig = + RuleConfig; + +/** + * Boolean expressions should not be gratuitous. + * + * @see [no-gratuitous-expressions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-gratuitous-expressions.md) + */ +export interface NoGratuitousExpressionsRule { + /** + * Boolean expressions should not be gratuitous. + * + * @see [no-gratuitous-expressions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-gratuitous-expressions.md) + */ + 'sonarjs/no-gratuitous-expressions': NoGratuitousExpressionsRuleConfig; +} diff --git a/src/rules/sonarjs/no-identical-conditions.d.ts b/src/rules/sonarjs/no-identical-conditions.d.ts new file mode 100644 index 00000000..7cc7eef4 --- /dev/null +++ b/src/rules/sonarjs/no-identical-conditions.d.ts @@ -0,0 +1,33 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoIdenticalConditionsOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoIdenticalConditionsOptions = [NoIdenticalConditionsOption?]; + +/** + * Related "if/else if" statements should not have the same condition. + * + * @see [no-identical-conditions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-conditions.md) + */ +export type NoIdenticalConditionsRuleConfig = + RuleConfig; + +/** + * Related "if/else if" statements should not have the same condition. + * + * @see [no-identical-conditions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-conditions.md) + */ +export interface NoIdenticalConditionsRule { + /** + * Related "if/else if" statements should not have the same condition. + * + * @see [no-identical-conditions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-conditions.md) + */ + 'sonarjs/no-identical-conditions': NoIdenticalConditionsRuleConfig; +} diff --git a/src/rules/sonarjs/no-identical-expressions.d.ts b/src/rules/sonarjs/no-identical-expressions.d.ts new file mode 100644 index 00000000..8a71289b --- /dev/null +++ b/src/rules/sonarjs/no-identical-expressions.d.ts @@ -0,0 +1,33 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoIdenticalExpressionsOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoIdenticalExpressionsOptions = [NoIdenticalExpressionsOption?]; + +/** + * Identical expressions should not be used on both sides of a binary operator. + * + * @see [no-identical-expressions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-expressions.md) + */ +export type NoIdenticalExpressionsRuleConfig = + RuleConfig; + +/** + * Identical expressions should not be used on both sides of a binary operator. + * + * @see [no-identical-expressions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-expressions.md) + */ +export interface NoIdenticalExpressionsRule { + /** + * Identical expressions should not be used on both sides of a binary operator. + * + * @see [no-identical-expressions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-expressions.md) + */ + 'sonarjs/no-identical-expressions': NoIdenticalExpressionsRuleConfig; +} diff --git a/src/rules/sonarjs/no-identical-functions.d.ts b/src/rules/sonarjs/no-identical-functions.d.ts new file mode 100644 index 00000000..ad87e9b6 --- /dev/null +++ b/src/rules/sonarjs/no-identical-functions.d.ts @@ -0,0 +1,41 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Config. + */ +export type NoIdenticalFunctionsConfig = 'sonar-runtime'; + +/** + * Option. + */ +export type NoIdenticalFunctionsOption = number; + +/** + * Options. + */ +export type NoIdenticalFunctionsOptions = [ + NoIdenticalFunctionsOption?, + NoIdenticalFunctionsConfig?, +]; + +/** + * Functions should not have identical implementations. + * + * @see [no-identical-functions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-functions.md) + */ +export type NoIdenticalFunctionsRuleConfig = + RuleConfig; + +/** + * Functions should not have identical implementations. + * + * @see [no-identical-functions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-functions.md) + */ +export interface NoIdenticalFunctionsRule { + /** + * Functions should not have identical implementations. + * + * @see [no-identical-functions](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-identical-functions.md) + */ + 'sonarjs/no-identical-functions': NoIdenticalFunctionsRuleConfig; +} diff --git a/src/rules/sonarjs/no-ignored-return.d.ts b/src/rules/sonarjs/no-ignored-return.d.ts new file mode 100644 index 00000000..bd8ea979 --- /dev/null +++ b/src/rules/sonarjs/no-ignored-return.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Return values from functions without side effects should not be ignored. + * + * @see [no-ignored-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-ignored-return.md) + */ +export type NoIgnoredReturnRuleConfig = RuleConfig<[]>; + +/** + * Return values from functions without side effects should not be ignored. + * + * @see [no-ignored-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-ignored-return.md) + */ +export interface NoIgnoredReturnRule { + /** + * Return values from functions without side effects should not be ignored. + * + * @see [no-ignored-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-ignored-return.md) + */ + 'sonarjs/no-ignored-return': NoIgnoredReturnRuleConfig; +} diff --git a/src/rules/sonarjs/no-inverted-boolean-check.d.ts b/src/rules/sonarjs/no-inverted-boolean-check.d.ts new file mode 100644 index 00000000..d6668b1c --- /dev/null +++ b/src/rules/sonarjs/no-inverted-boolean-check.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Boolean checks should not be inverted. + * + * @see [no-inverted-boolean-check](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-inverted-boolean-check.md) + */ +export type NoInvertedBooleanCheckRuleConfig = RuleConfig<[]>; + +/** + * Boolean checks should not be inverted. + * + * @see [no-inverted-boolean-check](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-inverted-boolean-check.md) + */ +export interface NoInvertedBooleanCheckRule { + /** + * Boolean checks should not be inverted. + * + * @see [no-inverted-boolean-check](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-inverted-boolean-check.md) + */ + 'sonarjs/no-inverted-boolean-check': NoInvertedBooleanCheckRuleConfig; +} diff --git a/src/rules/sonarjs/no-nested-switch.d.ts b/src/rules/sonarjs/no-nested-switch.d.ts new file mode 100644 index 00000000..4e065c1c --- /dev/null +++ b/src/rules/sonarjs/no-nested-switch.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * "switch" statements should not be nested. + * + * @see [no-nested-switch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-nested-switch.md) + */ +export type NoNestedSwitchRuleConfig = RuleConfig<[]>; + +/** + * "switch" statements should not be nested. + * + * @see [no-nested-switch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-nested-switch.md) + */ +export interface NoNestedSwitchRule { + /** + * "switch" statements should not be nested. + * + * @see [no-nested-switch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-nested-switch.md) + */ + 'sonarjs/no-nested-switch': NoNestedSwitchRuleConfig; +} diff --git a/src/rules/sonarjs/no-nested-template-literals.d.ts b/src/rules/sonarjs/no-nested-template-literals.d.ts new file mode 100644 index 00000000..c30f047e --- /dev/null +++ b/src/rules/sonarjs/no-nested-template-literals.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Template literals should not be nested. + * + * @see [no-nested-template-literals](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-nested-template-literals.md) + */ +export type NoNestedTemplateLiteralsRuleConfig = RuleConfig<[]>; + +/** + * Template literals should not be nested. + * + * @see [no-nested-template-literals](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-nested-template-literals.md) + */ +export interface NoNestedTemplateLiteralsRule { + /** + * Template literals should not be nested. + * + * @see [no-nested-template-literals](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-nested-template-literals.md) + */ + 'sonarjs/no-nested-template-literals': NoNestedTemplateLiteralsRuleConfig; +} diff --git a/src/rules/sonarjs/no-one-iteration-loop.d.ts b/src/rules/sonarjs/no-one-iteration-loop.d.ts new file mode 100644 index 00000000..bbac575c --- /dev/null +++ b/src/rules/sonarjs/no-one-iteration-loop.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Loops with at most one iteration should be refactored. + * + * @see [no-one-iteration-loop](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-one-iteration-loop.md) + */ +export type NoOneIterationLoopRuleConfig = RuleConfig<[]>; + +/** + * Loops with at most one iteration should be refactored. + * + * @see [no-one-iteration-loop](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-one-iteration-loop.md) + */ +export interface NoOneIterationLoopRule { + /** + * Loops with at most one iteration should be refactored. + * + * @see [no-one-iteration-loop](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-one-iteration-loop.md) + */ + 'sonarjs/no-one-iteration-loop': NoOneIterationLoopRuleConfig; +} diff --git a/src/rules/sonarjs/no-redundant-boolean.d.ts b/src/rules/sonarjs/no-redundant-boolean.d.ts new file mode 100644 index 00000000..e1880425 --- /dev/null +++ b/src/rules/sonarjs/no-redundant-boolean.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Boolean literals should not be redundant. + * + * @see [no-redundant-boolean](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-redundant-boolean.md) + */ +export type NoRedundantBooleanRuleConfig = RuleConfig<[]>; + +/** + * Boolean literals should not be redundant. + * + * @see [no-redundant-boolean](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-redundant-boolean.md) + */ +export interface NoRedundantBooleanRule { + /** + * Boolean literals should not be redundant. + * + * @see [no-redundant-boolean](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-redundant-boolean.md) + */ + 'sonarjs/no-redundant-boolean': NoRedundantBooleanRuleConfig; +} diff --git a/src/rules/sonarjs/no-redundant-jump.d.ts b/src/rules/sonarjs/no-redundant-jump.d.ts new file mode 100644 index 00000000..5dd52760 --- /dev/null +++ b/src/rules/sonarjs/no-redundant-jump.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Jump statements should not be redundant. + * + * @see [no-redundant-jump](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-redundant-jump.md) + */ +export type NoRedundantJumpRuleConfig = RuleConfig<[]>; + +/** + * Jump statements should not be redundant. + * + * @see [no-redundant-jump](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-redundant-jump.md) + */ +export interface NoRedundantJumpRule { + /** + * Jump statements should not be redundant. + * + * @see [no-redundant-jump](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-redundant-jump.md) + */ + 'sonarjs/no-redundant-jump': NoRedundantJumpRuleConfig; +} diff --git a/src/rules/sonarjs/no-same-line-conditional.d.ts b/src/rules/sonarjs/no-same-line-conditional.d.ts new file mode 100644 index 00000000..e5cca876 --- /dev/null +++ b/src/rules/sonarjs/no-same-line-conditional.d.ts @@ -0,0 +1,33 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Option. + */ +export type NoSameLineConditionalOption = 'sonar-runtime'; + +/** + * Options. + */ +export type NoSameLineConditionalOptions = [NoSameLineConditionalOption?]; + +/** + * Conditionals should start on new lines. + * + * @see [no-same-line-conditional](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-same-line-conditional.md) + */ +export type NoSameLineConditionalRuleConfig = + RuleConfig; + +/** + * Conditionals should start on new lines. + * + * @see [no-same-line-conditional](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-same-line-conditional.md) + */ +export interface NoSameLineConditionalRule { + /** + * Conditionals should start on new lines. + * + * @see [no-same-line-conditional](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-same-line-conditional.md) + */ + 'sonarjs/no-same-line-conditional': NoSameLineConditionalRuleConfig; +} diff --git a/src/rules/sonarjs/no-small-switch.d.ts b/src/rules/sonarjs/no-small-switch.d.ts new file mode 100644 index 00000000..1d7ccb0c --- /dev/null +++ b/src/rules/sonarjs/no-small-switch.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * "switch" statements should have at least 3 "case" clauses. + * + * @see [no-small-switch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-small-switch.md) + */ +export type NoSmallSwitchRuleConfig = RuleConfig<[]>; + +/** + * "switch" statements should have at least 3 "case" clauses. + * + * @see [no-small-switch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-small-switch.md) + */ +export interface NoSmallSwitchRule { + /** + * "switch" statements should have at least 3 "case" clauses. + * + * @see [no-small-switch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-small-switch.md) + */ + 'sonarjs/no-small-switch': NoSmallSwitchRuleConfig; +} diff --git a/src/rules/sonarjs/no-unused-collection.d.ts b/src/rules/sonarjs/no-unused-collection.d.ts new file mode 100644 index 00000000..fda50dbd --- /dev/null +++ b/src/rules/sonarjs/no-unused-collection.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Collection and array contents should be used. + * + * @see [no-unused-collection](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-unused-collection.md) + */ +export type NoUnusedCollectionRuleConfig = RuleConfig<[]>; + +/** + * Collection and array contents should be used. + * + * @see [no-unused-collection](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-unused-collection.md) + */ +export interface NoUnusedCollectionRule { + /** + * Collection and array contents should be used. + * + * @see [no-unused-collection](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-unused-collection.md) + */ + 'sonarjs/no-unused-collection': NoUnusedCollectionRuleConfig; +} diff --git a/src/rules/sonarjs/no-use-of-empty-return-value.d.ts b/src/rules/sonarjs/no-use-of-empty-return-value.d.ts new file mode 100644 index 00000000..0c4dda16 --- /dev/null +++ b/src/rules/sonarjs/no-use-of-empty-return-value.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * The output of functions that don't return anything should not be used. + * + * @see [no-use-of-empty-return-value](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-use-of-empty-return-value.md) + */ +export type NoUseOfEmptyReturnValueRuleConfig = RuleConfig<[]>; + +/** + * The output of functions that don't return anything should not be used. + * + * @see [no-use-of-empty-return-value](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-use-of-empty-return-value.md) + */ +export interface NoUseOfEmptyReturnValueRule { + /** + * The output of functions that don't return anything should not be used. + * + * @see [no-use-of-empty-return-value](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-use-of-empty-return-value.md) + */ + 'sonarjs/no-use-of-empty-return-value': NoUseOfEmptyReturnValueRuleConfig; +} diff --git a/src/rules/sonarjs/no-useless-catch.d.ts b/src/rules/sonarjs/no-useless-catch.d.ts new file mode 100644 index 00000000..d6dda396 --- /dev/null +++ b/src/rules/sonarjs/no-useless-catch.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * "catch" clauses should do more than rethrow. + * + * @see [no-useless-catch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-useless-catch.md) + */ +export type NoUselessCatchRuleConfig = RuleConfig<[]>; + +/** + * "catch" clauses should do more than rethrow. + * + * @see [no-useless-catch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-useless-catch.md) + */ +export interface NoUselessCatchRule { + /** + * "catch" clauses should do more than rethrow. + * + * @see [no-useless-catch](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/no-useless-catch.md) + */ + 'sonarjs/no-useless-catch': NoUselessCatchRuleConfig; +} diff --git a/src/rules/sonarjs/non-existent-operator.d.ts b/src/rules/sonarjs/non-existent-operator.d.ts new file mode 100644 index 00000000..995be33a --- /dev/null +++ b/src/rules/sonarjs/non-existent-operator.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Non-existent operators "=+", "=-" and "=!" should not be used. + * + * @see [non-existent-operator](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/non-existent-operator.md) + */ +export type NonExistentOperatorRuleConfig = RuleConfig<[]>; + +/** + * Non-existent operators "=+", "=-" and "=!" should not be used. + * + * @see [non-existent-operator](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/non-existent-operator.md) + */ +export interface NonExistentOperatorRule { + /** + * Non-existent operators "=+", "=-" and "=!" should not be used. + * + * @see [non-existent-operator](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/non-existent-operator.md) + */ + 'sonarjs/non-existent-operator': NonExistentOperatorRuleConfig; +} diff --git a/src/rules/sonarjs/prefer-immediate-return.d.ts b/src/rules/sonarjs/prefer-immediate-return.d.ts new file mode 100644 index 00000000..c5fa010f --- /dev/null +++ b/src/rules/sonarjs/prefer-immediate-return.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Local variables should not be declared and then immediately returned or thrown. + * + * @see [prefer-immediate-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-immediate-return.md) + */ +export type PreferImmediateReturnRuleConfig = RuleConfig<[]>; + +/** + * Local variables should not be declared and then immediately returned or thrown. + * + * @see [prefer-immediate-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-immediate-return.md) + */ +export interface PreferImmediateReturnRule { + /** + * Local variables should not be declared and then immediately returned or thrown. + * + * @see [prefer-immediate-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-immediate-return.md) + */ + 'sonarjs/prefer-immediate-return': PreferImmediateReturnRuleConfig; +} diff --git a/src/rules/sonarjs/prefer-object-literal.d.ts b/src/rules/sonarjs/prefer-object-literal.d.ts new file mode 100644 index 00000000..14c1dd97 --- /dev/null +++ b/src/rules/sonarjs/prefer-object-literal.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Object literal syntax should be used. + * + * @see [prefer-object-literal](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-object-literal.md) + */ +export type PreferObjectLiteralRuleConfig = RuleConfig<[]>; + +/** + * Object literal syntax should be used. + * + * @see [prefer-object-literal](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-object-literal.md) + */ +export interface PreferObjectLiteralRule { + /** + * Object literal syntax should be used. + * + * @see [prefer-object-literal](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-object-literal.md) + */ + 'sonarjs/prefer-object-literal': PreferObjectLiteralRuleConfig; +} diff --git a/src/rules/sonarjs/prefer-single-boolean-return.d.ts b/src/rules/sonarjs/prefer-single-boolean-return.d.ts new file mode 100644 index 00000000..aa040245 --- /dev/null +++ b/src/rules/sonarjs/prefer-single-boolean-return.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Return of boolean expressions should not be wrapped into an "if-then-else" statement. + * + * @see [prefer-single-boolean-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-single-boolean-return.md) + */ +export type PreferSingleBooleanReturnRuleConfig = RuleConfig<[]>; + +/** + * Return of boolean expressions should not be wrapped into an "if-then-else" statement. + * + * @see [prefer-single-boolean-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-single-boolean-return.md) + */ +export interface PreferSingleBooleanReturnRule { + /** + * Return of boolean expressions should not be wrapped into an "if-then-else" statement. + * + * @see [prefer-single-boolean-return](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-single-boolean-return.md) + */ + 'sonarjs/prefer-single-boolean-return': PreferSingleBooleanReturnRuleConfig; +} diff --git a/src/rules/sonarjs/prefer-while.d.ts b/src/rules/sonarjs/prefer-while.d.ts new file mode 100644 index 00000000..3df4e1fe --- /dev/null +++ b/src/rules/sonarjs/prefer-while.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * A "while" loop should be used instead of a "for" loop. + * + * @see [prefer-while](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-while.md) + */ +export type PreferWhileRuleConfig = RuleConfig<[]>; + +/** + * A "while" loop should be used instead of a "for" loop. + * + * @see [prefer-while](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-while.md) + */ +export interface PreferWhileRule { + /** + * A "while" loop should be used instead of a "for" loop. + * + * @see [prefer-while](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/docs/rules/prefer-while.md) + */ + 'sonarjs/prefer-while': PreferWhileRuleConfig; +}