From 9eba292a881734e38aada64886dd9d1b87d64fb1 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:15:07 +0100 Subject: [PATCH 1/7] chore: improve ci + codebase --- .../workflows/{prettier.yaml => code.yaml} | 20 ++++++++++++++++--- eslint.config.mjs | 2 ++ .../src/consumer/consumer-message.ts | 2 +- .../src/dependency-injection/decorator.ts | 14 ++++++------- 4 files changed, 27 insertions(+), 11 deletions(-) rename .github/workflows/{prettier.yaml => code.yaml} (73%) diff --git a/.github/workflows/prettier.yaml b/.github/workflows/code.yaml similarity index 73% rename from .github/workflows/prettier.yaml rename to .github/workflows/code.yaml index ac5c6db..501a933 100644 --- a/.github/workflows/prettier.yaml +++ b/.github/workflows/code.yaml @@ -1,4 +1,4 @@ -name: Check formatting +name: Check code on: pull_request: @@ -14,8 +14,8 @@ concurrency: cancel-in-progress: true jobs: - prettier: - name: check formatting + initialize: + name: initialize runs-on: ubuntu-latest steps: @@ -33,5 +33,19 @@ jobs: - name: Install dependencies run: yarn install --immutable + prettier: + name: check formatting + runs-on: ubuntu-latest + + steps: - name: Check formatting run: yarn format:check + + lint: + name: check lint + runs-on: ubuntu-latest + + steps: + + - name: Check formatting + run: yarn lint:check diff --git a/eslint.config.mjs b/eslint.config.mjs index ed69ade..1cf13b6 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -28,6 +28,8 @@ export default tseslint.config( sourceType: 'module', }, rules: { + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', diff --git a/packages/messaging/src/consumer/consumer-message.ts b/packages/messaging/src/consumer/consumer-message.ts index 2323ba6..23f02b3 100644 --- a/packages/messaging/src/consumer/consumer-message.ts +++ b/packages/messaging/src/consumer/consumer-message.ts @@ -2,7 +2,7 @@ export class ConsumerMessage { constructor( public readonly message: object | string, public readonly routingKey: string, - public readonly metadata: {} = {}, + public readonly metadata: Record = {}, ) { this.message = message; this.routingKey = routingKey; diff --git a/packages/messaging/src/dependency-injection/decorator.ts b/packages/messaging/src/dependency-injection/decorator.ts index c16c75d..56bf903 100644 --- a/packages/messaging/src/dependency-injection/decorator.ts +++ b/packages/messaging/src/dependency-injection/decorator.ts @@ -11,7 +11,7 @@ export const MESSAGING_EXCEPTION_LISTENER_METADATA = export const MESSAGING_MESSAGE_METADATA = 'MESSAGING_MESSAGE_METADATA'; export const MessageHandler = (...routingKey: string[]): ClassDecorator => { - return (target: Function) => { + return (target) => { Reflect.defineMetadata(MESSAGE_HANDLER_METADATA, routingKey, target); }; }; @@ -19,7 +19,7 @@ export const MessageHandler = (...routingKey: string[]): ClassDecorator => { export const ChannelFactory = ( channelConfig: ChannelConfig, ): ClassDecorator => { - return (target: Function) => { + return (target) => { Reflect.defineMetadata(CHANNEL_FACTORY_METADATA, channelConfig, target); }; }; @@ -27,7 +27,7 @@ export const ChannelFactory = ( export const MessageBusFactory = (channel: any): ClassDecorator => { classValidator(channel, 'Channel'); - return (target: Function) => { + return (target) => { Reflect.defineMetadata(MESSAGE_BUS_FACTORY_METADATA, channel, target); }; }; @@ -35,13 +35,13 @@ export const MessageBusFactory = (channel: any): ClassDecorator => { export const MessageConsumer = (channel: any): ClassDecorator => { classValidator(channel, 'Channel'); - return (target: Function) => { + return (target) => { Reflect.defineMetadata(MESSAGE_CONSUMER_METADATA, channel, target); }; }; export const MessagingMiddleware = (name?: string): ClassDecorator => { - return (target: Function) => { + return (target) => { Reflect.defineMetadata( MESSAGING_MIDDLEWARE_METADATA, name ?? target.name, @@ -51,7 +51,7 @@ export const MessagingMiddleware = (name?: string): ClassDecorator => { }; export const MessagingNormalizer = (name?: string): ClassDecorator => { - return (target: Function) => { + return (target) => { Reflect.defineMetadata( MESSAGING_NORMALIZER_METADATA, name ?? target.name, @@ -61,7 +61,7 @@ export const MessagingNormalizer = (name?: string): ClassDecorator => { }; export const MessagingExceptionListener = (): ClassDecorator => { - return (target: Function) => { + return (target) => { Reflect.defineMetadata( MESSAGING_EXCEPTION_LISTENER_METADATA, target.name, From 50e97fa6a4d6f05aadae0dfb032c9fa2291ab88b Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:17:10 +0100 Subject: [PATCH 2/7] chore: improve ci + codebase --- .github/pull_request_template.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index dedca82..24695a2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,6 +6,8 @@ Describe what this PR changes and why. - [ ] Feature - [ ] Refactor - [ ] Documentation +- [ ] Code improvement / refactoring +- [ ] Other (please describe) ## Breaking change - [ ] Yes @@ -15,4 +17,3 @@ Describe what this PR changes and why. - [ ] Unit tests added/updated - [ ] E2E tests added/updated (if applicable) - [ ] Documentation updated if needed -- [ ] Build and tests pass locally From 853ebb0d4b53d10706bb4ef5d128dc4a43b9ce48 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:19:10 +0100 Subject: [PATCH 3/7] chore: improve ci + codebase --- .github/workflows/code.yaml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/code.yaml b/.github/workflows/code.yaml index 501a933..da2c143 100644 --- a/.github/workflows/code.yaml +++ b/.github/workflows/code.yaml @@ -14,8 +14,8 @@ concurrency: cancel-in-progress: true jobs: - initialize: - name: initialize + check: + name: check prettier and eslint runs-on: ubuntu-latest steps: @@ -33,19 +33,8 @@ jobs: - name: Install dependencies run: yarn install --immutable - prettier: - name: check formatting - runs-on: ubuntu-latest - - steps: - name: Check formatting run: yarn format:check - lint: - name: check lint - runs-on: ubuntu-latest - - steps: - - name: Check formatting run: yarn lint:check From f759dcbe593ed859bbe47882b16b1536597f1926 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:23:31 +0100 Subject: [PATCH 4/7] chore: improve ci + codebase --- .github/workflows/code.yaml | 4 ++-- packages/messaging/src/consumer/consumer-message.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code.yaml b/.github/workflows/code.yaml index da2c143..12d4cff 100644 --- a/.github/workflows/code.yaml +++ b/.github/workflows/code.yaml @@ -36,5 +36,5 @@ jobs: - name: Check formatting run: yarn format:check - - name: Check formatting - run: yarn lint:check + - name: Check linting + run: yarn lint diff --git a/packages/messaging/src/consumer/consumer-message.ts b/packages/messaging/src/consumer/consumer-message.ts index 23f02b3..15d244e 100644 --- a/packages/messaging/src/consumer/consumer-message.ts +++ b/packages/messaging/src/consumer/consumer-message.ts @@ -2,7 +2,7 @@ export class ConsumerMessage { constructor( public readonly message: object | string, public readonly routingKey: string, - public readonly metadata: Record = {}, + public readonly metadata: Record = {}, ) { this.message = message; this.routingKey = routingKey; From 18f15185bbbbd2678ce91a1a738070cb3e2f8ff0 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:27:28 +0100 Subject: [PATCH 5/7] chore: improve ci + codebase --- .../src/consumer/rabbitmq-messaging.consumer.ts | 11 ++++++----- packages/messaging/src/consumer/consumer-message.ts | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts b/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts index 2d6b57d..60eebea 100644 --- a/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts +++ b/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts @@ -17,8 +17,7 @@ import { MessageDeadLetterVisitor } from './message-dead-letter.visitor'; @Injectable() @MessageConsumer(AmqpChannel) export class RabbitmqMessagingConsumer - implements IMessagingConsumer, OnModuleDestroy -{ + implements IMessagingConsumer, OnModuleDestroy { private channel?: AmqpChannel = undefined; private amqpChannel: ChannelWrapper; @@ -26,7 +25,8 @@ export class RabbitmqMessagingConsumer private readonly rabbitMqMigrator: RabbitmqMigrator, private readonly messageRetrier: MessageRetrierVisitor, private readonly messageDeadLetter: MessageDeadLetterVisitor, - ) {} + ) { + } async consume( dispatcher: ConsumerMessageBus, @@ -95,10 +95,11 @@ export class RabbitmqMessagingConsumer if (channel.config.retryMessage) { const limit = channel.config.retryMessage; - const currentRetryCount = + const retryCountValue = errored.dispatchedConsumerMessage.metadata[ RABBITMQ_HEADER_RETRY_COUNT - ] ?? 0; + ]; + const currentRetryCount = Number(retryCountValue ?? 0); if (currentRetryCount < limit) { return this.messageRetrier.retryMessage( diff --git a/packages/messaging/src/consumer/consumer-message.ts b/packages/messaging/src/consumer/consumer-message.ts index 15d244e..2c3d883 100644 --- a/packages/messaging/src/consumer/consumer-message.ts +++ b/packages/messaging/src/consumer/consumer-message.ts @@ -2,7 +2,7 @@ export class ConsumerMessage { constructor( public readonly message: object | string, public readonly routingKey: string, - public readonly metadata: Record = {}, + public readonly metadata: Record = {}, ) { this.message = message; this.routingKey = routingKey; From e50dbd203c41fbd2468f85accdf52fb722188686 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:28:59 +0100 Subject: [PATCH 6/7] chore: improve ci + codebase --- .../src/consumer/rabbitmq-messaging.consumer.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts b/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts index 60eebea..bde7905 100644 --- a/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts +++ b/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts @@ -17,7 +17,8 @@ import { MessageDeadLetterVisitor } from './message-dead-letter.visitor'; @Injectable() @MessageConsumer(AmqpChannel) export class RabbitmqMessagingConsumer - implements IMessagingConsumer, OnModuleDestroy { + implements IMessagingConsumer, OnModuleDestroy +{ private channel?: AmqpChannel = undefined; private amqpChannel: ChannelWrapper; @@ -25,8 +26,7 @@ export class RabbitmqMessagingConsumer private readonly rabbitMqMigrator: RabbitmqMigrator, private readonly messageRetrier: MessageRetrierVisitor, private readonly messageDeadLetter: MessageDeadLetterVisitor, - ) { - } + ) {} async consume( dispatcher: ConsumerMessageBus, @@ -96,9 +96,7 @@ export class RabbitmqMessagingConsumer if (channel.config.retryMessage) { const limit = channel.config.retryMessage; const retryCountValue = - errored.dispatchedConsumerMessage.metadata[ - RABBITMQ_HEADER_RETRY_COUNT - ]; + errored.dispatchedConsumerMessage.metadata[RABBITMQ_HEADER_RETRY_COUNT]; const currentRetryCount = Number(retryCountValue ?? 0); if (currentRetryCount < limit) { From 5fc99cd88e5bb10ef15943f6c68c9d82b32a976f Mon Sep 17 00:00:00 2001 From: sebastian Date: Sun, 15 Mar 2026 01:31:07 +0100 Subject: [PATCH 7/7] chore: improve ci + codebase --- .../src/consumer/rabbitmq-messaging.consumer.ts | 7 ++++--- packages/messaging/src/consumer/consumer-message.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts b/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts index bde7905..2d6b57d 100644 --- a/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts +++ b/packages/messaging-rabbitmq-extension/src/consumer/rabbitmq-messaging.consumer.ts @@ -95,9 +95,10 @@ export class RabbitmqMessagingConsumer if (channel.config.retryMessage) { const limit = channel.config.retryMessage; - const retryCountValue = - errored.dispatchedConsumerMessage.metadata[RABBITMQ_HEADER_RETRY_COUNT]; - const currentRetryCount = Number(retryCountValue ?? 0); + const currentRetryCount = + errored.dispatchedConsumerMessage.metadata[ + RABBITMQ_HEADER_RETRY_COUNT + ] ?? 0; if (currentRetryCount < limit) { return this.messageRetrier.retryMessage( diff --git a/packages/messaging/src/consumer/consumer-message.ts b/packages/messaging/src/consumer/consumer-message.ts index 2c3d883..a22d998 100644 --- a/packages/messaging/src/consumer/consumer-message.ts +++ b/packages/messaging/src/consumer/consumer-message.ts @@ -2,7 +2,7 @@ export class ConsumerMessage { constructor( public readonly message: object | string, public readonly routingKey: string, - public readonly metadata: Record = {}, + public readonly metadata: Record = {}, ) { this.message = message; this.routingKey = routingKey;