Skip to content

Commit

Permalink
fixing type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-1979 committed Jun 12, 2024
1 parent f27d48f commit db2b06e
Show file tree
Hide file tree
Showing 223 changed files with 557 additions and 3,233 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ module.exports = {
'jest/**/*',
'i18next-scanner.config.js'
],
parser: '@typescript-eslint/parser',
parserOptions: {
...base.parserOptions,
project: [
'./tsconfig.eslint.json'
]
},
plugins: ['@typescript-eslint'],
rules: {
...base.rules,
// this seems very broken atm, false positives
'@typescript-eslint/unbound-method': 'off'
'@typescript-eslint/unbound-method': 'off',
"parser": "@typescript-eslint/parser",
"@typescript-eslint/no-explicit-any": "off",
"no-unused-vars": "warn"
}
};
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"Polkagate",
"Roboto",
"suri"
]
],
"references.preferredLocation": "view"
}
8 changes: 8 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2017-2024 @polkadot/extension authors & contributors
// SPDX-License-Identifier: Apache-2.0

import baseConfig from '@polkadot/dev/config/eslint';

export default [
...baseConfig
];
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export default class Extension {
private windowOpen (path: AllowedPath): boolean {
const url = `${chrome.runtime.getURL('index.html')}#${path}`;

if (!ALLOWED_PATH.includes(path) && !START_WITH_PATH.find((p) => path.startsWith(p))) { // added for Polkagate, updated
if (!ALLOWED_PATH.includes(path as any) && !START_WITH_PATH.find((p) => path.startsWith(p))) { // added for Polkagate, updated
console.error('Not allowed to open the url:', url);

return false;
Expand Down
4 changes: 1 addition & 3 deletions packages/extension-base/src/background/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import type { KeypairType } from '@polkadot/util-crypto/types';

import { TypeRegistry } from '@polkadot/types';

import { ALLOWED_PATH } from '../defaults';

export type AuthUrls = Record<string, AuthUrlInfo>;
export interface AuthUrlInfo {
count: number;
Expand Down Expand Up @@ -419,7 +417,7 @@ export interface ResponseJsonRestore {
error: string | null;
}

export type AllowedPath = typeof ALLOWED_PATH[number];
export type AllowedPath = string; // typeof ALLOWED_PATH[number];

export interface ResponseJsonGetAccountInfo {
address: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/extension-polkagate/src/MetadataCache.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { MetadataDef } from '@polkadot/extension-inject/types';
import type { MetadataDef } from '@polkadot/extension-inject/types';

const metadataGets = new Map<string, Promise<MetadataDef | null>>();

export function getSavedMeta (genesisHash: string): Promise<MetadataDef | null> | undefined {
export function getSavedMeta(genesisHash: string): Promise<MetadataDef | null> | undefined {
return metadataGets.get(genesisHash);
}

export function setSavedMeta (genesisHash: string, def: Promise<MetadataDef | null>): Map<string, Promise<MetadataDef | null>> {
export function setSavedMeta(genesisHash: string, def: Promise<MetadataDef | null>): Map<string, Promise<MetadataDef | null>> {
return metadataGets.set(genesisHash, def);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { ArrowForwardIosRounded as ArrowForwardIosRoundedIcon, MoreVert as MoreV
import { Grid, IconButton, useTheme } from '@mui/material';
import React from 'react';

import { Chain } from '@polkadot/extension-chains/types';
import type { Chain } from '@polkadot/extension-chains/types';


interface Props {
menuOnClick: () => void;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import { Divider, Grid, SxProps, Theme } from '@mui/material';
import React from 'react';

import { Chain } from '@polkadot/extension-chains/types';
import type { Chain } from '@polkadot/extension-chains/types';


import ThroughProxy from '../partials/ThroughProxy';
import { AccountHolder } from '.';
Expand All @@ -20,7 +21,7 @@ interface Props {
chain: Chain | null;
}

function AccountHolderWithProxy ({ address, chain, selectedProxyAddress, showDivider = false, style, title }: Props): React.ReactElement {
function AccountHolderWithProxy({ address, chain, selectedProxyAddress, showDivider = false, style, title }: Props): React.ReactElement {
return (
<Grid alignItems='center' container direction='column' justifyContent='center' sx={{ fontWeight: 300, letterSpacing: '-0.015em', pt: '5px', ...style }}>
<AccountHolder
Expand Down
5 changes: 3 additions & 2 deletions packages/extension-polkagate/src/components/AccountIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Grid, IconButton, useTheme } from '@mui/material';
import React, { useCallback, useContext } from 'react';

import { Chain } from '@polkadot/extension-chains/types';
import type { Chain } from '@polkadot/extension-chains/types';


import { useTranslation } from '../hooks';
import { windowOpen } from '../messaging';
Expand All @@ -32,7 +33,7 @@ interface Props {
recoverable?: boolean;
}

export default function AccountIcons ({ chain, formatted, identiconTheme, isSubId, judgements, prefix, proxies, recoverable = false }: Props): React.ReactElement<Props> {
export default function AccountIcons({ chain, formatted, identiconTheme, isSubId, judgements, prefix, proxies, recoverable = false }: Props): React.ReactElement<Props> {
const theme = useTheme();
const { t } = useTranslation();
const onAction = useContext(ActionContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Grid, SxProps, Theme, useTheme } from '@mui/material';
import React, { useContext } from 'react';
import { useParams } from 'react-router';

import { Chain } from '@polkadot/extension-chains/types';
import type { Chain } from '@polkadot/extension-chains/types';


import { useApi, useTranslation } from '../hooks';
import getAllAddresses from '../util/getAllAddresses';
Expand Down
65 changes: 0 additions & 65 deletions packages/extension-polkagate/src/components/Address.spec.tsx

This file was deleted.

108 changes: 0 additions & 108 deletions packages/extension-polkagate/src/components/AddressInput.spec.tsx

This file was deleted.

Loading

0 comments on commit db2b06e

Please sign in to comment.