1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-28 00:44:30 +07:00

fix: @typescript-eslint/no-explicit-any

This commit is contained in:
Griffithtp 2019-06-26 00:10:15 +01:00
parent 7cab3f289e
commit 6eec4f45d9
8 changed files with 17 additions and 15 deletions

View File

@ -20,10 +20,12 @@ export const AppContext = React.createContext<{}>({});
export const AppContextProvider = AppContext.Provider; export const AppContextProvider = AppContext.Provider;
export const AppContextConsumer = AppContext.Consumer; export const AppContextConsumer = AppContext.Consumer;
interface AppStateInterface { export interface AppStateInterface {
error?: FormError; error?: FormError;
logoUrl: string; logoUrl: string;
user: {}; user: {
username?: string;
};
scope: string; scope: string;
showLoginModal: boolean; showLoginModal: boolean;
isUserLoggedIn: boolean; isUserLoggedIn: boolean;

View File

@ -22,7 +22,7 @@ import RegistryInfoContent from '../RegistryInfoContent/RegistryInfoContent';
import { Greetings, NavBar, InnerNavBar, MobileNavBar, InnerMobileNavBar, LeftSide, RightSide, IconSearchButton, SearchWrapper } from './styles'; import { Greetings, NavBar, InnerNavBar, MobileNavBar, InnerMobileNavBar, LeftSide, RightSide, IconSearchButton, SearchWrapper } from './styles';
interface Props { interface Props {
logo: string; logo?: string;
username?: string; username?: string;
onLogout: () => void; onLogout: () => void;
onToggleLoginModal: () => void; onToggleLoginModal: () => void;

View File

@ -61,7 +61,7 @@ export interface Props {
size?: Breakpoint; size?: Breakpoint;
pointer?: boolean; pointer?: boolean;
img?: boolean; img?: boolean;
// modifiers?: null | undefined; modifiers?: null | undefined;
} }
const Icon: React.FC<Props> = ({ className, name, size = 'sm', img = false, pointer = false, ...props }) => { const Icon: React.FC<Props> = ({ className, name, size = 'sm', img = false, pointer = false, ...props }) => {

View File

@ -36,8 +36,8 @@ export const Svg = styled('svg')`
export const ImgWrapper: StyledOtherComponent< export const ImgWrapper: StyledOtherComponent<
{ {
size?: Breakpoint; size?: Breakpoint;
pointer: any; pointer: boolean;
modifiers?: any; modifiers?: null | undefined;
name?: string | unknown; name?: string | unknown;
}, },
DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>,

View File

@ -6,7 +6,7 @@ interface Props {
text: string; text: string;
capitalize?: boolean; capitalize?: boolean;
weight?: string; weight?: string;
modifiers?: any; modifiers?: null | undefined;
} }
const Wrapper = styled('div')` const Wrapper = styled('div')`

View File

@ -19,7 +19,7 @@ class Versions extends React.PureComponent {
); );
} }
public renderPackageList = (packages: any, isVersion: boolean = false, timeMap: Record<string, any> = {}): ReactElement<HTMLDivElement> => { public renderPackageList = (packages: {}, isVersion: boolean = false, timeMap: Record<string, {}> = {}): ReactElement<HTMLDivElement> => {
return ( return (
<List> <List>
{Object.keys(packages) {Object.keys(packages)

View File

@ -2,7 +2,7 @@
import React, { Component, ReactElement } from 'react'; import React, { Component, ReactElement } from 'react';
import { Router, Route, Switch } from 'react-router-dom'; import { Router, Route, Switch } from 'react-router-dom';
import { AppContextConsumer } from './App/App'; import { AppContextConsumer, AppStateInterface } from './App/App';
import { asyncComponent } from './utils/asyncComponent'; import { asyncComponent } from './utils/asyncComponent';
import history from './history'; import history from './history';
@ -39,8 +39,8 @@ class RouterApp extends Component<RouterAppProps> {
return ( return (
<AppContextConsumer> <AppContextConsumer>
{function renderConsumerVersionPage({ logoUrl, scope, user }: any) { {function renderConsumerVersionPage({ logoUrl, scope = '', user }: Partial<AppStateInterface>) {
return <Header logo={logoUrl} onLogout={onLogout} onToggleLoginModal={onToggleLoginModal} scope={scope} username={user.username} />; return <Header logo={logoUrl} onLogout={onLogout} onToggleLoginModal={onToggleLoginModal} scope={scope} username={user && user.username} />;
}} }}
</AppContextConsumer> </AppContextConsumer>
); );
@ -49,7 +49,7 @@ class RouterApp extends Component<RouterAppProps> {
public renderHomePage = (): ReactElement<HTMLDivElement> => { public renderHomePage = (): ReactElement<HTMLDivElement> => {
return ( return (
<AppContextConsumer> <AppContextConsumer>
{function renderConsumerVersionPage({ isUserLoggedIn, packages }: any) { {function renderConsumerVersionPage({ isUserLoggedIn, packages }: Partial<AppStateInterface>) {
// @ts-ignore // @ts-ignore
return <HomePage isUserLoggedIn={isUserLoggedIn} packages={packages} />; return <HomePage isUserLoggedIn={isUserLoggedIn} packages={packages} />;
}} }}
@ -57,10 +57,10 @@ class RouterApp extends Component<RouterAppProps> {
); );
}; };
public renderVersionPage = (routerProps: any): ReactElement<HTMLDivElement> => { public renderVersionPage = (routerProps): ReactElement<HTMLDivElement> => {
return ( return (
<AppContextConsumer> <AppContextConsumer>
{function renderConsumerVersionPage({ isUserLoggedIn }: any) { {function renderConsumerVersionPage({ isUserLoggedIn }: Partial<AppStateInterface>) {
return <VersionPackage {...routerProps} isUserLoggedIn={isUserLoggedIn} />; return <VersionPackage {...routerProps} isUserLoggedIn={isUserLoggedIn} />;
}} }}
</AppContextConsumer> </AppContextConsumer>

View File

@ -1,6 +1,6 @@
import { SyntheticEvent } from 'react'; import { SyntheticEvent } from 'react';
export const copyToClipBoardUtility = (str: string): any => (event: SyntheticEvent<HTMLElement>): void => { export const copyToClipBoardUtility = (str: string): ((e: SyntheticEvent<HTMLElement>) => void) => (event: SyntheticEvent<HTMLElement>): void => {
event.preventDefault(); event.preventDefault();
const node = document.createElement('div'); const node = document.createElement('div');