From ffd76dbdce16ea62760a28efa5b5e98c1bd2e2a8 Mon Sep 17 00:00:00 2001 From: Igor Propisnov Date: Fri, 17 May 2024 20:56:52 +0200 Subject: [PATCH] update eslint --- frontend/.eslintrc.json | 54 ++++++++++- frontend/.prettierrc.json | 3 +- frontend/package.json | 3 + frontend/pnpm-lock.yaml | 188 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 246 insertions(+), 2 deletions(-) diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index 5d51529..5033af3 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "ignorePatterns": ["projects/**/*"], - "plugins": ["import", "prettier"], + "plugins": ["import", "prettier", "@stylistic/eslint-plugin-ts"], "overrides": [ { "files": ["*.ts"], @@ -14,6 +14,58 @@ "plugin:prettier/recommended" ], "rules": { + "@stylistic/ts/lines-between-class-members": [ + "error", + { + "enforce": [ + { "blankLine": "always", "prev": "*", "next": "method" }, + { "blankLine": "always", "prev": "method", "next": "*" }, + { "blankLine": "never", "prev": "field", "next": "field" } + ] + } + ], + // Docs for line padding => https://eslint.style/rules/js/padding-line-between-statements + "@stylistic/ts/block-spacing": ["error"], + "@stylistic/ts/brace-style": "off", + "@stylistic/ts/key-spacing": ["error", { "afterColon": true }], + "@stylistic/ts/keyword-spacing": ["error", { "before": true }], + "@stylistic/ts/no-extra-parens": ["error", "all", { + "nestedBinaryExpressions": false, + "ternaryOperandBinaryExpressions": false + }], + "@stylistic/ts/no-extra-semi": ["error"], + "@stylistic/ts/object-curly-spacing": ["error", "always"], + "@stylistic/ts/quotes": ["error", "single"], + "@stylistic/ts/semi": ["error", "always"], + "@stylistic/ts/space-before-blocks": ["error"], + "@stylistic/ts/space-before-function-paren": ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}], + "@stylistic/ts/space-infix-ops": ["error"], + // "@stylistic/ts/max-statements-per-line": ["error", { "max": 1 }], + // "@stylistic/ts/multiline-ternary": ["error", "always"], + // "@stylistic/ts/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }], + // "@stylistic/ts/no-confusing-arrow": ["error"], + // "@stylistic/ts/no-floating-decimal": ["error"], + // "@stylistic/ts/no-mixed-operators": ["error"], + // "@stylistic/ts/no-mixed-spaces-and-tabs": ["error"],/ + // "@stylistic/ts/no-multi-spaces": ["error"], + // "@stylistic/ts/no-multiple-empty-lines": ["error", { "max": 2 }], + // "@stylistic/ts/no-tabs": ["error", { "allowIndentationTabs": true }], + // "@stylistic/ts/no-whitespace-before-property": ["error"], + // "@stylistic/ts/nonblock-statement-body-position": ["error", "below"], + // "@stylistic/ts/object-curly-newline": ["error", "always"], + // "@stylistic/ts/object-property-newline": ["error"], + // "@stylistic/ts/one-var-declaration-per-line": ["error", "always"], + // "@stylistic/ts/operator-linebreak": ["error", "before"], + // "@stylistic/ts/padded-blocks": ["error", "never"], + // "@stylistic/ts/rest-spread-spacing": ["error", "never"], + // "@stylistic/ts/semi-spacing": ["error"], + // "@stylistic/ts/semi-style": ["error", "last"], + // "@stylistic/ts/space-in-parens": ["error", "never"], + // "@stylistic/ts/space-unary-ops": ["error"], + // "@stylistic/ts/template-curly-spacing": ["error"], + // "@stylistic/ts/template-tag-spacing": ["error"], + // "@stylistic/ts/wrap-regex": ["error"], + "no-var": ["error"], "prettier/prettier": ["error", { "printWidth": 80 }], "@angular-eslint/directive-selector": [ "error", diff --git a/frontend/.prettierrc.json b/frontend/.prettierrc.json index bf45c66..f434aaf 100644 --- a/frontend/.prettierrc.json +++ b/frontend/.prettierrc.json @@ -5,5 +5,6 @@ "endOfLine": "auto", "bracketSameLine": true, "htmlWhitespaceSensitivity": "ignore", - "printWidth": 80 + "printWidth": 80, + "bracketSpacing": true } diff --git a/frontend/package.json b/frontend/package.json index 119c603..aa8a57d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -42,6 +42,9 @@ "@angular-eslint/template-parser": "17.2.1", "@angular/cli": "^17.3.0", "@angular/compiler-cli": "^17.3.0", + "@stylistic/eslint-plugin": "^2.1.0", + "@stylistic/eslint-plugin-migrate": "^2.1.0", + "@stylistic/eslint-plugin-ts": "^2.1.0", "@types/jest": "^29.5.12", "@typescript-eslint/eslint-plugin": "6.19.0", "@typescript-eslint/parser": "6.19.0", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index c6468ca..54ed2f2 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -67,6 +67,15 @@ devDependencies: '@angular/compiler-cli': specifier: ^17.3.0 version: 17.3.0(@angular/compiler@17.3.0)(typescript@5.4.2) + '@stylistic/eslint-plugin': + specifier: ^2.1.0 + version: 2.1.0(eslint@8.57.0)(typescript@5.4.2) + '@stylistic/eslint-plugin-migrate': + specifier: ^2.1.0 + version: 2.1.0(eslint@8.57.0)(typescript@5.4.2) + '@stylistic/eslint-plugin-ts': + specifier: ^2.1.0 + version: 2.1.0(eslint@8.57.0)(typescript@5.4.2) '@types/jest': specifier: ^29.5.12 version: 29.5.12 @@ -2264,6 +2273,10 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true + /@eslint-stylistic/metadata@2.1.0: + resolution: {integrity: sha512-zqO4PkrOj0q/KpzaoPk2jnbV5OIP/fE5aBO02JCAkGzadXFxVAnazWr+xGh5YR1Rxo6mBOuaCVDmAlEoj6nftg==} + dev: true + /@eslint/eslintrc@2.1.4: resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3056,6 +3069,89 @@ packages: '@sinonjs/commons': 3.0.1 dev: true + /@stylistic/eslint-plugin-js@2.1.0(eslint@8.57.0): + resolution: {integrity: sha512-gdXUjGNSsnY6nPyqxu6lmDTtVrwCOjun4x8PUn0x04d5ucLI74N3MT1Q0UhdcOR9No3bo5PGDyBgXK+KmD787A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + dependencies: + '@types/eslint': 8.56.10 + acorn: 8.11.3 + eslint: 8.57.0 + eslint-visitor-keys: 4.0.0 + espree: 10.0.1 + dev: true + + /@stylistic/eslint-plugin-jsx@2.1.0(eslint@8.57.0): + resolution: {integrity: sha512-mMD7S+IndZo2vxmwpHVTCwx2O1VdtE5tmpeNwgaEcXODzWV1WTWpnsc/PECQKIr/mkLPFWiSIqcuYNhQ/3l6AQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + dependencies: + '@stylistic/eslint-plugin-js': 2.1.0(eslint@8.57.0) + '@types/eslint': 8.56.10 + eslint: 8.57.0 + estraverse: 5.3.0 + picomatch: 4.0.2 + dev: true + + /@stylistic/eslint-plugin-migrate@2.1.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-qMyfjrMFx7b+oMB7u/spW1AJHk7CCWvKy0p5CdN+hVHw3yREmbILnNJJwn8Yq4mzE9EILcOM6bhL/WIL4WqFdA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + '@eslint-stylistic/metadata': 2.1.0 + '@typescript-eslint/utils': 7.9.0(eslint@8.57.0)(typescript@5.4.2) + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + + /@stylistic/eslint-plugin-plus@2.1.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-S5QAlgYXESJaSBFhBSBLZy9o36gXrXQwWSt6QkO+F0SrT9vpV5JF/VKoh+ojO7tHzd8Ckmyouq02TT9Sv2B0zQ==} + peerDependencies: + eslint: '*' + dependencies: + '@types/eslint': 8.56.10 + '@typescript-eslint/utils': 7.9.0(eslint@8.57.0)(typescript@5.4.2) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@stylistic/eslint-plugin-ts@2.1.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-2ioFibufHYBALx2TBrU4KXovCkN8qCqcb9yIHc0fyOfTaO5jw4d56WW7YRcF3Zgde6qFyXwAN6z/+w4pnmos1g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + dependencies: + '@stylistic/eslint-plugin-js': 2.1.0(eslint@8.57.0) + '@types/eslint': 8.56.10 + '@typescript-eslint/utils': 7.9.0(eslint@8.57.0)(typescript@5.4.2) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@stylistic/eslint-plugin@2.1.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-cBBowKP2u/+uE5CzgH5w8pE9VKqcM7BXdIDPIbGt2rmLJGnA6MJPr9vYGaqgMoJFs7R/FzsMQerMvvEP40g2uw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + dependencies: + '@stylistic/eslint-plugin-js': 2.1.0(eslint@8.57.0) + '@stylistic/eslint-plugin-jsx': 2.1.0(eslint@8.57.0) + '@stylistic/eslint-plugin-plus': 2.1.0(eslint@8.57.0)(typescript@5.4.2) + '@stylistic/eslint-plugin-ts': 2.1.0(eslint@8.57.0)(typescript@5.4.2) + '@types/eslint': 8.56.10 + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@tootallnate/once@2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} @@ -3136,6 +3232,13 @@ packages: '@types/estree': 1.0.5 dev: true + /@types/eslint@8.56.10: + resolution: {integrity: sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==} + dependencies: + '@types/estree': 1.0.5 + '@types/json-schema': 7.0.15 + dev: true + /@types/eslint@8.56.5: resolution: {integrity: sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==} dependencies: @@ -3365,6 +3468,14 @@ packages: '@typescript-eslint/visitor-keys': 6.19.0 dev: true + /@typescript-eslint/scope-manager@7.9.0: + resolution: {integrity: sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.9.0 + '@typescript-eslint/visitor-keys': 7.9.0 + dev: true + /@typescript-eslint/type-utils@6.19.0(eslint@8.57.0)(typescript@5.4.2): resolution: {integrity: sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3390,6 +3501,11 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true + /@typescript-eslint/types@7.9.0: + resolution: {integrity: sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==} + engines: {node: ^18.18.0 || >=20.0.0} + dev: true + /@typescript-eslint/typescript-estree@6.19.0(typescript@5.4.2): resolution: {integrity: sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3412,6 +3528,28 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@7.9.0(typescript@5.4.2): + resolution: {integrity: sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 7.9.0 + '@typescript-eslint/visitor-keys': 7.9.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.4 + semver: 7.6.0 + ts-api-utils: 1.3.0(typescript@5.4.2) + typescript: 5.4.2 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@6.19.0(eslint@8.57.0)(typescript@5.4.2): resolution: {integrity: sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3431,6 +3569,22 @@ packages: - typescript dev: true + /@typescript-eslint/utils@7.9.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: ^8.56.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@typescript-eslint/scope-manager': 7.9.0 + '@typescript-eslint/types': 7.9.0 + '@typescript-eslint/typescript-estree': 7.9.0(typescript@5.4.2) + eslint: 8.57.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/visitor-keys@6.19.0: resolution: {integrity: sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3439,6 +3593,14 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@typescript-eslint/visitor-keys@7.9.0: + resolution: {integrity: sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.9.0 + eslint-visitor-keys: 3.4.3 + dev: true + /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true @@ -5289,6 +5451,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /eslint-visitor-keys@4.0.0: + resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true + /eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5336,6 +5503,15 @@ packages: - supports-color dev: true + /espree@10.0.1: + resolution: {integrity: sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + acorn: 8.11.3 + acorn-jsx: 5.3.2(acorn@8.11.3) + eslint-visitor-keys: 4.0.0 + dev: true + /espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -7478,6 +7654,13 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch@9.0.4: + resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true @@ -8155,6 +8338,11 @@ packages: engines: {node: '>=12'} dev: true + /picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + dev: true + /pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'}