Skip to content

Commit

Permalink
chore(eslint): fix eslint v3 breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamaljsr committed Jun 5, 2020
1 parent da0ad11 commit 630952f
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 24 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react/prop-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": 0
}
}
2 changes: 1 addition & 1 deletion electron/httpProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const httpProxy = async (args: {
url: string;
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
headers?: Record<string, string>;
body?: object;
body?: any;
}): Promise<any> => {
const { url, method, body, headers } = args;

Expand Down
4 changes: 2 additions & 2 deletions electron/lnd/lndProxyServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ const listPeers = async (args: { node: LndNode }): Promise<LND.ListPeersResponse
const connectPeer = async (args: {
node: LndNode;
req: LND.ConnectPeerRequest;
}): Promise<{}> => {
}): Promise<void> => {
const rpc = await getRpc(args.node);
return await rpc.connectPeer(args.req);
await rpc.connectPeer(args.req);
};

const openChannel = async (args: {
Expand Down
1 change: 0 additions & 1 deletion src/components/designer/bitcoind/BitcoindDetails.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('BitcoindDetails', () => {

beforeEach(() => {
chainMock.mockResolvedValue({ blocks: 123, bestblockhash: 'abcdef' });
// eslint-disable-next-line @typescript-eslint/camelcase
walletMock.mockResolvedValue({ balance: 10, immature_balance: 20 });
});

Expand Down
2 changes: 0 additions & 2 deletions src/components/network/NetworkView.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('NetworkView Component', () => {
},
walletInfo: {
balance: 10,
// eslint-disable-next-line @typescript-eslint/camelcase
immature_balance: 20,
},
},
Expand Down Expand Up @@ -203,7 +202,6 @@ describe('NetworkView Component', () => {
} as any);
bitcoindServiceMock.getWalletInfo.mockResolvedValue({
balance: 10,
// eslint-disable-next-line @typescript-eslint/camelcase
immature_balance: 20,
} as any);
});
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/usePrefixedTranslation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { TOptions } from 'i18next';

/**
* A hook which returns a `t` function that inserts a prefix in each key lookup
Expand All @@ -9,7 +10,7 @@ const usePrefixedTranslation = (prefix: string) => {
const { t } = useTranslation();
// the new `t` function that will append the prefix
const translate = useCallback(
(key: string, options?: string | object) => {
(key: string, options?: string | TOptions<any> | undefined) => {
// if the key contains a '.', then don't add the prefix
return key.includes('.') ? t(key, options) : t(`${prefix}.${key}`, options);
},
Expand Down
1 change: 0 additions & 1 deletion src/lib/docker/nodeTemplates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { dockerConfigs } from 'utils/constants';
/* eslint-disable no-template-curly-in-string */
import { ComposeService } from './composeFile';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/lightning/clightning/clightningApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const request = async <T>(
node: LightningNode,
method: 'GET' | 'POST' | 'PUT' | 'DELETE',
path: string,
bodyObj?: object,
bodyObj?: any,
): Promise<T> => {
if (node.implementation !== 'c-lightning')
throw new Error(
Expand Down Expand Up @@ -48,7 +48,7 @@ export const httpGet = async <T>(node: LightningNode, path: string): Promise<T>
export const httpPost = async <T>(
node: LightningNode,
path: string,
body: object,
body: any,
): Promise<T> => {
return request<T>(node, 'POST', path, body);
};
Expand Down
4 changes: 2 additions & 2 deletions src/lib/lightning/eclair/eclairApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const request = async <T>(
node: LightningNode,
method: HttpMethod,
path: string,
body?: object,
body?: any,
): Promise<T> => {
if (node.implementation !== 'eclair')
throw new Error(`EclairService cannot be used for '${node.implementation}' nodes`);
Expand All @@ -33,7 +33,7 @@ const request = async <T>(
export const httpPost = async <T>(
node: LightningNode,
path: string,
body?: object,
body?: any,
): Promise<T> => {
return request<T>(node, 'POST', path, body);
};
2 changes: 0 additions & 2 deletions src/lib/lightning/eclair/eclairService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ describe('EclairService', () => {
it('should get wallet balance', async () => {
const ballanceResponse: Partial<WalletInfo> = {
balance: 0.00001,
// eslint-disable-next-line @typescript-eslint/camelcase
unconfirmed_balance: 0,
// eslint-disable-next-line @typescript-eslint/camelcase
immature_balance: 0,
};
bitcoindServiceMock.getWalletInfo.mockResolvedValue(ballanceResponse as any);
Expand Down
3 changes: 3 additions & 0 deletions src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ console.warn = (...args) => {
originalConsoleWarning(...args);
};

// suppress antd `console.time` calls in `useForm()`
console.time = () => undefined;

beforeEach(() => {
// Fix "TypeError: window.matchMedia is not a function" in antd v4
// https://jestjs.io/docs/en/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
Expand Down
4 changes: 2 additions & 2 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { StoreInjections } from 'types';
export const hashHistory = createHashHistory();

export const createReduxStore = (options?: {
initialState?: {} | undefined;
initialState?: any;
injections?: StoreInjections;
history?: History | undefined;
}) => {
Expand All @@ -29,7 +29,7 @@ export const createReduxStore = (options?: {
collapsed: true,
diff: true,
predicate: (getState, action) => {
// don't show thunk success asctions in the console.
// don't show thunk success actions in the console.
// they can still be viewed in Redux DevTools if necessary
return !/.*\(success\)/.test(action.type);
},
Expand Down
5 changes: 2 additions & 3 deletions src/types/bitcoin-core.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */

// Type definitions for bitcoin-core 2.0.0
// Project: https://github.com/ruimarinho/bitcoin-core
// Definitions by: Joe Miyamoto <[email protected]>
Expand All @@ -11,6 +9,7 @@ declare module 'bitcoin-core' {
agentOptions?: any;
headers?: boolean;
host?: string;
// eslint-disable-next-line @typescript-eslint/ban-types
logger?: Function;
network?: 'mainnet' | 'regtest' | 'testnet';
password?: string;
Expand Down Expand Up @@ -649,7 +648,7 @@ declare module 'bitcoin-core' {
to?: string;
};

type TransactionInListSinceBlock = {} & WalletTxBase;
type TransactionInListSinceBlock = WalletTxBase;

type ListSinceBlockResult = {
transactions: TransactionInListSinceBlock[];
Expand Down
1 change: 0 additions & 1 deletion src/utils/objects.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { snakeKeysToCamel } from './objects';

describe('Objects Util', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const getNetwork = (networkId = 1, name?: string, status?: Status): Netwo
customImages: [],
});

export const mockProperty = <T extends {}, K extends keyof T>(
export const mockProperty = <T extends unknown, K extends keyof T>(
object: T,
property: K,
value: T[K],
Expand All @@ -73,7 +73,7 @@ export const mockProperty = <T extends {}, K extends keyof T>(
/**
* Poor man's deep clone. Useful for tests to avoid another dependency
*/
export const clone = (data: object) => JSON.parse(JSON.stringify(data));
export const clone = (data: any) => JSON.parse(JSON.stringify(data));

/**
* Suppresses console errors when executing some code.
Expand Down
4 changes: 2 additions & 2 deletions src/utils/translate.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import i18n from 'i18next';
import i18n, { TOptions } from 'i18next';

/**
* A utility function which returns a `t` function that inserts a prefix in each key lookup
* @param prefix the prefix to use for all translation keys
*/
export const prefixTranslation = (prefix: string) => {
// the new `t` function that will append the prefix
const translate = (key: string, options?: string | object) => {
const translate = (key: string, options?: string | TOptions<any> | undefined) => {
return i18n.t(`${prefix}.${key}`, options);
};

Expand Down

0 comments on commit 630952f

Please sign in to comment.