Fix linter errors

This commit is contained in:
fabioberger
2019-08-26 19:35:57 +02:00
parent b5dc734dc4
commit ea2bf07ea6
17 changed files with 31 additions and 32 deletions

View File

@@ -4,8 +4,8 @@ import styled from 'styled-components';
import { colors } from 'ts/style/colors';
import { Button } from 'ts/components/button';
import { IThemeInterface } from 'ts/style/theme';
import { Paragraph } from 'ts/components/text';
import { IThemeInterface } from 'ts/style/theme';
import { Column, Section } from 'ts/components/newLayout';

View File

@@ -15,9 +15,9 @@ export const AnimationLoader: React.FC<IAnimationLoaderProps> = ({ name }) => {
void loadAnimationAsync(name);
}, [container.current, name]);
const loadAnimationAsync = async (name: string) => {
const loadAnimationAsync = async (_name: string) => {
try {
const animationData = await import(/* webpackChunkName: "animation/[request]" */ `../../../../public/animations/${name}.json`);
const animationData = await import(/* webpackChunkName: "animation/[request]" */ `../../../../public/animations/${_name}.json`);
lottie.loadAnimation({
container: container.current, // the dom element that will contain the animation
@@ -27,7 +27,8 @@ export const AnimationLoader: React.FC<IAnimationLoaderProps> = ({ name }) => {
animationData,
});
} catch (error) {
console.log('Error loading animation');
// tslint:disable-next-line:no-console
console.error('Error loading animation');
}
};

View File

@@ -4,7 +4,6 @@ import styled from 'styled-components';
import { Link } from 'ts/components/documentation/shared/link';
import { Button } from 'ts/components/button';
import { SearchInput } from 'ts/components/docs/search/search_input';

View File

@@ -3,7 +3,7 @@ import styled from 'styled-components';
import { docs } from 'ts/style/docs';
const AnimationLoader = React.lazy(async () =>
const AnimationLoaderLazy = React.lazy(async () =>
import('ts/components/docs/animations/animation_loader').then(({ AnimationLoader }) => ({
default: AnimationLoader,
})),
@@ -28,7 +28,7 @@ export const Animation: React.FC<IAnimationProps> = ({ name, ...props }) => {
return (
<React.Suspense fallback={<React.Fragment />}>
<AnimationWrapper {...props}>
<AnimationLoader name={name} />
<AnimationLoaderLazy name={name} />
</AnimationWrapper>
</React.Suspense>
);

View File

@@ -3,7 +3,6 @@ import styled from 'styled-components';
import { Link } from 'ts/components/documentation/shared/link';
import { Icon } from 'ts/components/icon';
import { Heading, Paragraph } from 'ts/components/text';
import { colors } from 'ts/style/colors';

View File

@@ -86,7 +86,7 @@ export const AutocompleteWrapper = styled.div<IWrapperProps>`
background-color: white;
border: 1px solid #dbdfdd;
border-bottom-color: ${colors.brandLight};
@media (min-width: 1200px) {
width: 750px;
}
@@ -170,7 +170,7 @@ export const AutocompleteWrapper = styled.div<IWrapperProps>`
`
right: 0;
left: 0;
top: 81px;
top: 81px;
`};
${({ isHome }) =>

View File

@@ -3,7 +3,7 @@ import { Configure, Index, InstantSearch } from 'react-instantsearch-dom';
import { AutoComplete } from 'ts/components/docs/search/autocomplete';
import { hitsPerPage, searchClient, getNameToSearchIndex } from 'ts/utils/algolia_constants';
import { getNameToSearchIndex, hitsPerPage, searchClient } from 'ts/utils/algolia_constants';
import { environments } from 'ts/utils/environments';
interface ISearchInputProps {

View File

@@ -39,15 +39,15 @@ const FiltersList: React.FC<IFilterListProps> = ({
// then visually disabling filters. That way the user is still able to see all filters, even those that do not apply to
// the current state of filtering.
const sortAlphabetically = (items: IFilterProps[]) => _.orderBy(items, 'label', 'asc');
const sortAlphabetically = (_items: IFilterProps[]) => _.orderBy(_items, 'label', 'asc');
const sortByDifficulty = (items: IFilterProps[]) => {
const sortByDifficulty = (_items: IFilterProps[]) => {
const order = ['Beginner', 'Intermediate', 'Advanced'];
return items.sort((a, b) => order.indexOf(a.label) - order.indexOf(b.label));
return _items.sort((a, b) => order.indexOf(a.label) - order.indexOf(b.label));
};
const sortFilters = (items: IFilterProps[]) =>
attribute === 'difficulty' ? sortByDifficulty(items) : sortAlphabetically(items);
const sortFilters = (_items: IFilterProps[]) =>
attribute === 'difficulty' ? sortByDifficulty(_items) : sortAlphabetically(_items);
React.useEffect(() => {
// This happens on mount when filters are empty or on clearing all filters, when the items number exceeds that of filters

View File

@@ -2,8 +2,8 @@ import * as _ from 'lodash';
import * as React from 'react';
import styled, { withTheme } from 'styled-components';
import { Column, FlexWrap } from 'ts/components/newLayout';
import { IThemeValuesInterface } from 'ts/style/theme';
import { Heading } from 'ts/components/text';
import { IThemeValuesInterface } from 'ts/style/theme';
import { WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';

View File

@@ -1,8 +1,8 @@
import * as React from 'react';
import styled from 'styled-components';
import { IThemeInterface } from 'ts/style/theme';
import LogoIcon from 'ts/icons/logo-with-type.svg';
import { IThemeInterface } from 'ts/style/theme';
import { zIndex } from 'ts/style/z_index';

View File

@@ -3,7 +3,6 @@ import styled from 'styled-components';
import { Link } from 'ts/components/documentation/shared/link';
import { WrapGrid, WrapProps } from 'ts/components/newLayout';
import { zIndex } from 'ts/style/z_index';

View File

@@ -2,8 +2,8 @@ import * as React from 'react';
import styled, { ThemeProvider } from 'styled-components';
import { Header as DocsHeader } from 'ts/components/docs/header/header';
import { Header as MainHeader } from 'ts/components/header';
import { Footer } from 'ts/components/footer';
import { Header as MainHeader } from 'ts/components/header';
import { GlobalStyles } from 'ts/constants/globalStyle';
import { GLOBAL_THEMES } from 'ts/style/theme';

View File

@@ -85,7 +85,7 @@ const GlobalStyles = withTheme(
width: 1px !important;
overflow: hidden;
}
img, svg {
max-width: 100%;
object-fit: contain;

View File

@@ -28,7 +28,7 @@ declare module '*.json' {
}
declare module '*.mdx' {
let MDXComponent: (props) => JSX.Element;
let MDXComponent: (props: any) => JSX.Element;
export default MDXComponent;
}
@@ -44,7 +44,9 @@ declare module '@mdx-js/react' {
declare module '*.svg' {
import { PureComponent, SVGProps } from 'react';
/* tslint:disable */
export default class extends PureComponent<SVGProps<SVGSVGElement>> {}
/* tslint:enable */
}
declare module 'web3-provider-engine/subproviders/filters';

View File

@@ -76,9 +76,9 @@ export const DocsPage: React.FC<IDocsPageProps> = props => {
void loadPageAsync(filePath);
}, [filePath]);
const loadPageAsync = async (filePath: string) => {
const loadPageAsync = async (_filePath: string) => {
try {
const component = await import(/* webpackChunkName: "mdx/[request]" */ `mdx/${filePath}`);
const component = await import(/* webpackChunkName: "mdx/[request]" */ `mdx/${_filePath}`);
setState({
...state,
@@ -156,6 +156,7 @@ const waitForImages = async () => {
_.compact(
_.map(images, (img: HTMLImageElement) => {
if (!img.complete) {
// tslint:disable-next-line:no-inferred-empty-object-type
return new Promise(resolve => {
img.addEventListener('load', () => resolve());
});

View File

@@ -14,7 +14,7 @@ interface DimensionObject {
type UseDimensionsHook = [(node: HTMLElement) => void, {} | DimensionObject, HTMLElement];
interface UseDimensionsArgs {
liveMeasure?: boolean;
isLiveMeasure?: boolean;
}
function getDimensionObject(node: HTMLElement): DimensionObject {
@@ -32,12 +32,12 @@ function getDimensionObject(node: HTMLElement): DimensionObject {
};
}
export function useDimensions({ liveMeasure = true }: UseDimensionsArgs = {}): UseDimensionsHook {
export function useDimensions({ isLiveMeasure = true }: UseDimensionsArgs = {}): UseDimensionsHook {
const [dimensions, setDimensions] = React.useState({});
const [node, setNode] = React.useState(null);
const ref = React.useCallback(node => {
setNode(node);
const ref = React.useCallback(_node => {
setNode(_node);
}, []);
React.useLayoutEffect(
@@ -47,7 +47,7 @@ export function useDimensions({ liveMeasure = true }: UseDimensionsArgs = {}): U
const measure = () => window.requestAnimationFrame(() => setDimensions(getDimensionObject(node)));
measure();
if (liveMeasure) {
if (isLiveMeasure) {
window.addEventListener('resize', measure);
window.addEventListener('scroll', measure);

View File

@@ -1,9 +1,7 @@
const algoliasearch = require('algoliasearch/lite');
import * as algoliasearch from 'algoliasearch/lite';
import { ObjectMap } from '@0x/types';
import { environments } from './environments';
const ALGOLIA_MAX_NUMBER_HITS = 1000; // Limit set by algolia
export const ALGOLIA_APP_ID = 'HWXKQZ6EUX';