From abf1f4ef106900b308e2c2dd3487637b24813669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Dostie?= <35579930+gdostie@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:13:00 -0500 Subject: [PATCH 1/4] ci: run lint during CI workflow --- .github/workflows/ci.yml | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48feae03e..4683ddc1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,8 @@ jobs: - name: Check merge commit if: github.event_name == 'merge_group' uses: ./.github/actions/merge-commit + - name: Statical analysis + uses: ./.github/actions/lint - name: Tests run: npm test - name: Build diff --git a/package.json b/package.json index 0efcea135..28a2b2935 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "release": "semantic-release", "commit-cli": "git-cz", "lint:fix": "prettier --list-different --write \"**/*.{ts,js,json,md,yml}\" && eslint . --fix --quiet", - "lint": "prettier --check \"**/*.{ts,js,json,md,yml}\" && eslint .", + "lint": "prettier --check \"**/*.{ts,js,json,md,yml}\" && eslint . && echo 'Code looks good ✅'", "prepare": "husky install" }, "devDependencies": { From cdd90c8112d7a91457ad4f338b5fd3a118b30791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Dostie?= <35579930+gdostie@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:24:45 -0500 Subject: [PATCH 2/4] chore(format): run lint fix --- src/resources/ApiKeys/ApiKeysInterfaces.ts | 35 +++++++++++----------- src/resources/Enums.ts | 9 +++--- src/resources/License/LicenseInterfaces.ts | 2 +- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/resources/ApiKeys/ApiKeysInterfaces.ts b/src/resources/ApiKeys/ApiKeysInterfaces.ts index aba31bf64..a2d291c34 100644 --- a/src/resources/ApiKeys/ApiKeysInterfaces.ts +++ b/src/resources/ApiKeys/ApiKeysInterfaces.ts @@ -1,5 +1,6 @@ import {GranularResource, PrivilegeModel} from '../BaseInterfaces.js'; -import {ApiKeyStatus,ApiKeyExposureReportSeverity,ApiKeyReportCreationType} from '../Enums.js'; +import {ApiKeyExposureReportSeverity, ApiKeyReportCreationType, ApiKeyStatus} from '../Enums.js'; +import {UserModel} from '../Users/UserInterfaces.js'; export interface ApiKeyBaseModel extends GranularResource { /** @@ -191,29 +192,27 @@ interface ImpersonationRestrictionsModel { interface ExposureReport { /** - * API Key logger id associated to the Exposure Report + * API Key logger id associated to the Exposure Report */ - apiKeyLoggerId: string, + apiKeyLoggerId: string; /** - * The severity of the exposure + * The severity of the exposure */ - severity: ApiKeyExposureReportSeverity, + severity: ApiKeyExposureReportSeverity; /** - * The reason behind the exposure report for a given API key + * The reason behind the exposure report for a given API key */ - reason: string, + reason: string; /** * The date the key should be deactivated */ - deactivationDate: number, - /** - * The way the API key report has been created - */ - creationType: ApiKeyReportCreationType, - /** - * Represents the user that has created the report - */ - createdBy: any + deactivationDate: number; + /** + * The way the API key report has been created + */ + creationType: ApiKeyReportCreationType; + /** + * Represents the user that has created the report + */ + createdBy: UserModel; } - - diff --git a/src/resources/Enums.ts b/src/resources/Enums.ts index 724eaf0c1..afdbb0d2a 100644 --- a/src/resources/Enums.ts +++ b/src/resources/Enums.ts @@ -1176,19 +1176,18 @@ export enum ApiKeyStatus { EXPIRED = 'EXPIRED', SOON_TO_BE_EXPIRED = 'SOON_TO_BE_EXPIRED', SOON_TO_BE_DISABLED = 'SOON_TO_BE_DISABLED', - DISABLED_EXPOSED = 'DISABLED_EXPOSED' + DISABLED_EXPOSED = 'DISABLED_EXPOSED', } export enum ApiKeyReportCreationType { MANUAL = 'MANUAL', - AUTOMATED = 'AUTOMATED' + AUTOMATED = 'AUTOMATED', } - export enum ApiKeyExposureReportSeverity { CRITICAL = 'CRITICAL', HIGH = 'HIGH', MEDIUM = 'MEDIUM', LOW = 'LOW', - WARN = 'WARN' -} \ No newline at end of file + WARN = 'WARN', +} diff --git a/src/resources/License/LicenseInterfaces.ts b/src/resources/License/LicenseInterfaces.ts index c3b08307d..49e98e466 100644 --- a/src/resources/License/LicenseInterfaces.ts +++ b/src/resources/License/LicenseInterfaces.ts @@ -155,7 +155,7 @@ export interface EntitlementModel { /** * Use case of the entitlement */ - useCase: string; + useCase: string; /** * Limit of users for the entitlement */ From ec2d982a8568c350996809c69314fdecd7ebdb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Dostie?= <35579930+gdostie@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:28:24 -0500 Subject: [PATCH 3/4] build(lint): stop running eslint on pre-commit We lint on the CI anyway so no need to slowdown the commit process --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 28a2b2935..730d32b14 100644 --- a/package.json +++ b/package.json @@ -56,11 +56,7 @@ "typescript-eslint": "8.4.0" }, "lint-staged": { - "**/*.{ts,js}": [ - "prettier --write", - "eslint . --fix" - ], - "**/*.{md,json,yml}": [ + "**/*.{ts,js,md,json,yml}": [ "prettier --write" ] }, From a67952609cdec9ac1d78a572a7eef85edda82146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Dostie?= <35579930+gdostie@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:02:24 -0500 Subject: [PATCH 4/4] refactor(npm): remove echo in lint script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 730d32b14..84e61785f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "release": "semantic-release", "commit-cli": "git-cz", "lint:fix": "prettier --list-different --write \"**/*.{ts,js,json,md,yml}\" && eslint . --fix --quiet", - "lint": "prettier --check \"**/*.{ts,js,json,md,yml}\" && eslint . && echo 'Code looks good ✅'", + "lint": "prettier --check \"**/*.{ts,js,json,md,yml}\" && eslint .", "prepare": "husky install" }, "devDependencies": {