From 73a2174b5ee7016688d6b2c5ddfbf368386fec1d Mon Sep 17 00:00:00 2001 From: wajeht <58354193+wajeht@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:32:56 -0600 Subject: [PATCH] chore: fix some of eslint types --- .eslintrc.json | 12 +++++++++++- src/commands/add.ts | 7 +++---- src/utils/cloudflare-api-client.ts | 20 ++++++++++++++------ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6e8e7fa..bd3c7e8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,7 +11,17 @@ "sourceType": "module" }, "plugins": ["@typescript-eslint", "prettier"], + "rules": { - "@typescript-eslint/ban-ts-comment": "off" + "@typescript-eslint/ban-ts-comment": "off", + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrorsIgnorePattern": "^_" + } + ] } } diff --git a/src/commands/add.ts b/src/commands/add.ts index 4fb9289..7080994 100644 --- a/src/commands/add.ts +++ b/src/commands/add.ts @@ -12,13 +12,12 @@ type Params = { }; export async function add(params: Params) { - let { cloudflare_email, cloudflare_api_token, zone_name, ip_address, frequency, interactive } = - params; + let { cloudflare_email, cloudflare_api_token, zone_name, ip_address, frequency } = params; let sure = false; while (!sure) { - if (interactive) { + if (params.interactive) { if (!cloudflare_email) { cloudflare_email = await input({ message: 'Enter your cloudflare cloudflare_email address', @@ -121,7 +120,7 @@ export async function add(params: Params) { console.table([res]); console.log('The above credentials has been added successfully!'); }) - .catch((err) => { + .catch((_err) => { console.error('Something went wrong while adding credentials!'); }); diff --git a/src/utils/cloudflare-api-client.ts b/src/utils/cloudflare-api-client.ts index 932d2ed..f1ad23c 100644 --- a/src/utils/cloudflare-api-client.ts +++ b/src/utils/cloudflare-api-client.ts @@ -6,8 +6,12 @@ export interface ZoneInfo { export interface CloudflareApi { getZoneByName(zoneName: string): Promise; - getDnsRecords(zoneId: string): Promise; - updateContent(zoneId: string, recordId: string, content: string): Promise; + getDnsRecords(zoneId: string): Promise>; + updateContent( + zoneId: string, + recordId: string, + content: string, + ): Promise>; } export class CloudflareApiClient implements CloudflareApi { @@ -24,15 +28,19 @@ export class CloudflareApiClient implements CloudflareApi { return response.data; } - async getDnsRecords(zoneId: string): Promise { - const response: AxiosResponse = await this.axiosInstance.get( + async getDnsRecords(zoneId: string): Promise> { + const response: AxiosResponse> = await this.axiosInstance.get( `/zones/${zoneId}/dns_records`, ); return response.data; } - async updateContent(zoneId: string, recordId: string, content: string): Promise { - const response: AxiosResponse = await this.axiosInstance.patch( + async updateContent( + zoneId: string, + recordId: string, + content: string, + ): Promise> { + const response: AxiosResponse> = await this.axiosInstance.patch( `/zones/${zoneId}/dns_records/${recordId}`, { content,