Skip to content

Commit

Permalink
linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alweber-cap committed Nov 14, 2023
1 parent d92fad4 commit 467706b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/console/console.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { DbConfig, loadConfigFiles, loadEnvConfig, ServerConfig } from '../share
import { mappingErrorHandler } from '../shared/error/index.js';
import { DbConsole } from './db.console.js';
import { DbInitConsole } from './db-init.console.js';
import { LoggerModule } from '../core/logging/logger.module';
import { LoggerModule } from '../core/logging/logger.module.js';

@Module({
imports: [
Expand Down
7 changes: 5 additions & 2 deletions src/core/logging/class-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import { INQUIRER } from '@nestjs/core';
export class ClassLogger extends Logger {
private logger: LoggerWinston;

private context: string | undefined;
private readonly context: string | undefined;

public constructor(moduleLogger: ModuleLogger, @Inject(INQUIRER) private parentClass: object) {
public constructor(
moduleLogger: ModuleLogger,
@Inject(INQUIRER) private parentClass: object,
) {
super();
this.logger = moduleLogger.getLogger();
this.context = `${moduleLogger.moduleName}.${this.parentClass?.constructor?.name}`;
Expand Down
2 changes: 1 addition & 1 deletion src/core/logging/module-logger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Module Logger', () => {
it('should produce a sensible log message', () => {
tfi.level = 'error';
tfi.message = 'Something bad happened';
const formattedMessage = localFormatter(tfi);
const formattedMessage: string = localFormatter(tfi);

expect(formattedMessage).toContain('Something bad happened');
expect(formattedMessage).toContain('error');
Expand Down
12 changes: 6 additions & 6 deletions src/core/logging/nest-logger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ describe('The nest Logger', () => {
it('should produce correct log messages', () => {
const nestLogger = module.get(NestLogger);

Check warning on line 18 in src/core/logging/nest-logger.spec.ts

View workflow job for this annotation

GitHub Actions / Linting / Nest Lint

Expected nestLogger to have a type annotation

nestLogger.log('Blah');
nestLogger.debug?.('Blah');
nestLogger.error('Blah');
nestLogger.warn('Blah');
nestLogger.verbose?.('Blah');
nestLogger.log('Test');
nestLogger.debug?.('Test');
nestLogger.error('Test');
nestLogger.warn('Test');
nestLogger.verbose?.('Test');

expect(moduleLogger.getLogger).toHaveBeenCalledTimes(5);
expect(moduleLogger.getLogger().log.mock.calls

Check warning on line 27 in src/core/logging/nest-logger.spec.ts

View workflow job for this annotation

GitHub Actions / Linting / Nest Lint

Replace `⏎············.every(v·=>·v[1]·as·string·==·'Test'))` with `.every((v)·=>·(v[1]·as·string)·==·'Test'));`
.every(v => v[1] as string == 'Blah'))
.every(v => v[1] as string == 'Test'))

Check warning on line 28 in src/core/logging/nest-logger.spec.ts

View workflow job for this annotation

GitHub Actions / Linting / Nest Lint

Expected v to have a type annotation
});

afterAll(async () => {
Expand Down
5 changes: 4 additions & 1 deletion src/modules/health/health.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ import { HealthController } from './health.controller.js';
import { HttpModule } from '@nestjs/axios';
import { LoggerModule } from '../../core/logging/logger.module.js';

@Module({ imports: [TerminusModule, HttpModule, LoggerModule.register(HealthModule.name)], controllers: [HealthController] })
@Module({
imports: [TerminusModule, HttpModule, LoggerModule.register(HealthModule.name)],
controllers: [HealthController],
})
export class HealthModule {}
1 change: 0 additions & 1 deletion src/shared/config/json.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { KeycloakConfig } from './keycloak.config.js';
import { LoggingConfig } from './logging.config.js';
import { RedisConfig } from './redis.config.js';


export class JsonConfig {
@ValidateNested()
@Type(() => HostConfig)
Expand Down
50 changes: 24 additions & 26 deletions src/shared/config/logging.config.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
import { IsNotEmpty, IsString } from 'class-validator';

export class LoggingConfig {
@IsString()
@IsNotEmpty()
public readonly DEFAULT_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly DEFAULT_LOG_LEVEL!: string;
//Domain Modules

//Domain Modules
@IsString()
@IsNotEmpty()
public readonly PERSONMODULE_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly PERSONMODULE_LOG_LEVEL!: string;
@IsString()
@IsNotEmpty()
public readonly ORGANISATIONMODULE_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly ORGANISATIONMODULE_LOG_LEVEL!: string;
@IsString()
@IsNotEmpty()
public readonly ROLLEMODULE_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly ROLLEMODULE_LOG_LEVEL!: string;
//Technical Modules

//Technical Modules
@IsString()
@IsNotEmpty()
public readonly KEYCLOAKMODULE_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly KEYCLOAKMODULE_LOG_LEVEL!: string;
//SPSH Modules

//SPSH Modules

@IsString()
@IsNotEmpty()
public readonly BACKENDFORFRONTENDMODULE_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly UIBACKENDMODULE_LOG_LEVEL!: string;
@IsString()
@IsNotEmpty()
public readonly BACKENDFORFRONTENDMODULE_LOG_LEVEL!: string;

@IsString()
@IsNotEmpty()
public readonly UIBACKENDMODULE_LOG_LEVEL!: string;
}

0 comments on commit 467706b

Please sign in to comment.