Skip to content

Commit

Permalink
chore: fix some of eslint types
Browse files Browse the repository at this point in the history
  • Loading branch information
wajeht committed Nov 9, 2023
1 parent c25ffdb commit 73a2174
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
12 changes: 11 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^_"
}
]
}
}
7 changes: 3 additions & 4 deletions src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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!');
});

Expand Down
20 changes: 14 additions & 6 deletions src/utils/cloudflare-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ export interface ZoneInfo {

export interface CloudflareApi {
getZoneByName(zoneName: string): Promise<ZoneInfo>;
getDnsRecords(zoneId: string): Promise<any>;
updateContent(zoneId: string, recordId: string, content: string): Promise<any>;
getDnsRecords(zoneId: string): Promise<Record<string, unknown>>;
updateContent(
zoneId: string,
recordId: string,
content: string,
): Promise<Record<string, unknown>>;
}

export class CloudflareApiClient implements CloudflareApi {
Expand All @@ -24,15 +28,19 @@ export class CloudflareApiClient implements CloudflareApi {
return response.data;
}

async getDnsRecords(zoneId: string): Promise<any> {
const response: AxiosResponse<any> = await this.axiosInstance.get(
async getDnsRecords(zoneId: string): Promise<Record<string, unknown>> {
const response: AxiosResponse<Record<string, unknown>> = await this.axiosInstance.get(
`/zones/${zoneId}/dns_records`,
);
return response.data;
}

async updateContent(zoneId: string, recordId: string, content: string): Promise<any> {
const response: AxiosResponse<any> = await this.axiosInstance.patch(
async updateContent(
zoneId: string,
recordId: string,
content: string,
): Promise<Record<string, unknown>> {
const response: AxiosResponse<Record<string, unknown>> = await this.axiosInstance.patch(
`/zones/${zoneId}/dns_records/${recordId}`,
{
content,
Expand Down

0 comments on commit 73a2174

Please sign in to comment.