From c6f0d95f880b476ae7ad8e9f4df94203270800d4 Mon Sep 17 00:00:00 2001 From: Florian Volk Date: Tue, 19 Apr 2022 13:32:40 +0200 Subject: [PATCH] chore(lint): add TSDoc to eslint config Closes: #107 --- .eslintrc.json | 10 +- cypress/plugins/index.ts | 18 +++ package-lock.json | 134 ++++++++++++++++++ package.json | 1 + .../marketplace-client-app.component.ts | 3 +- .../components/my-apps/my-apps.component.ts | 5 +- src/app/interfaces/ICommunication.ts | 1 + src/app/services/api/api.service.ts | 8 +- .../permissions/permissions.service.ts | 2 +- src/app/services/policy/policy.service.ts | 5 +- src/app/services/spinner/spinner.service.ts | 4 +- src/app/services/toc/toc.service.ts | 6 +- src/polyfills.ts | 4 +- 13 files changed, 180 insertions(+), 21 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9d025253..c61921d8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,16 +15,22 @@ ], "createDefaultProgram": true }, + "plugins": [ + "@typescript-eslint/eslint-plugin", + "eslint-plugin-tsdoc" + ], "extends": [ "plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates", "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:prettier/recommended" + "plugin:prettier/recommended", + "plugin:@typescript-eslint/recommended" ], "rules": { - "@typescript-eslint/no-empty-function": "off" + "@typescript-eslint/no-empty-function": "off", + "tsdoc/syntax": "warn" } }, // NOTE: WE ARE NOT APPLYING PRETTIER IN THIS OVERRIDE, ONLY @ANGULAR-ESLINT/TEMPLATE diff --git a/cypress/plugins/index.ts b/cypress/plugins/index.ts index bebb39da..cdc8e29b 100644 --- a/cypress/plugins/index.ts +++ b/cypress/plugins/index.ts @@ -1,3 +1,19 @@ +/* + * Copyright 2022 Scheer PAS Schweiz AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * imitations under the License. + */ + /// // *********************************************************** // This example plugins/index.ts can be used to load plugins @@ -12,6 +28,8 @@ // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) +/* eslint-disable tsdoc/syntax */ + /** * @type {Cypress.PluginConfig} */ diff --git a/package-lock.json b/package-lock.json index e179f4d8..822984f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,6 +55,7 @@ "eslint": "8.14.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-prettier": "4.0.0", + "eslint-plugin-tsdoc": "^0.2.16", "jasmine-core": "4.1.0", "karma": "6.3.19", "karma-chrome-launcher": "3.1.1", @@ -2713,6 +2714,59 @@ "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.3.1.tgz", "integrity": "sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw==" }, + "node_modules/@microsoft/tsdoc": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", + "integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==", + "dev": true + }, + "node_modules/@microsoft/tsdoc-config": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", + "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.14.1", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, + "node_modules/@microsoft/tsdoc-config/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@microsoft/tsdoc-config/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/@ngtools/webpack": { "version": "13.3.4", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-13.3.4.tgz", @@ -7856,6 +7910,16 @@ } } }, + "node_modules/eslint-plugin-tsdoc": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.16.tgz", + "integrity": "sha512-F/RWMnyDQuGlg82vQEFHQtGyWi7++XJKdYNn0ulIbyMOFqYIjoJOUdE6olORxgwgLkpJxsCJpJbTHgxJ/ggfXw==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc-config": "0.16.1" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -10390,6 +10454,12 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "dev": true + }, "node_modules/js-file-download": { "version": "0.4.12", "resolved": "https://registry.npmjs.org/js-file-download/-/js-file-download-0.4.12.tgz", @@ -18954,6 +19024,54 @@ "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.3.1.tgz", "integrity": "sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw==" }, + "@microsoft/tsdoc": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.1.tgz", + "integrity": "sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==", + "dev": true + }, + "@microsoft/tsdoc-config": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.1.tgz", + "integrity": "sha512-2RqkwiD4uN6MLnHFljqBlZIXlt/SaUT6cuogU1w2ARw4nKuuppSmR0+s+NC+7kXBQykd9zzu0P4HtBpZT5zBpQ==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.14.1", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + }, + "dependencies": { + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + } + } + }, "@ngtools/webpack": { "version": "13.3.4", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-13.3.4.tgz", @@ -22871,6 +22989,16 @@ "prettier-linter-helpers": "^1.0.0" } }, + "eslint-plugin-tsdoc": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.16.tgz", + "integrity": "sha512-F/RWMnyDQuGlg82vQEFHQtGyWi7++XJKdYNn0ulIbyMOFqYIjoJOUdE6olORxgwgLkpJxsCJpJbTHgxJ/ggfXw==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.14.1", + "@microsoft/tsdoc-config": "0.16.1" + } + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -24639,6 +24767,12 @@ } } }, + "jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "dev": true + }, "js-file-download": { "version": "0.4.12", "resolved": "https://registry.npmjs.org/js-file-download/-/js-file-download-0.4.12.tgz", diff --git a/package.json b/package.json index aee5c6e8..0a24f49a 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "eslint": "8.14.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-prettier": "4.0.0", + "eslint-plugin-tsdoc": "^0.2.16", "jasmine-core": "4.1.0", "karma": "6.3.19", "karma-chrome-launcher": "3.1.1", diff --git a/src/app/components/marketplace-client-app/marketplace-client-app.component.ts b/src/app/components/marketplace-client-app/marketplace-client-app.component.ts index 79c1861f..11c4997d 100644 --- a/src/app/components/marketplace-client-app/marketplace-client-app.component.ts +++ b/src/app/components/marketplace-client-app/marketplace-client-app.component.ts @@ -109,7 +109,6 @@ export class MarketplaceClientAppComponent implements OnInit { /** * Try to create a user organization every time. * Refactor this later to accept org-names - * @private */ private createOrgAndLoadClients() { this.orgService @@ -159,7 +158,7 @@ export class MarketplaceClientAppComponent implements OnInit { * the client already exists * there are multiple orgs and no org is selected * - * @return true if the create client button should be disabled + * @returns true if the create client button should be disabled */ public isCreateButtonDisabled(): boolean { return ( diff --git a/src/app/components/my-apps/my-apps.component.ts b/src/app/components/my-apps/my-apps.component.ts index aa70e94b..99b90a84 100644 --- a/src/app/components/my-apps/my-apps.component.ts +++ b/src/app/components/my-apps/my-apps.component.ts @@ -268,9 +268,8 @@ export class MyAppsComponent implements OnInit { } /** - * Contracts will be stored in a map with schema {client.name:contract.version,contract-object} - * @param contracts - * @private + * Contracts will be stored in a map with schema "\{client.name:contract.version,contract-object\}" + * @param contracts - array of extended contracts */ private extractContracts(contracts: IContractExt[]) { this.contracts = this.contracts.concat(contracts); diff --git a/src/app/interfaces/ICommunication.ts b/src/app/interfaces/ICommunication.ts index 6aeb3925..15399b77 100644 --- a/src/app/interfaces/ICommunication.ts +++ b/src/app/interfaces/ICommunication.ts @@ -14,6 +14,7 @@ * imitations under the License. */ +/* eslint-disable tsdoc/syntax */ import { IPolicyExt } from './IPolicy'; export interface IAction { diff --git a/src/app/services/api/api.service.ts b/src/app/services/api/api.service.ts index deab77dd..21a1fcae 100644 --- a/src/app/services/api/api.service.ts +++ b/src/app/services/api/api.service.ts @@ -152,10 +152,10 @@ export class ApiService { /** * This method will create and name the definition file and creates the download * The name pattern is: apiName-apiVersion.fileEnding e.g. Petstore-1.0.json - * @param data the definition as blob - * @param apiId the name of the API - * @param apiVersion the version of the API - * @param definitionType the definition type of the API (SwaggerJSON, SwaggerYAML, WSDL) + * @param data - the definition as blob + * @param apiId - the name of the API + * @param apiVersion - the version of the API + * @param definitionType - the definition type of the API (SwaggerJSON, SwaggerYAML, WSDL) */ private downloadFile( data: Blob, diff --git a/src/app/services/permissions/permissions.service.ts b/src/app/services/permissions/permissions.service.ts index e5acd361..89edb040 100644 --- a/src/app/services/permissions/permissions.service.ts +++ b/src/app/services/permissions/permissions.service.ts @@ -42,7 +42,7 @@ export class PermissionsService { /** * This will return an array of organizationIds where the permission applies - * @param requestedPermission the permission to be checked + * @param requestedPermission - the permission to be checked */ public getAllowedOrganizations(requestedPermission: IPermission): string[] { const organizations: string[] = []; diff --git a/src/app/services/policy/policy.service.ts b/src/app/services/policy/policy.service.ts index bdde425e..0e2eea44 100644 --- a/src/app/services/policy/policy.service.ts +++ b/src/app/services/policy/policy.service.ts @@ -405,9 +405,8 @@ export class PolicyService { /** * The function calculates in reference to the max value of a policy the remaining time * Schema: ([max value in sec] - [remaining time in sec]) / [max value in sec] * [unit multiplier] - * @param timeUnitData - * @param reset the value once the policy will reset the current value in seconds - * @private + * @param timeUnitData - the time unit the policy applies for + * @param reset - the value once the policy will reset the current value in seconds */ private calcCurrentTimeValue( timeUnitData: ITimeUnitData, diff --git a/src/app/services/spinner/spinner.service.ts b/src/app/services/spinner/spinner.service.ts index 99fe7055..ee8e34d7 100644 --- a/src/app/services/spinner/spinner.service.ts +++ b/src/app/services/spinner/spinner.service.ts @@ -1,5 +1,5 @@ /* - * Copyright 2021 Scheer PAS Schweiz AG + * Copyright 2022 Scheer PAS Schweiz AG * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ export class SpinnerService { /** * Because of change detection we need a timeout, otherwise console would show several errors - * @param waiting + * @param waiting - boolean if the spinner is shown or not */ setWaiting(waiting: boolean): void { setTimeout(() => { diff --git a/src/app/services/toc/toc.service.ts b/src/app/services/toc/toc.service.ts index 4a875f4e..adb74049 100644 --- a/src/app/services/toc/toc.service.ts +++ b/src/app/services/toc/toc.service.ts @@ -1,5 +1,5 @@ /* - * Copyright 2021 Scheer PAS Schweiz AG + * Copyright 2022 Scheer PAS Schweiz AG * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ export class TocService { /** * Schema Example: applications#SpringCorp.-1.0-SupportManager-1.0 - * @param contract + * @param contract - the extended contract */ formatApiVersionPlanId(contract: IContractExt): string { return ( @@ -39,7 +39,7 @@ export class TocService { /** * Schema Example: applications#SpringCorp.-1.0 - * @param contract + * @param contract - the extended contract */ formatClientId(contract: IContractExt): string { return contract.client.client.id + '-' + contract.client.version; diff --git a/src/polyfills.ts b/src/polyfills.ts index 1bd60146..9376e10f 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -1,5 +1,5 @@ /* - * Copyright 2021 Scheer PAS Schweiz AG + * Copyright 2022 Scheer PAS Schweiz AG * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ * imitations under the License. */ +/* eslint-disable tsdoc/syntax */ + /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file.