Feature/switch typescript-eslint no-unused-vars to error (#3887)
* Switch @typescript-eslint/no-unused-vars to error
This commit is contained in:
parent
adf9a71cbd
commit
29d3b762a8
@ -135,7 +135,6 @@
|
||||
"@typescript-eslint/no-unsafe-enum-comparison": "warn",
|
||||
"@typescript-eslint/no-unsafe-member-access": "warn",
|
||||
"@typescript-eslint/no-unsafe-return": "warn",
|
||||
"@typescript-eslint/no-unused-vars": "warn",
|
||||
"@typescript-eslint/no-unsafe-call": "warn",
|
||||
"@typescript-eslint/require-await": "warn",
|
||||
"@typescript-eslint/restrict-template-expressions": "warn",
|
||||
|
@ -74,15 +74,12 @@ export class AccountController {
|
||||
);
|
||||
}
|
||||
|
||||
return this.accountService.deleteAccount(
|
||||
{
|
||||
id_userId: {
|
||||
id,
|
||||
userId: this.request.user.id
|
||||
}
|
||||
},
|
||||
this.request.user.id
|
||||
);
|
||||
return this.accountService.deleteAccount({
|
||||
id_userId: {
|
||||
id,
|
||||
userId: this.request.user.id
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Get()
|
||||
|
@ -108,8 +108,7 @@ export class AccountService {
|
||||
}
|
||||
|
||||
public async deleteAccount(
|
||||
where: Prisma.AccountWhereUniqueInput,
|
||||
aUserId: string
|
||||
where: Prisma.AccountWhereUniqueInput
|
||||
): Promise<Account> {
|
||||
const account = await this.prismaService.account.delete({
|
||||
where
|
||||
@ -170,11 +169,7 @@ export class AccountService {
|
||||
where.isExcluded = false;
|
||||
}
|
||||
|
||||
const {
|
||||
ACCOUNT: filtersByAccount,
|
||||
ASSET_CLASS: filtersByAssetClass,
|
||||
TAG: filtersByTag
|
||||
} = groupBy(filters, ({ type }) => {
|
||||
const { ACCOUNT: filtersByAccount } = groupBy(filters, ({ type }) => {
|
||||
return type;
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import { ArrayNotEmpty, IsArray, isNotEmptyObject } from 'class-validator';
|
||||
import { ArrayNotEmpty, IsArray } from 'class-validator';
|
||||
|
||||
import { UpdateMarketDataDto } from './update-market-data.dto';
|
||||
|
||||
|
@ -29,8 +29,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
||||
token: string,
|
||||
refreshToken: string,
|
||||
profile: Profile,
|
||||
done: Function,
|
||||
done2: Function
|
||||
done: Function
|
||||
) {
|
||||
try {
|
||||
const jwt = await this.authService.validateOAuthLogin({
|
||||
|
@ -3,24 +3,14 @@ import {
|
||||
AssetProfileIdentifier,
|
||||
SymbolMetrics
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { PortfolioSnapshot, TimelinePosition } from '@ghostfolio/common/models';
|
||||
import { PortfolioSnapshot } from '@ghostfolio/common/models';
|
||||
|
||||
export class MWRPortfolioCalculator extends PortfolioCalculator {
|
||||
protected calculateOverallPerformance(
|
||||
positions: TimelinePosition[]
|
||||
): PortfolioSnapshot {
|
||||
protected calculateOverallPerformance(): PortfolioSnapshot {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
protected getSymbolMetrics({
|
||||
dataSource,
|
||||
end,
|
||||
exchangeRates,
|
||||
marketSymbolMap,
|
||||
start,
|
||||
step = 1,
|
||||
symbol
|
||||
}: {
|
||||
protected getSymbolMetrics({}: {
|
||||
end: Date;
|
||||
exchangeRates: { [dateString: string]: number };
|
||||
marketSymbolMap: {
|
||||
|
@ -1,42 +1,3 @@
|
||||
import { PortfolioCalculatorFactory } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator.factory';
|
||||
import { CurrentRateService } from '@ghostfolio/api/app/portfolio/current-rate.service';
|
||||
import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service';
|
||||
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
|
||||
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
|
||||
import { PortfolioSnapshotService } from '@ghostfolio/api/services/queues/portfolio-snapshot/portfolio-snapshot.service';
|
||||
|
||||
describe('PortfolioCalculator', () => {
|
||||
let configurationService: ConfigurationService;
|
||||
let currentRateService: CurrentRateService;
|
||||
let exchangeRateDataService: ExchangeRateDataService;
|
||||
let portfolioCalculatorFactory: PortfolioCalculatorFactory;
|
||||
let portfolioSnapshotService: PortfolioSnapshotService;
|
||||
let redisCacheService: RedisCacheService;
|
||||
|
||||
beforeEach(() => {
|
||||
configurationService = new ConfigurationService();
|
||||
|
||||
currentRateService = new CurrentRateService(null, null, null, null);
|
||||
|
||||
exchangeRateDataService = new ExchangeRateDataService(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
portfolioSnapshotService = new PortfolioSnapshotService(null);
|
||||
|
||||
redisCacheService = new RedisCacheService(null, null);
|
||||
|
||||
portfolioCalculatorFactory = new PortfolioCalculatorFactory(
|
||||
configurationService,
|
||||
currentRateService,
|
||||
exchangeRateDataService,
|
||||
portfolioSnapshotService,
|
||||
redisCacheService
|
||||
);
|
||||
});
|
||||
|
||||
test.skip('Skip empty test', () => 1);
|
||||
});
|
||||
|
@ -12,13 +12,7 @@ import { DateRange } from '@ghostfolio/common/types';
|
||||
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { Big } from 'big.js';
|
||||
import {
|
||||
addDays,
|
||||
addMilliseconds,
|
||||
differenceInDays,
|
||||
format,
|
||||
isBefore
|
||||
} from 'date-fns';
|
||||
import { addMilliseconds, differenceInDays, format, isBefore } from 'date-fns';
|
||||
import { cloneDeep, first, last, sortBy } from 'lodash';
|
||||
|
||||
export class TWRPortfolioCalculator extends PortfolioCalculator {
|
||||
|
@ -79,7 +79,7 @@ jest.mock('@ghostfolio/api/services/property/property.service', () => {
|
||||
return {
|
||||
PropertyService: jest.fn().mockImplementation(() => {
|
||||
return {
|
||||
getByKey: (key: string) => Promise.resolve({})
|
||||
getByKey: () => Promise.resolve({})
|
||||
};
|
||||
})
|
||||
};
|
||||
|
@ -1053,8 +1053,7 @@ export class PortfolioService {
|
||||
dateRange = 'max',
|
||||
filters,
|
||||
impersonationId,
|
||||
userId,
|
||||
withExcludedAccounts = false
|
||||
userId
|
||||
}: {
|
||||
dateRange?: DateRange;
|
||||
filters?: Filter[];
|
||||
@ -1308,7 +1307,7 @@ export class PortfolioService {
|
||||
}
|
||||
};
|
||||
|
||||
for (const [symbol, position] of Object.entries(holdings)) {
|
||||
for (const [, position] of Object.entries(holdings)) {
|
||||
const value = position.valueInBaseCurrency;
|
||||
|
||||
if (position.assetClass !== AssetClass.LIQUIDITY) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { Filter } from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { Milliseconds } from 'cache-manager';
|
||||
|
||||
export const RedisCacheServiceMock = {
|
||||
cache: new Map<string, string>(),
|
||||
get: (key: string): Promise<string> => {
|
||||
@ -20,7 +18,7 @@ export const RedisCacheServiceMock = {
|
||||
|
||||
return `portfolio-snapshot-${userId}${filtersHash > 0 ? `-${filtersHash}` : ''}`;
|
||||
},
|
||||
set: (key: string, value: string, ttl?: Milliseconds): Promise<string> => {
|
||||
set: (key: string, value: string): Promise<string> => {
|
||||
RedisCacheServiceMock.cache.set(key, value);
|
||||
|
||||
return Promise.resolve(value);
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { IsCurrencyCode } from '@ghostfolio/api/validators/is-currency-code';
|
||||
import { PortfolioReportRule } from '@ghostfolio/common/interfaces';
|
||||
import type {
|
||||
ColorScheme,
|
||||
DateRange,
|
||||
|
@ -18,7 +18,7 @@ export class EmergencyFundSetup extends Rule<Settings> {
|
||||
this.emergencyFund = emergencyFund;
|
||||
}
|
||||
|
||||
public evaluate(ruleSettings: Settings) {
|
||||
public evaluate() {
|
||||
if (!this.emergencyFund) {
|
||||
return {
|
||||
evaluation: 'No emergency fund has been set up',
|
||||
|
@ -33,7 +33,7 @@ export class AlphaVantageService implements DataProviderInterface {
|
||||
});
|
||||
}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return !!this.configurationService.get('API_KEY_ALPHA_VANTAGE');
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class CoinGeckoService implements DataProviderInterface {
|
||||
}
|
||||
}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,6 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
|
||||
}
|
||||
|
||||
public async enhance({
|
||||
requestTimeout = this.configurationService.get('REQUEST_TIMEOUT'),
|
||||
response,
|
||||
symbol
|
||||
}: {
|
||||
|
@ -43,7 +43,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
||||
this.apiKey = this.configurationService.get('API_KEY_EOD_HISTORICAL_DATA');
|
||||
}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ export class EodHistoricalDataService implements DataProviderInterface {
|
||||
).json<any>();
|
||||
|
||||
return response.reduce(
|
||||
(result, { close, date }, index, array) => {
|
||||
(result, { close, date }) => {
|
||||
if (isNumber(close)) {
|
||||
result[this.convertFromEodSymbol(symbol)][date] = {
|
||||
marketPrice: close
|
||||
|
@ -33,7 +33,7 @@ export class FinancialModelingPrepService implements DataProviderInterface {
|
||||
);
|
||||
}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ export class GoogleSheetsService implements DataProviderInterface {
|
||||
private readonly symbolProfileService: SymbolProfileService
|
||||
) {}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ export class ManualService implements DataProviderInterface {
|
||||
private readonly symbolProfileService: SymbolProfileService
|
||||
) {}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -86,12 +86,8 @@ export class ManualService implements DataProviderInterface {
|
||||
const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles(
|
||||
[{ symbol, dataSource: this.getName() }]
|
||||
);
|
||||
const {
|
||||
defaultMarketPrice,
|
||||
headers = {},
|
||||
selector,
|
||||
url
|
||||
} = symbolProfile?.scraperConfiguration ?? {};
|
||||
const { defaultMarketPrice, selector, url } =
|
||||
symbolProfile?.scraperConfiguration ?? {};
|
||||
|
||||
if (defaultMarketPrice) {
|
||||
const historical: {
|
||||
|
@ -26,7 +26,7 @@ export class RapidApiService implements DataProviderInterface {
|
||||
private readonly configurationService: ConfigurationService
|
||||
) {}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return !!this.configurationService.get('API_KEY_RAPID_API');
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ export class YahooFinanceService implements DataProviderInterface {
|
||||
private readonly yahooFinanceDataEnhancerService: YahooFinanceDataEnhancerService
|
||||
) {}
|
||||
|
||||
public canHandle(symbol: string) {
|
||||
public canHandle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
export const ExchangeRateDataServiceMock = {
|
||||
getExchangeRatesByCurrency: ({
|
||||
currencies,
|
||||
endDate,
|
||||
startDate,
|
||||
targetCurrency
|
||||
}): Promise<any> => {
|
||||
getExchangeRatesByCurrency: ({ targetCurrency }): Promise<any> => {
|
||||
if (targetCurrency === 'CHF') {
|
||||
return Promise.resolve({
|
||||
CHFCHF: {
|
||||
|
@ -5,8 +5,6 @@ import { IPortfolioSnapshotQueueJob } from './interfaces/portfolio-snapshot-queu
|
||||
|
||||
export const PortfolioSnapshotServiceMock = {
|
||||
addJobToQueue({
|
||||
data,
|
||||
name,
|
||||
opts
|
||||
}: {
|
||||
data: IPortfolioSnapshotQueueJob;
|
||||
|
@ -4,8 +4,7 @@ import {
|
||||
registerDecorator,
|
||||
ValidationOptions,
|
||||
ValidatorConstraint,
|
||||
ValidatorConstraintInterface,
|
||||
ValidationArguments
|
||||
ValidatorConstraintInterface
|
||||
} from 'class-validator';
|
||||
import { isISO4217CurrencyCode } from 'class-validator';
|
||||
|
||||
@ -25,7 +24,7 @@ export function IsCurrencyCode(validationOptions?: ValidationOptions) {
|
||||
export class IsExtendedCurrencyConstraint
|
||||
implements ValidatorConstraintInterface
|
||||
{
|
||||
public defaultMessage(args: ValidationArguments) {
|
||||
public defaultMessage() {
|
||||
return '$value must be a valid ISO4217 currency code';
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ export class CustomDateAdapter extends NativeDateAdapter {
|
||||
/**
|
||||
* Formats a date as a string
|
||||
*/
|
||||
public format(aDate: Date, aParseFormat: string): string {
|
||||
public format(aDate: Date): string {
|
||||
return format(aDate, getDateFormatString(this.locale));
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { EMPTY, catchError, finalize, forkJoin, takeUntil } from 'rxjs';
|
||||
import { EMPTY, catchError, finalize, forkJoin } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class AdminMarketDataService {
|
||||
|
@ -11,7 +11,6 @@ import {
|
||||
User
|
||||
} from '@ghostfolio/common/interfaces';
|
||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||
import { DateRange } from '@ghostfolio/common/types';
|
||||
|
||||
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { DeviceDetectorService } from 'ngx-device-detector';
|
||||
|
@ -33,7 +33,7 @@ export class NotificationService {
|
||||
title: aParams.title
|
||||
});
|
||||
|
||||
return dialog.afterClosed().subscribe((result) => {
|
||||
return dialog.afterClosed().subscribe(() => {
|
||||
if (isFunction(aParams.discardFn)) {
|
||||
aParams.discardFn();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { DataService } from '@ghostfolio/client/services/data.service';
|
||||
import { TabConfiguration, User } from '@ghostfolio/common/interfaces';
|
||||
import { TabConfiguration } from '@ghostfolio/common/interfaces';
|
||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
|
@ -36,7 +36,6 @@ import { MatMenuTrigger } from '@angular/material/menu';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { Account, AssetClass } from '@prisma/client';
|
||||
import { eachYearOfInterval, format } from 'date-fns';
|
||||
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
||||
import { EMPTY, Observable, Subject, lastValueFrom } from 'rxjs';
|
||||
import {
|
||||
|
@ -18,7 +18,6 @@ import {
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
Output,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
|
@ -270,7 +270,7 @@ export class GfPortfolioProportionChartComponent
|
||||
}
|
||||
];
|
||||
|
||||
let labels = chartDataSorted.map(([symbol, { name }]) => {
|
||||
let labels = chartDataSorted.map(([, { name }]) => {
|
||||
return name;
|
||||
});
|
||||
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
Loading…
x
Reference in New Issue
Block a user