Browse Source

chore(eslint): fix eslint v3 breaking changes

master
jamaljsr 4 years ago
committed by Jamal James
parent
commit
630952f8c2
  1. 1
      .eslintrc
  2. 2
      electron/httpProxy.ts
  3. 4
      electron/lnd/lndProxyServer.ts
  4. 1
      src/components/designer/bitcoind/BitcoindDetails.spec.tsx
  5. 2
      src/components/network/NetworkView.spec.tsx
  6. 3
      src/hooks/usePrefixedTranslation.ts
  7. 1
      src/lib/docker/nodeTemplates.ts
  8. 4
      src/lib/lightning/clightning/clightningApi.ts
  9. 4
      src/lib/lightning/eclair/eclairApi.ts
  10. 2
      src/lib/lightning/eclair/eclairService.spec.ts
  11. 3
      src/setupTests.js
  12. 4
      src/store/index.ts
  13. 5
      src/types/bitcoin-core.d.ts
  14. 1
      src/utils/objects.spec.ts
  15. 4
      src/utils/tests/helpers.ts
  16. 4
      src/utils/translate.ts

1
.eslintrc

@ -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
electron/httpProxy.ts

@ -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;

4
electron/lnd/lndProxyServer.ts

@ -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: {

1
src/components/designer/bitcoind/BitcoindDetails.spec.tsx

@ -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 });
});

2
src/components/network/NetworkView.spec.tsx

@ -48,7 +48,6 @@ describe('NetworkView Component', () => {
},
walletInfo: {
balance: 10,
// eslint-disable-next-line @typescript-eslint/camelcase
immature_balance: 20,
},
},
@ -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);
});

3
src/hooks/usePrefixedTranslation.ts

@ -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
@ -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);
},

1
src/lib/docker/nodeTemplates.ts

@ -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';

4
src/lib/lightning/clightning/clightningApi.ts

@ -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(
@ -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);
};

4
src/lib/lightning/eclair/eclairApi.ts

@ -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`);
@ -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
src/lib/lightning/eclair/eclairService.spec.ts

@ -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);

3
src/setupTests.js

@ -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

4
src/store/index.ts

@ -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;
}) => {
@ -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);
},

5
src/types/bitcoin-core.d.ts

@ -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 <joemphilps@gmail.com>
@ -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;
@ -649,7 +648,7 @@ declare module 'bitcoin-core' {
to?: string;
};
type TransactionInListSinceBlock = {} & WalletTxBase;
type TransactionInListSinceBlock = WalletTxBase;
type ListSinceBlockResult = {
transactions: TransactionInListSinceBlock[];

1
src/utils/objects.spec.ts

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/camelcase */
import { snakeKeysToCamel } from './objects';
describe('Objects Util', () => {

4
src/utils/tests/helpers.ts

@ -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],
@ -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.

4
src/utils/translate.ts

@ -1,4 +1,4 @@
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
@ -6,7 +6,7 @@ import i18n from 'i18next';
*/
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);
};

Loading…
Cancel
Save