Fix lint errors

This commit is contained in:
Prathamesh Musale 2024-01-25 18:10:21 +05:30
parent dad4c36f8c
commit 792bee2ddb
19 changed files with 21 additions and 20 deletions

View File

@ -15,6 +15,7 @@
"@typescript-eslint"
],
"rules": {
"indent": ["error", 2, { "SwitchCase": 1 }]
"indent": ["error", 2, { "SwitchCase": 1 }],
"@typescript-eslint/no-explicit-any": "off"
}
}

View File

@ -28,7 +28,7 @@ export const handler = async (argv: Arguments) => {
const reveal = fs.readFileSync(path.resolve(filePath));
const result = await registry.revealBid({ auctionId, reveal: reveal.toString('hex') }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -24,7 +24,7 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.setAuthorityBond({ name, bondId }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -31,6 +31,6 @@ export const handler = async (argv: Arguments) => {
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.reserveAuthority({ name, owner }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -30,6 +30,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.associateBond({ recordId: id, bondId }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -22,6 +22,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.cancelBond({ id }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -18,7 +18,7 @@ export const builder = {
};
export const handler = async (argv: Arguments) => {
const { config, verbose } = argv;
const { config } = argv;
const denom = argv.type as string;
const amount = argv.quantity as string;

View File

@ -22,6 +22,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.dissociateBond({ recordId: id }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -28,6 +28,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.dissociateRecords({ bondId }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -33,6 +33,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.reassociateRecords({ oldBondId, newBondId }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -3,7 +3,6 @@ import assert from 'assert';
import { Registry } from '@cerc-io/laconic-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { isNil } from 'lodash';
export const command = 'refill';
@ -37,6 +36,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.refillBond({ id, denom, amount }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -36,6 +36,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.withdrawBond({ id, denom, amount }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -23,6 +23,6 @@ export const handler = async (argv: Arguments) => {
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.deleteName({ crn: name }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -25,6 +25,6 @@ export const handler = async (argv: Arguments) => {
const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.setName({ crn: name, cid: id }, privateKey, fee);
const success = `{"success":${result.code == 0}}`;
const success = `{"success":${result.code === 0}}`;
txOutput(result, success, argv.output, argv.verbose);
};

View File

@ -1,6 +1,5 @@
import { Arguments } from 'yargs';
import assert from 'assert';
import path from 'path';
import yaml from 'js-yaml';
import fs from 'fs';
import { Registry } from '@cerc-io/laconic-sdk';
@ -18,7 +17,7 @@ export const builder = {
};
export const handler = async (argv: Arguments) => {
const { txKey, filename, verbose, config } = argv;
const { txKey, filename, config } = argv;
const { services: { cns: cnsConfig } } = getConfig(config as string);
const { restEndpoint, gqlEndpoint, userKey, bondId, chainId } = getConnectionInfo(argv, cnsConfig);

View File

@ -1,6 +1,7 @@
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
// eslint-disable-next-line no-unused-expressions
yargs(hideBin(process.argv))
.options({
verbose: {

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import assert from 'assert';
import { Arguments } from 'yargs';

View File

@ -1,6 +1,6 @@
export const txOutput = (result:any, msg:string, output:unknown, verbose:unknown) => {
if (output == 'json') {
if (output === 'json') {
console.log(verbose ? JSON.parse(JSON.stringify(result)) : JSON.parse(msg));
} else {
console.log(verbose ? JSON.stringify(result, undefined, 2) : msg);
@ -8,7 +8,7 @@ export const txOutput = (result:any, msg:string, output:unknown, verbose:unknown
};
export const queryOutput = (result: any, output: unknown) => {
if (output == 'json') {
if (output === 'json') {
console.log(JSON.parse(JSON.stringify(result)));
} else {
console.log(JSON.stringify(result, (key, value) => {

View File

@ -117,5 +117,5 @@ export function getBidObj(params: { bidder: string, status?: string }): any {
}
export async function delay (ms: number): Promise<any> {
return new Promise(res => setTimeout(res, ms));
return new Promise((resolve) => setTimeout(resolve, ms));
}