From 0b59fc639ddb2cc98d242d503dabd85a79ab905a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 27 Aug 2023 11:13:11 +0200 Subject: [PATCH] Feature/upgrade prettier to version 3 (#2163) * Upgrade prettier to version 3.0.2 * Prettify code * Update changelog --- .prettierrc | 1 + CHANGELOG.md | 1 + apps/api/src/app/auth/auth.controller.ts | 5 ++--- apps/api/src/app/health/health.controller.ts | 10 ++++------ .../src/app/portfolio/portfolio.service.ts | 20 ++++++++----------- .../app/subscription/subscription.service.ts | 5 ++--- .../data-gathering/data-gathering.service.ts | 10 ++++------ .../trackinsight/trackinsight.service.ts | 12 +++++------ .../yahoo-finance/yahoo-finance.service.ts | 5 ++--- .../twitter-bot/twitter-bot.service.ts | 5 ++--- .../admin-market-data-detail.component.html | 2 +- apps/client/src/index.html | 2 +- libs/ui/.storybook/preview-head.html | 2 +- .../activities-table.component.html | 2 +- .../fire-calculator.component.html | 2 +- package.json | 4 ++-- yarn.lock | 18 ++++++++--------- 17 files changed, 48 insertions(+), 58 deletions(-) diff --git a/.prettierrc b/.prettierrc index 30f191d91..6a8ad9afa 100644 --- a/.prettierrc +++ b/.prettierrc @@ -9,6 +9,7 @@ ], "attributeSort": "ASC", "endOfLine": "auto", + "plugins": ["prettier-plugin-organize-attributes"], "printWidth": 80, "singleQuote": true, "tabWidth": 2, diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d2dd3de8..3b2f6634b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Upgraded `Nx` from version `16.7.2` to `16.7.4` +- Upgraded `prettier` from version `2.8.4` to `3.0.2` ## 1.303.0 - 2023-08-23 diff --git a/apps/api/src/app/auth/auth.controller.ts b/apps/api/src/app/auth/auth.controller.ts index 0c6b047bf..376109b8d 100644 --- a/apps/api/src/app/auth/auth.controller.ts +++ b/apps/api/src/app/auth/auth.controller.ts @@ -41,9 +41,8 @@ export class AuthController { @Param('accessToken') accessToken: string ): Promise { try { - const authToken = await this.authService.validateAnonymousLogin( - accessToken - ); + const authToken = + await this.authService.validateAnonymousLogin(accessToken); return { authToken }; } catch { throw new HttpException( diff --git a/apps/api/src/app/health/health.controller.ts b/apps/api/src/app/health/health.controller.ts index 3c8c0ef56..cc430c0dc 100644 --- a/apps/api/src/app/health/health.controller.ts +++ b/apps/api/src/app/health/health.controller.ts @@ -20,9 +20,8 @@ export class HealthController { @Get('data-enhancer/:name') public async getHealthOfDataEnhancer(@Param('name') name: string) { - const hasResponse = await this.healthService.hasResponseFromDataEnhancer( - name - ); + const hasResponse = + await this.healthService.hasResponseFromDataEnhancer(name); if (hasResponse !== true) { throw new HttpException( @@ -44,9 +43,8 @@ export class HealthController { ); } - const hasResponse = await this.healthService.hasResponseFromDataProvider( - dataSource - ); + const hasResponse = + await this.healthService.hasResponseFromDataProvider(dataSource); if (hasResponse !== true) { throw new HttpException( diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 564056d1c..466cec964 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -470,9 +470,8 @@ export class PortfolioService { transactionPoints[0]?.date ?? format(new Date(), DATE_FORMAT) ); const startDate = this.getStartDate(dateRange, portfolioStart); - const currentPositions = await portfolioCalculator.getCurrentPositions( - startDate - ); + const currentPositions = + await portfolioCalculator.getCurrentPositions(startDate); const cashDetails = await this.accountService.getCashDetails({ filters, @@ -810,9 +809,8 @@ export class PortfolioService { const transactionPoints = portfolioCalculator.getTransactionPoints(); const portfolioStart = parseDate(transactionPoints[0].date); - const currentPositions = await portfolioCalculator.getCurrentPositions( - portfolioStart - ); + const currentPositions = + await portfolioCalculator.getCurrentPositions(portfolioStart); const position = currentPositions.positions.find( (item) => item.symbol === aSymbol @@ -1046,9 +1044,8 @@ export class PortfolioService { const portfolioStart = parseDate(transactionPoints[0].date); const startDate = this.getStartDate(dateRange, portfolioStart); - const currentPositions = await portfolioCalculator.getCurrentPositions( - startDate - ); + const currentPositions = + await portfolioCalculator.getCurrentPositions(startDate); const positions = currentPositions.positions.filter( (item) => !item.quantity.eq(0) @@ -1238,9 +1235,8 @@ export class PortfolioService { portfolioCalculator.setTransactionPoints(transactionPoints); const portfolioStart = parseDate(transactionPoints[0].date); - const currentPositions = await portfolioCalculator.getCurrentPositions( - portfolioStart - ); + const currentPositions = + await portfolioCalculator.getCurrentPositions(portfolioStart); const positions = currentPositions.positions.filter( (item) => !item.quantity.eq(0) diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts index c3e01851d..d94dd68ad 100644 --- a/apps/api/src/app/subscription/subscription.service.ts +++ b/apps/api/src/app/subscription/subscription.service.ts @@ -93,9 +93,8 @@ export class SubscriptionService { public async createSubscriptionViaStripe(aCheckoutSessionId: string) { try { - const session = await this.stripe.checkout.sessions.retrieve( - aCheckoutSessionId - ); + const session = + await this.stripe.checkout.sessions.retrieve(aCheckoutSessionId); await this.createSubscription({ price: session.amount_total / 100, diff --git a/apps/api/src/services/data-gathering/data-gathering.service.ts b/apps/api/src/services/data-gathering/data-gathering.service.ts index 7718ef394..77b79835d 100644 --- a/apps/api/src/services/data-gathering/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering/data-gathering.service.ts @@ -127,12 +127,10 @@ export class DataGatheringService { uniqueAssets = await this.getUniqueAssets(); } - const assetProfiles = await this.dataProviderService.getAssetProfiles( - uniqueAssets - ); - const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( - uniqueAssets - ); + const assetProfiles = + await this.dataProviderService.getAssetProfiles(uniqueAssets); + const symbolProfiles = + await this.symbolProfileService.getSymbolProfiles(uniqueAssets); for (const [symbol, assetProfile] of Object.entries(assetProfiles)) { const symbolMapping = symbolProfiles.find((symbolProfile) => { diff --git a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts index ee81ef591..07c0234b6 100644 --- a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts +++ b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts @@ -38,9 +38,9 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { .json() .catch(() => { return got( - `${TrackinsightDataEnhancerService.baseUrl}/funds/${ - symbol.split('.')?.[0] - }.json` + `${TrackinsightDataEnhancerService.baseUrl}/funds/${symbol.split( + '.' + )?.[0]}.json` ) .json() .catch(() => { @@ -60,9 +60,9 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { .json() .catch(() => { return got( - `${TrackinsightDataEnhancerService.baseUrl}/holdings/${ - symbol.split('.')?.[0] - }.json` + `${TrackinsightDataEnhancerService.baseUrl}/holdings/${symbol.split( + '.' + )?.[0]}.json` ) .json() .catch(() => { diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts index 54145a8b4..9e7032de6 100644 --- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts @@ -99,9 +99,8 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface { yahooSymbol = quotes[0].symbol; } - const { countries, sectors, url } = await this.getAssetProfile( - yahooSymbol - ); + const { countries, sectors, url } = + await this.getAssetProfile(yahooSymbol); if (countries) { response.countries = countries; diff --git a/apps/api/src/services/twitter-bot/twitter-bot.service.ts b/apps/api/src/services/twitter-bot/twitter-bot.service.ts index 218dd291f..d3e7fb91c 100644 --- a/apps/api/src/services/twitter-bot/twitter-bot.service.ts +++ b/apps/api/src/services/twitter-bot/twitter-bot.service.ts @@ -65,9 +65,8 @@ export class TwitterBotService { status += benchmarkListing; } - const { data: createdTweet } = await this.twitterClient.v2.tweet( - status - ); + const { data: createdTweet } = + await this.twitterClient.v2.tweet(status); Logger.log( `Fear & Greed Index has been tweeted: https://twitter.com/ghostfolio_/status/${createdTweet.id}`, diff --git a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html index dc64ed120..d6f67faa3 100644 --- a/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html +++ b/apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html @@ -29,7 +29,7 @@ }" [title]=" (itemByMonth.key + '-' + (i + 1 < 10 ? '0' + (i + 1) : i + 1) - | date : defaultDateFormat) ?? '' + | date: defaultDateFormat) ?? '' " (click)=" onOpenMarketDataDetail({ diff --git a/apps/client/src/index.html b/apps/client/src/index.html index 55120ec08..eabc42f94 100644 --- a/apps/client/src/index.html +++ b/apps/client/src/index.html @@ -1,4 +1,4 @@ - + ${title} diff --git a/libs/ui/.storybook/preview-head.html b/libs/ui/.storybook/preview-head.html index ef2b9647a..aa97d5363 100644 --- a/libs/ui/.storybook/preview-head.html +++ b/libs/ui/.storybook/preview-head.html @@ -1,6 +1,6 @@