From 06795a5553a5247f525e8a7257b8209e7400ea6e Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Thu, 22 Feb 2024 15:45:12 +0200 Subject: [PATCH] Fix linting --- packages/sqs/.eslintrc.json | 2 +- packages/sqs/lib/utils/sqsUtils.ts | 7 ++++++- packages/sqs/vitest.config.mts | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/sqs/.eslintrc.json b/packages/sqs/.eslintrc.json index e8db5dea..9823ddac 100644 --- a/packages/sqs/.eslintrc.json +++ b/packages/sqs/.eslintrc.json @@ -23,7 +23,7 @@ "@typescript-eslint/no-empty-interface": "warn", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/no-use-before-define": "off", - "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/indent": "off", "@typescript-eslint/no-explicit-any": "warn", diff --git a/packages/sqs/lib/utils/sqsUtils.ts b/packages/sqs/lib/utils/sqsUtils.ts index 832bd867..2b86a67d 100644 --- a/packages/sqs/lib/utils/sqsUtils.ts +++ b/packages/sqs/lib/utils/sqsUtils.ts @@ -89,6 +89,7 @@ export async function assertQueue( ) { // we will try to update existing queue if exists if (extraParams?.updateAttributesIfExists) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const queueExistsResult = await getQueueUrl(sqsClient, queueConfig.QueueName!) if (queueExistsResult.result) { @@ -97,7 +98,11 @@ export async function assertQueue( queueUrl, }) - const queueArn = existingAttributes.result?.attributes!.QueueArn + if (!existingAttributes.result?.attributes) { + throw new Error('Attributes are not set') + } + + const queueArn = existingAttributes.result?.attributes.QueueArn if (!queueArn) { throw new Error('Queue ARN was not set') } diff --git a/packages/sqs/vitest.config.mts b/packages/sqs/vitest.config.mts index 0339a386..d0302c2b 100644 --- a/packages/sqs/vitest.config.mts +++ b/packages/sqs/vitest.config.mts @@ -5,8 +5,8 @@ export default defineConfig({ globals: true, poolOptions: { threads: { - singleThread: true - } + singleThread: true, + }, }, watch: false, environment: 'node', @@ -21,7 +21,7 @@ export default defineConfig({ functions: 100, branches: 74, statements: 90, - } + }, }, }, })