From 5171c76d90f04c2967ce0d5ddfea6ff02e942f66 Mon Sep 17 00:00:00 2001 From: Zakaria Mansouri Date: Sun, 22 Dec 2024 17:44:02 +0100 Subject: [PATCH] fixed prettier cli params --- api/package.json | 6 ++--- api/src/app/index.ts | 8 +----- api/src/config/types.ts | 9 ++----- api/src/digest/cron.ts | 45 ++++++++++++-------------------- api/src/search/service.ts | 25 +++++------------- data/package.json | 6 ++--- packages/models/package.json | 6 ++--- packages/tooling/.prettierignore | 1 + packages/tooling/package.json | 6 ++--- packages/utils/package.json | 6 ++--- web/package.json | 6 ++--- 11 files changed, 45 insertions(+), 79 deletions(-) diff --git a/api/package.json b/api/package.json index d5a192e2d..79c21d636 100644 --- a/api/package.json +++ b/api/package.json @@ -48,7 +48,7 @@ "lint-staged": { "*.*": [ "npm run lint:eslint --fix", - "npm run lint:prettier --write" + "npm run lint:prettier -- --write" ] }, "private": true, @@ -70,10 +70,10 @@ "generate:bundle-info": "tsx ../packages/tooling/bundle-info.ts", "generate:sentry-release": "tsx ../packages/tooling/sentry-release.ts api dist", "lint": "npm run build && npm run lint:alone", - "lint:alone": "npm run lint:eslint . && npm run lint:prettier --check . && npm run lint:tsc && npm run lint:ts-prune", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune", "lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs", "lint:fix": "npm run build && npm run lint:fix:alone", - "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", "lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn", "lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error", "lint:tsc": "tspc --noEmit", diff --git a/api/src/app/index.ts b/api/src/app/index.ts index dc142be4c..e603ed32b 100644 --- a/api/src/app/index.ts +++ b/api/src/app/index.ts @@ -4,13 +4,7 @@ import "reflect-metadata"; import "src/_utils/setup-sentry"; import * as Sentry from "@sentry/node"; - -import { - RoutingControllersOptions, - createExpressServer, - useContainer, -} from "routing-controllers"; - +import { RoutingControllersOptions, createExpressServer, useContainer } from "routing-controllers"; import { Application } from "express"; import { ConfigService } from "src/config/service"; import Container from "typedi"; diff --git a/api/src/config/types.ts b/api/src/config/types.ts index 2fae1101d..09ccc1caa 100644 --- a/api/src/config/types.ts +++ b/api/src/config/types.ts @@ -1,7 +1,4 @@ -import { - Environment, - environments, -} from "@dzcode.io/utils/dist/config/environment"; +import { Environment, environments } from "@dzcode.io/utils/dist/config/environment"; import { IsOptional, IsString, Matches } from "class-validator"; import { Expose } from "class-transformer"; @@ -39,9 +36,7 @@ export class EnvRecord { @Expose() get MEILISEARCH_URL() { - return this.NODE_ENV === "development" - ? "http://localhost:7700/" - : "http://meilisearch:7700/"; + return this.NODE_ENV === "development" ? "http://localhost:7700/" : "http://meilisearch:7700/"; } MEILISEARCH_MASTER_KEY = "default"; diff --git a/api/src/digest/cron.ts b/api/src/digest/cron.ts index 24bb3ff78..43feba566 100644 --- a/api/src/digest/cron.ts +++ b/api/src/digest/cron.ts @@ -78,8 +78,7 @@ export class DigestCron { id: project.slug.replace(/[.]/g, "-"), // NOTE-OB: MeiliSearch doesn't allow dots in ids name: project.name, }; - const [{ id: projectId }] = - await this.projectsRepository.upsert(projectEntity); + const [{ id: projectId }] = await this.projectsRepository.upsert(projectEntity); await this.searchService.upsert("project", projectEntity); let addedRepositoryCount = 0; @@ -93,16 +92,15 @@ export class DigestCron { }); const provider = "github"; - const [{ id: repositoryId }] = - await this.repositoriesRepository.upsert({ - provider, - name: repoInfo.name, - owner: repoInfo.owner.login, - runId, - projectId, - stars: repoInfo.stargazers_count, - id: `${provider}-${repoInfo.id}`, - }); + const [{ id: repositoryId }] = await this.repositoriesRepository.upsert({ + provider, + name: repoInfo.name, + owner: repoInfo.owner.login, + runId, + projectId, + stars: repoInfo.stargazers_count, + id: `${provider}-${repoInfo.id}`, + }); addedRepositoryCount++; const issues = await this.githubService.listRepositoryIssues({ @@ -144,26 +142,19 @@ export class DigestCron { updatedAt: issue.updated_at, activityCount: issue.comments, runId, - url: - type === "PULL_REQUEST" - ? issue.pull_request.html_url - : issue.html_url, + url: type === "PULL_REQUEST" ? issue.pull_request.html_url : issue.html_url, repositoryId, contributorId, id: `${provider}-${issue.id}`, }; await this.contributionsRepository.upsert(contributionEntity); - await this.searchService.upsert( - "contribution", - contributionEntity, - ); + await this.searchService.upsert("contribution", contributionEntity); } - const repoContributors = - await this.githubService.listRepositoryContributors({ - owner: repository.owner, - repository: repository.name, - }); + const repoContributors = await this.githubService.listRepositoryContributors({ + owner: repository.owner, + repository: repository.name, + }); const repoContributorsFiltered = repoContributors.filter( (contributor) => contributor.type === "User", @@ -207,9 +198,7 @@ export class DigestCron { } try { - await this.contributorsRepository.deleteAllRelationWithRepositoryButWithRunId( - runId, - ); + await this.contributorsRepository.deleteAllRelationWithRepositoryButWithRunId(runId); await this.contributionsRepository.deleteAllButWithRunId(runId); await this.contributorsRepository.deleteAllButWithRunId(runId); await this.repositoriesRepository.deleteAllButWithRunId(runId); diff --git a/api/src/search/service.ts b/api/src/search/service.ts index 2206d641a..9bb147e64 100644 --- a/api/src/search/service.ts +++ b/api/src/search/service.ts @@ -14,8 +14,7 @@ export class SearchService { private readonly logger: LoggerService, ) { this.logger.info({ message: "Initializing MeiliSearch client" }); - const { MEILISEARCH_URL, MEILISEARCH_MASTER_KEY } = - this.configService.env(); + const { MEILISEARCH_URL, MEILISEARCH_MASTER_KEY } = this.configService.env(); this.meilisearch = new MeiliSearch({ host: MEILISEARCH_URL, @@ -33,10 +32,7 @@ export class SearchService { }; }; - public upsert = async ( - index: SearchType, - data: T, - ): Promise => { + public upsert = async (index: SearchType, data: T): Promise => { this.logger.info({ message: `Upserting "${data.id}" item to ${index}`, }); @@ -44,10 +40,7 @@ export class SearchService { this.logger.info({ message: `Upserted "${data.id}" item to ${index}` }); }; - public deleteAllButWithRunId = async ( - index: SearchType, - runId: string, - ): Promise => { + public deleteAllButWithRunId = async (index: SearchType, runId: string): Promise => { this.logger.info({ message: `Deleting all ${index} but with runId ${runId}`, }); @@ -83,14 +76,8 @@ export class SearchService { } private async updateFilterableAttributes(): Promise { - await this.meilisearch - .index("project") - .updateFilterableAttributes(["runId"]); - await this.meilisearch - .index("contribution") - .updateFilterableAttributes(["runId"]); - await this.meilisearch - .index("contributor") - .updateFilterableAttributes(["runId"]); + await this.meilisearch.index("project").updateFilterableAttributes(["runId"]); + await this.meilisearch.index("contribution").updateFilterableAttributes(["runId"]); + await this.meilisearch.index("contributor").updateFilterableAttributes(["runId"]); } } diff --git a/data/package.json b/data/package.json index f71167151..9efe47634 100644 --- a/data/package.json +++ b/data/package.json @@ -21,7 +21,7 @@ "lint-staged": { "*.*": [ "npm run lint:eslint --fix", - "npm run lint:prettier --write" + "npm run lint:prettier -- --write" ] }, "private": true, @@ -37,10 +37,10 @@ "clean": "lerna run clean:alone --scope=@dzcode.io/api --include-dependencies --stream", "clean:alone": "del dist coverage", "lint": "npm run build && npm run lint:alone", - "lint:alone": "npm run lint:eslint . && npm run lint:prettier --check . && npm run lint:tsc && npm run lint:ts-prune", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune", "lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs", "lint:fix": "npm run build && npm run lint:fix:alone", - "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", "lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn", "lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error", "lint:tsc": "tsc --noEmit", diff --git a/packages/models/package.json b/packages/models/package.json index 758d9c370..d356f0207 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -17,7 +17,7 @@ "lint-staged": { "*.*": [ "npm run lint:eslint --fix", - "npm run lint:prettier --write" + "npm run lint:prettier -- --write" ] }, "main": "dist", @@ -30,10 +30,10 @@ "clean": "lerna run clean:alone --scope=@dzcode.io/models --include-dependencies --stream", "clean:alone": "del dist coverage", "lint": "npm run build && npm run lint:alone", - "lint:alone": "npm run lint:eslint . && npm run lint:prettier --check .", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check .", "lint:eslint": "eslint --config ../tooling/eslint.config.mjs", "lint:fix": "npm run build && npm run lint:fix:alone", - "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", "lint:prettier": "prettier --config ../tooling/.prettierrc --ignore-path ../tooling/.prettierignore --log-level warn", "test": "npm run build && npm run test:alone", "test:alone": "jest --config ../tooling/jest.config.ts --rootDir .", diff --git a/packages/tooling/.prettierignore b/packages/tooling/.prettierignore index e7bc2a296..024d5f137 100644 --- a/packages/tooling/.prettierignore +++ b/packages/tooling/.prettierignore @@ -4,6 +4,7 @@ dist # api oracle-cloud/build +db # web bundle diff --git a/packages/tooling/package.json b/packages/tooling/package.json index ac64f53bd..99f99f86a 100644 --- a/packages/tooling/package.json +++ b/packages/tooling/package.json @@ -11,16 +11,16 @@ "lint-staged": { "*.*": [ "npm run lint:eslint --fix", - "npm run lint:prettier --write" + "npm run lint:prettier -- --write" ] }, "private": true, "scripts": { "lint": "npm run lint:alone", - "lint:alone": "npm run lint:eslint . && npm run lint:prettier --check .", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check .", "lint:eslint": "eslint --config eslint.config.mjs", "lint:fix": "npm run lint:fix:alone", - "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", "lint:prettier": "prettier --config .prettierrc --ignore-path .prettierignore --log-level warn" } } diff --git a/packages/utils/package.json b/packages/utils/package.json index 190e4291a..67228d5b0 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -14,7 +14,7 @@ "lint-staged": { "*.*": [ "npm run lint:eslint --fix", - "npm run lint:prettier --write" + "npm run lint:prettier -- --write" ] }, "main": "dist", @@ -27,10 +27,10 @@ "clean": "lerna run clean:alone --scope=@dzcode.io/utils --include-dependencies --stream", "clean:alone": "del dist coverage", "lint": "npm run build && npm run lint:alone", - "lint:alone": "npm run lint:eslint . && npm run lint:prettier --check .", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check .", "lint:eslint": "eslint --config ../tooling/eslint.config.mjs", "lint:fix": "npm run build && npm run lint:fix:alone", - "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", "lint:prettier": "prettier --config ../tooling/.prettierrc --ignore-path ../tooling/.prettierignore --log-level warn", "test": "npm run build && npm run test:alone", "test:alone": "jest --config ../tooling/jest.config.ts --rootDir .", diff --git a/web/package.json b/web/package.json index abb7747d7..b1c1da069 100644 --- a/web/package.json +++ b/web/package.json @@ -51,7 +51,7 @@ "lint-staged": { "*.*": [ "npm run lint:eslint --fix", - "npm run lint:prettier --write" + "npm run lint:prettier -- --write" ] }, "private": true, @@ -79,10 +79,10 @@ "lh:collect": "npx --yes @lhci/cli collect", "lh:upload": "npx --yes @lhci/cli upload", "lint": "npm run build && npm run lint:alone", - "lint:alone": "npm run lint:eslint . && npm run lint:prettier --check . && npm run lint:tsc && npm run lint:ts-prune", + "lint:alone": "npm run lint:eslint . && npm run lint:prettier -- --check . && npm run lint:tsc && npm run lint:ts-prune", "lint:eslint": "eslint --config ../packages/tooling/eslint.config.mjs", "lint:fix": "npm run build && npm run lint:fix:alone", - "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier --write .", + "lint:fix:alone": "npm run lint:eslint --fix . && npm run lint:prettier -- --write .", "lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --log-level warn", "lint:ts-prune": "tsx ../packages/tooling/setup-ts-prune.ts && ts-prune --error", "lint:tsc": "tsc --noEmit",