Feature/Enable unused compiler options in tsconfig (#3895)

* Enable noUnusedLocals noUnusedParameters in compiler options of tsconfig

* Update changelog
pull/3925/head
dw-0 1 week ago committed by GitHub
parent 67a147bd96
commit a14c10bad2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Exposed the timeout of the portfolio snapshot computation as an environment variable (`PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT`) - Exposed the timeout of the portfolio snapshot computation as an environment variable (`PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT`)
- Harmonized the processor concurrency environment variables - Harmonized the processor concurrency environment variables
- Improved the portfolio unit tests to work with exported activity files - Improved the portfolio unit tests to work with exported activity files
- Enabled the `noUnusedLocals` compiler option in the `tsconfig`
- Enabled the `noUnusedParameters` compiler option in the `tsconfig`
### Fixed ### Fixed

@ -36,6 +36,6 @@ export class CreateAccountDto {
name: string; name: string;
@IsString() @IsString()
@ValidateIf((object, value) => value !== null) @ValidateIf((_object, value) => value !== null)
platformId: string | null; platformId: string | null;
} }

@ -35,6 +35,6 @@ export class UpdateAccountDto {
name: string; name: string;
@IsString() @IsString()
@ValidateIf((object, value) => value !== null) @ValidateIf((_object, value) => value !== null)
platformId: string | null; platformId: string | null;
} }

@ -14,12 +14,12 @@ import {
Req, Req,
Res, Res,
UseGuards, UseGuards,
VERSION_NEUTRAL, Version,
Version VERSION_NEUTRAL
} from '@nestjs/common'; } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { StatusCodes, getReasonPhrase } from 'http-status-codes'; import { getReasonPhrase, StatusCodes } from 'http-status-codes';
import { AuthService } from './auth.service'; import { AuthService } from './auth.service';
import { import {
@ -130,10 +130,7 @@ export class AuthController {
public async verifyAttestation( public async verifyAttestation(
@Body() body: { deviceName: string; credential: AttestationCredentialJSON } @Body() body: { deviceName: string; credential: AttestationCredentialJSON }
) { ) {
return this.webAuthService.verifyAttestation( return this.webAuthService.verifyAttestation(body.credential);
body.deviceName,
body.credential
);
} }
@Post('webauthn/generate-assertion-options') @Post('webauthn/generate-assertion-options')

@ -11,7 +11,7 @@ import { AuthService } from './auth.service';
export class GoogleStrategy extends PassportStrategy(Strategy, 'google') { export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
public constructor( public constructor(
private readonly authService: AuthService, private readonly authService: AuthService,
private readonly configurationService: ConfigurationService configurationService: ConfigurationService
) { ) {
super({ super({
callbackURL: `${configurationService.get( callbackURL: `${configurationService.get(
@ -25,9 +25,9 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
} }
public async validate( public async validate(
request: any, _request: any,
token: string, _token: string,
refreshToken: string, _refreshToken: string,
profile: Profile, profile: Profile,
done: Function done: Function
) { ) {

@ -13,16 +13,16 @@ import {
import { REQUEST } from '@nestjs/core'; import { REQUEST } from '@nestjs/core';
import { JwtService } from '@nestjs/jwt'; import { JwtService } from '@nestjs/jwt';
import { import {
generateAuthenticationOptions,
GenerateAuthenticationOptionsOpts, GenerateAuthenticationOptionsOpts,
generateRegistrationOptions,
GenerateRegistrationOptionsOpts, GenerateRegistrationOptionsOpts,
VerifiedAuthenticationResponse, VerifiedAuthenticationResponse,
VerifiedRegistrationResponse, VerifiedRegistrationResponse,
VerifyAuthenticationResponseOpts,
VerifyRegistrationResponseOpts,
generateAuthenticationOptions,
generateRegistrationOptions,
verifyAuthenticationResponse, verifyAuthenticationResponse,
verifyRegistrationResponse VerifyAuthenticationResponseOpts,
verifyRegistrationResponse,
VerifyRegistrationResponseOpts
} from '@simplewebauthn/server'; } from '@simplewebauthn/server';
import { import {
@ -80,7 +80,6 @@ export class WebAuthService {
} }
public async verifyAttestation( public async verifyAttestation(
deviceName: string,
credential: AttestationCredentialJSON credential: AttestationCredentialJSON
): Promise<AuthDeviceDto> { ): Promise<AuthDeviceDto> {
const user = this.request.user; const user = this.request.user;

@ -21,7 +21,7 @@ export class TransformDataSourceInResponseInterceptor<T>
) {} ) {}
public intercept( public intercept(
context: ExecutionContext, _context: ExecutionContext,
next: CallHandler<T> next: CallHandler<T>
): Observable<any> { ): Observable<any> {
return next.handle().pipe( return next.handle().pipe(

@ -1,4 +1,3 @@
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service'; import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
import { YahooFinanceDataEnhancerService } from './yahoo-finance.service'; import { YahooFinanceDataEnhancerService } from './yahoo-finance.service';
@ -26,16 +25,13 @@ jest.mock(
); );
describe('YahooFinanceDataEnhancerService', () => { describe('YahooFinanceDataEnhancerService', () => {
let configurationService: ConfigurationService;
let cryptocurrencyService: CryptocurrencyService; let cryptocurrencyService: CryptocurrencyService;
let yahooFinanceDataEnhancerService: YahooFinanceDataEnhancerService; let yahooFinanceDataEnhancerService: YahooFinanceDataEnhancerService;
beforeAll(async () => { beforeAll(async () => {
configurationService = new ConfigurationService();
cryptocurrencyService = new CryptocurrencyService(); cryptocurrencyService = new CryptocurrencyService();
yahooFinanceDataEnhancerService = new YahooFinanceDataEnhancerService( yahooFinanceDataEnhancerService = new YahooFinanceDataEnhancerService(
configurationService,
cryptocurrencyService cryptocurrencyService
); );
}); });

@ -1,4 +1,3 @@
import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service';
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service'; import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
import { DataEnhancerInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-enhancer.interface'; import { DataEnhancerInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-enhancer.interface';
import { import {
@ -24,7 +23,6 @@ import type { Price } from 'yahoo-finance2/dist/esm/src/modules/quoteSummary-ifa
@Injectable() @Injectable()
export class YahooFinanceDataEnhancerService implements DataEnhancerInterface { export class YahooFinanceDataEnhancerService implements DataEnhancerInterface {
public constructor( public constructor(
private readonly configurationService: ConfigurationService,
private readonly cryptocurrencyService: CryptocurrencyService private readonly cryptocurrencyService: CryptocurrencyService
) {} ) {}

@ -76,7 +76,7 @@ export class GoogleSheetsService implements DataProviderInterface {
} = {}; } = {};
rows rows
.filter((row, index) => { .filter((_row, index) => {
return index >= 1; return index >= 1;
}) })
.forEach((row) => { .forEach((row) => {

@ -29,12 +29,13 @@ import { SymbolProfile } from '@prisma/client';
import { import {
Chart, Chart,
ChartData, ChartData,
LinearScale,
LineController, LineController,
LineElement, LineElement,
LinearScale,
PointElement, PointElement,
TimeScale, TimeScale,
Tooltip Tooltip,
TooltipPosition
} from 'chart.js'; } from 'chart.js';
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import annotationPlugin from 'chartjs-plugin-annotation'; import annotationPlugin from 'chartjs-plugin-annotation';
@ -74,7 +75,7 @@ export class BenchmarkComparatorComponent implements OnChanges, OnDestroy {
Tooltip Tooltip
); );
Tooltip.positioners['top'] = (elements, position) => Tooltip.positioners['top'] = (_elements, position: TooltipPosition) =>
getTooltipPositionerMapTop(this.chart, position); getTooltipPositionerMapTop(this.chart, position);
} }

@ -29,12 +29,13 @@ import {
BarElement, BarElement,
Chart, Chart,
ChartData, ChartData,
LinearScale,
LineController, LineController,
LineElement, LineElement,
LinearScale,
PointElement, PointElement,
TimeScale, TimeScale,
Tooltip Tooltip,
TooltipPosition
} from 'chart.js'; } from 'chart.js';
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import annotationPlugin from 'chartjs-plugin-annotation'; import annotationPlugin from 'chartjs-plugin-annotation';
@ -79,7 +80,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
Tooltip Tooltip
); );
Tooltip.positioners['top'] = (elements, position) => Tooltip.positioners['top'] = (_elements, position: TooltipPosition) =>
getTooltipPositionerMapTop(this.chart, position); getTooltipPositionerMapTop(this.chart, position);
} }

@ -103,7 +103,7 @@ export function getVerticalHoverLinePlugin(
colorScheme?: ColorScheme colorScheme?: ColorScheme
) { ) {
return { return {
afterDatasetsDraw: (chart, x, options) => { afterDatasetsDraw: (chart, _, options) => {
const active = chart.getActiveElements(); const active = chart.getActiveElements();
if (!active || active.length === 0) { if (!active || active.length === 0) {

@ -27,12 +27,13 @@ import {
import { import {
Chart, Chart,
Filler, Filler,
LinearScale,
LineController, LineController,
LineElement, LineElement,
LinearScale,
PointElement, PointElement,
TimeScale, TimeScale,
Tooltip Tooltip,
TooltipPosition
} from 'chart.js'; } from 'chart.js';
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
@ -85,7 +86,7 @@ export class GfLineChartComponent
Tooltip Tooltip
); );
Tooltip.positioners['top'] = (elements, position) => Tooltip.positioners['top'] = (_elements, position: TooltipPosition) =>
getTooltipPositionerMapTop(this.chart, position); getTooltipPositionerMapTop(this.chart, position);
} }

@ -31,8 +31,8 @@
"noImplicitThis": false, "noImplicitThis": false,
"noImplicitOverride": false, "noImplicitOverride": false,
"noPropertyAccessFromIndexSignature": false, "noPropertyAccessFromIndexSignature": false,
"noUnusedLocals": false, "noUnusedLocals": true,
"noUnusedParameters": false, "noUnusedParameters": true,
"allowUnreachableCode": true "allowUnreachableCode": true
}, },
"exclude": ["node_modules", "tmp"] "exclude": ["node_modules", "tmp"]

Loading…
Cancel
Save