Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/upgrade prettier to version 3 (#2163)

Thomas Kaul0b59fc639ddb
diff --git a/.prettierrc b/.prettierrc
index 30f191d91a..6a8ad9afad 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 9d2dd3de80..3b2f6634b9 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 0c6b047bfd..376109b8d0 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<OAuthResponse> {
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 3c8c0ef569..cc430c0dc7 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 564056d1ca..466cec9648 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 c3e01851d9..d94dd68adb 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 7718ef3943..77b79835d7 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 ee81ef5914..07c0234b6d 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<any>()
.catch(() => {
return got(
- `${TrackinsightDataEnhancerService.baseUrl}/funds/${
- symbol.split('.')?.[0]
- }.json`
+ `${TrackinsightDataEnhancerService.baseUrl}/funds/${symbol.split(
+ '.'
+ )?.[0]}.json`
)
.json<any>()
.catch(() => {
@@ -60,9 +60,9 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
.json<any>()
.catch(() => {
return got(
- `${TrackinsightDataEnhancerService.baseUrl}/holdings/${
- symbol.split('.')?.[0]
- }.json`
+ `${TrackinsightDataEnhancerService.baseUrl}/holdings/${symbol.split(
+ '.'
+ )?.[0]}.json`
)
.json<any>()
.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 54145a8b49..9e7032de64 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 218dd291f8..d3e7fb91c4 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 dc64ed120b..d6f67faa3a 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 55120ec089..eabc42f94d 100644
--- a/apps/client/src/index.html
+++ b/apps/client/src/index.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
<html class="h-100 position-relative" lang="${languageCode}">
<head>
<title>${title}</title>
diff --git a/libs/ui/.storybook/preview-head.html b/libs/ui/.storybook/preview-head.html
index ef2b9647a2..aa97d53635 100644
--- a/libs/ui/.storybook/preview-head.html
+++ b/libs/ui/.storybook/preview-head.html
@@ -1,6 +1,6 @@
<script
- type="module"
src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"
+ type="module"
></script>
<script
nomodule
diff --git a/libs/ui/src/lib/activities-table/activities-table.component.html b/libs/ui/src/lib/activities-table/activities-table.component.html
index 472a46f102..328f343746 100644
--- a/libs/ui/src/lib/activities-table/activities-table.component.html
+++ b/libs/ui/src/lib/activities-table/activities-table.component.html
@@ -145,7 +145,7 @@
</th>
<td *matCellDef="let element" class="px-1" mat-cell>
<div class="d-flex">
- {{ element.date | date : defaultDateFormat }}
+ {{ element.date | date: defaultDateFormat }}
</div>
</td>
<td *matFooterCellDef class="px-1" i18n mat-footer-cell>Total</td>
diff --git a/libs/ui/src/lib/fire-calculator/fire-calculator.component.html b/libs/ui/src/lib/fire-calculator/fire-calculator.component.html
index 8037c9ad99..17f1f623a7 100644
--- a/libs/ui/src/lib/fire-calculator/fire-calculator.component.html
+++ b/libs/ui/src/lib/fire-calculator/fire-calculator.component.html
@@ -33,7 +33,7 @@
<div>
{{
calculatorForm.controls['retirementDate'].value
- | date : 'MMMM YYYY'
+ | date: 'MMMM YYYY'
}}
</div>
<input
diff --git a/package.json b/package.json
index ff3601d3b4..7cdcf2880d 100644
--- a/package.json
+++ b/package.json
@@ -189,8 +189,8 @@
"jest-preset-angular": "13.1.1",
"nx": "16.7.4",
"nx-cloud": "16.3.0",
- "prettier": "2.8.4",
- "prettier-plugin-organize-attributes": "0.0.5",
+ "prettier": "3.0.2",
+ "prettier-plugin-organize-attributes": "1.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"replace-in-file": "6.3.5",
diff --git a/yarn.lock b/yarn.lock
index 46c0502aa3..bdebfaa70e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -15876,15 +15876,15 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==
- version "0.0.5"
- resolved "https://registry.yarnpkg.com/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-0.0.5.tgz#46e54533936fc42a3cff3d876a738a3f98df0360"
- integrity sha512-dSts16q8wd+oq8Zwk5mwmYXo1aN3B+ZkEJqx/ar5fedNHdOvx7S4XDMH/pNK7rmBW0bPXkp/kJX5gAANsWzh3A==
-
- version "2.8.4"
- resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3"
- integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-1.0.0.tgz#037870ee3111b3c1d6371f677b64888de353cc63"
+ integrity sha512-+NmameaLxbCcylEXsKPmawtzla5EE6ECqvGkpfQz4KM847fXDifB1gFnPQEpoADAq6IXg+cMI8Z0ISJEXa6fhg==
+
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.2.tgz#78fcecd6d870551aa5547437cdae39d4701dca5b"
+ integrity sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==
prettier@^2.8.0:
version "2.8.8"