Browse Source

Feature/upgrade prettier to version 3 (#2163)

* Upgrade prettier to version 3.0.2

* Prettify code

* Update changelog
pull/2272/head
Thomas Kaul 1 year ago
committed by GitHub
parent
commit
0b59fc639d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .prettierrc
  2. 1
      CHANGELOG.md
  3. 5
      apps/api/src/app/auth/auth.controller.ts
  4. 10
      apps/api/src/app/health/health.controller.ts
  5. 20
      apps/api/src/app/portfolio/portfolio.service.ts
  6. 5
      apps/api/src/app/subscription/subscription.service.ts
  7. 10
      apps/api/src/services/data-gathering/data-gathering.service.ts
  8. 12
      apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
  9. 5
      apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts
  10. 5
      apps/api/src/services/twitter-bot/twitter-bot.service.ts
  11. 2
      apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html
  12. 2
      apps/client/src/index.html
  13. 2
      libs/ui/.storybook/preview-head.html
  14. 2
      libs/ui/src/lib/activities-table/activities-table.component.html
  15. 2
      libs/ui/src/lib/fire-calculator/fire-calculator.component.html
  16. 4
      package.json
  17. 18
      yarn.lock

1
.prettierrc

@ -9,6 +9,7 @@
], ],
"attributeSort": "ASC", "attributeSort": "ASC",
"endOfLine": "auto", "endOfLine": "auto",
"plugins": ["prettier-plugin-organize-attributes"],
"printWidth": 80, "printWidth": 80,
"singleQuote": true, "singleQuote": true,
"tabWidth": 2, "tabWidth": 2,

1
CHANGELOG.md

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Upgraded `Nx` from version `16.7.2` to `16.7.4` - 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 ## 1.303.0 - 2023-08-23

5
apps/api/src/app/auth/auth.controller.ts

@ -41,9 +41,8 @@ export class AuthController {
@Param('accessToken') accessToken: string @Param('accessToken') accessToken: string
): Promise<OAuthResponse> { ): Promise<OAuthResponse> {
try { try {
const authToken = await this.authService.validateAnonymousLogin( const authToken =
accessToken await this.authService.validateAnonymousLogin(accessToken);
);
return { authToken }; return { authToken };
} catch { } catch {
throw new HttpException( throw new HttpException(

10
apps/api/src/app/health/health.controller.ts

@ -20,9 +20,8 @@ export class HealthController {
@Get('data-enhancer/:name') @Get('data-enhancer/:name')
public async getHealthOfDataEnhancer(@Param('name') name: string) { public async getHealthOfDataEnhancer(@Param('name') name: string) {
const hasResponse = await this.healthService.hasResponseFromDataEnhancer( const hasResponse =
name await this.healthService.hasResponseFromDataEnhancer(name);
);
if (hasResponse !== true) { if (hasResponse !== true) {
throw new HttpException( throw new HttpException(
@ -44,9 +43,8 @@ export class HealthController {
); );
} }
const hasResponse = await this.healthService.hasResponseFromDataProvider( const hasResponse =
dataSource await this.healthService.hasResponseFromDataProvider(dataSource);
);
if (hasResponse !== true) { if (hasResponse !== true) {
throw new HttpException( throw new HttpException(

20
apps/api/src/app/portfolio/portfolio.service.ts

@ -470,9 +470,8 @@ export class PortfolioService {
transactionPoints[0]?.date ?? format(new Date(), DATE_FORMAT) transactionPoints[0]?.date ?? format(new Date(), DATE_FORMAT)
); );
const startDate = this.getStartDate(dateRange, portfolioStart); const startDate = this.getStartDate(dateRange, portfolioStart);
const currentPositions = await portfolioCalculator.getCurrentPositions( const currentPositions =
startDate await portfolioCalculator.getCurrentPositions(startDate);
);
const cashDetails = await this.accountService.getCashDetails({ const cashDetails = await this.accountService.getCashDetails({
filters, filters,
@ -810,9 +809,8 @@ export class PortfolioService {
const transactionPoints = portfolioCalculator.getTransactionPoints(); const transactionPoints = portfolioCalculator.getTransactionPoints();
const portfolioStart = parseDate(transactionPoints[0].date); const portfolioStart = parseDate(transactionPoints[0].date);
const currentPositions = await portfolioCalculator.getCurrentPositions( const currentPositions =
portfolioStart await portfolioCalculator.getCurrentPositions(portfolioStart);
);
const position = currentPositions.positions.find( const position = currentPositions.positions.find(
(item) => item.symbol === aSymbol (item) => item.symbol === aSymbol
@ -1046,9 +1044,8 @@ export class PortfolioService {
const portfolioStart = parseDate(transactionPoints[0].date); const portfolioStart = parseDate(transactionPoints[0].date);
const startDate = this.getStartDate(dateRange, portfolioStart); const startDate = this.getStartDate(dateRange, portfolioStart);
const currentPositions = await portfolioCalculator.getCurrentPositions( const currentPositions =
startDate await portfolioCalculator.getCurrentPositions(startDate);
);
const positions = currentPositions.positions.filter( const positions = currentPositions.positions.filter(
(item) => !item.quantity.eq(0) (item) => !item.quantity.eq(0)
@ -1238,9 +1235,8 @@ export class PortfolioService {
portfolioCalculator.setTransactionPoints(transactionPoints); portfolioCalculator.setTransactionPoints(transactionPoints);
const portfolioStart = parseDate(transactionPoints[0].date); const portfolioStart = parseDate(transactionPoints[0].date);
const currentPositions = await portfolioCalculator.getCurrentPositions( const currentPositions =
portfolioStart await portfolioCalculator.getCurrentPositions(portfolioStart);
);
const positions = currentPositions.positions.filter( const positions = currentPositions.positions.filter(
(item) => !item.quantity.eq(0) (item) => !item.quantity.eq(0)

5
apps/api/src/app/subscription/subscription.service.ts

@ -93,9 +93,8 @@ export class SubscriptionService {
public async createSubscriptionViaStripe(aCheckoutSessionId: string) { public async createSubscriptionViaStripe(aCheckoutSessionId: string) {
try { try {
const session = await this.stripe.checkout.sessions.retrieve( const session =
aCheckoutSessionId await this.stripe.checkout.sessions.retrieve(aCheckoutSessionId);
);
await this.createSubscription({ await this.createSubscription({
price: session.amount_total / 100, price: session.amount_total / 100,

10
apps/api/src/services/data-gathering/data-gathering.service.ts

@ -127,12 +127,10 @@ export class DataGatheringService {
uniqueAssets = await this.getUniqueAssets(); uniqueAssets = await this.getUniqueAssets();
} }
const assetProfiles = await this.dataProviderService.getAssetProfiles( const assetProfiles =
uniqueAssets await this.dataProviderService.getAssetProfiles(uniqueAssets);
); const symbolProfiles =
const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( await this.symbolProfileService.getSymbolProfiles(uniqueAssets);
uniqueAssets
);
for (const [symbol, assetProfile] of Object.entries(assetProfiles)) { for (const [symbol, assetProfile] of Object.entries(assetProfiles)) {
const symbolMapping = symbolProfiles.find((symbolProfile) => { const symbolMapping = symbolProfiles.find((symbolProfile) => {

12
apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts

@ -38,9 +38,9 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
.json<any>() .json<any>()
.catch(() => { .catch(() => {
return got( return got(
`${TrackinsightDataEnhancerService.baseUrl}/funds/${ `${TrackinsightDataEnhancerService.baseUrl}/funds/${symbol.split(
symbol.split('.')?.[0] '.'
}.json` )?.[0]}.json`
) )
.json<any>() .json<any>()
.catch(() => { .catch(() => {
@ -60,9 +60,9 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
.json<any>() .json<any>()
.catch(() => { .catch(() => {
return got( return got(
`${TrackinsightDataEnhancerService.baseUrl}/holdings/${ `${TrackinsightDataEnhancerService.baseUrl}/holdings/${symbol.split(
symbol.split('.')?.[0] '.'
}.json` )?.[0]}.json`
) )
.json<any>() .json<any>()
.catch(() => { .catch(() => {

5
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; yahooSymbol = quotes[0].symbol;
} }
const { countries, sectors, url } = await this.getAssetProfile( const { countries, sectors, url } =
yahooSymbol await this.getAssetProfile(yahooSymbol);
);
if (countries) { if (countries) {
response.countries = countries; response.countries = countries;

5
apps/api/src/services/twitter-bot/twitter-bot.service.ts

@ -65,9 +65,8 @@ export class TwitterBotService {
status += benchmarkListing; status += benchmarkListing;
} }
const { data: createdTweet } = await this.twitterClient.v2.tweet( const { data: createdTweet } =
status await this.twitterClient.v2.tweet(status);
);
Logger.log( Logger.log(
`Fear & Greed Index has been tweeted: https://twitter.com/ghostfolio_/status/${createdTweet.id}`, `Fear & Greed Index has been tweeted: https://twitter.com/ghostfolio_/status/${createdTweet.id}`,

2
apps/client/src/app/components/admin-market-data-detail/admin-market-data-detail.component.html

@ -29,7 +29,7 @@
}" }"
[title]=" [title]="
(itemByMonth.key + '-' + (i + 1 < 10 ? '0' + (i + 1) : i + 1) (itemByMonth.key + '-' + (i + 1 < 10 ? '0' + (i + 1) : i + 1)
| date : defaultDateFormat) ?? '' | date: defaultDateFormat) ?? ''
" "
(click)=" (click)="
onOpenMarketDataDetail({ onOpenMarketDataDetail({

2
apps/client/src/index.html

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html class="h-100 position-relative" lang="${languageCode}"> <html class="h-100 position-relative" lang="${languageCode}">
<head> <head>
<title>${title}</title> <title>${title}</title>

2
libs/ui/.storybook/preview-head.html

@ -1,6 +1,6 @@
<script <script
type="module"
src="https://unpkg.com/ionicons@5.5.1/dist/ionicons/ionicons.esm.js" src="https://unpkg.com/ionicons@5.5.1/dist/ionicons/ionicons.esm.js"
type="module"
></script> ></script>
<script <script
nomodule nomodule

2
libs/ui/src/lib/activities-table/activities-table.component.html

@ -145,7 +145,7 @@
</th> </th>
<td *matCellDef="let element" class="px-1" mat-cell> <td *matCellDef="let element" class="px-1" mat-cell>
<div class="d-flex"> <div class="d-flex">
{{ element.date | date : defaultDateFormat }} {{ element.date | date: defaultDateFormat }}
</div> </div>
</td> </td>
<td *matFooterCellDef class="px-1" i18n mat-footer-cell>Total</td> <td *matFooterCellDef class="px-1" i18n mat-footer-cell>Total</td>

2
libs/ui/src/lib/fire-calculator/fire-calculator.component.html

@ -33,7 +33,7 @@
<div> <div>
{{ {{
calculatorForm.controls['retirementDate'].value calculatorForm.controls['retirementDate'].value
| date : 'MMMM YYYY' | date: 'MMMM YYYY'
}} }}
</div> </div>
<input <input

4
package.json

@ -189,8 +189,8 @@
"jest-preset-angular": "13.1.1", "jest-preset-angular": "13.1.1",
"nx": "16.7.4", "nx": "16.7.4",
"nx-cloud": "16.3.0", "nx-cloud": "16.3.0",
"prettier": "2.8.4", "prettier": "3.0.2",
"prettier-plugin-organize-attributes": "0.0.5", "prettier-plugin-organize-attributes": "1.0.0",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"replace-in-file": "6.3.5", "replace-in-file": "6.3.5",

18
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" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==
prettier-plugin-organize-attributes@0.0.5: prettier-plugin-organize-attributes@1.0.0:
version "0.0.5" version "1.0.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-0.0.5.tgz#46e54533936fc42a3cff3d876a738a3f98df0360" resolved "https://registry.yarnpkg.com/prettier-plugin-organize-attributes/-/prettier-plugin-organize-attributes-1.0.0.tgz#037870ee3111b3c1d6371f677b64888de353cc63"
integrity sha512-dSts16q8wd+oq8Zwk5mwmYXo1aN3B+ZkEJqx/ar5fedNHdOvx7S4XDMH/pNK7rmBW0bPXkp/kJX5gAANsWzh3A== integrity sha512-+NmameaLxbCcylEXsKPmawtzla5EE6ECqvGkpfQz4KM847fXDifB1gFnPQEpoADAq6IXg+cMI8Z0ISJEXa6fhg==
prettier@2.8.4: prettier@3.0.2:
version "2.8.4" version "3.0.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.2.tgz#78fcecd6d870551aa5547437cdae39d4701dca5b"
integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw== integrity sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==
prettier@^2.8.0: prettier@^2.8.0:
version "2.8.8" version "2.8.8"

Loading…
Cancel
Save