From 348af32b65bb5b7805b49e72821f74657db46ad5 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 2 Sep 2019 13:25:46 +0200 Subject: [PATCH] new linting rule fixes --- client/src/components/atoms/CategoryImage.test.tsx | 2 +- client/src/components/atoms/Markdown.test.tsx | 2 +- client/src/components/molecules/Pagination.tsx | 7 ++++--- .../components/molecules/VersionNumbers/VersionTable.tsx | 2 +- client/src/components/molecules/VersionNumbers/index.tsx | 4 +++- client/src/components/organisms/AssetsLatest.tsx | 2 +- client/src/components/organisms/AssetsUser.tsx | 4 ++-- client/src/components/organisms/Header.tsx | 2 +- client/src/components/templates/Asset/index.tsx | 2 +- client/src/components/templates/Channel.tsx | 2 +- client/src/context/UserProvider.tsx | 1 + client/src/routes/Publish/Files/ItemForm.test.tsx | 2 +- client/src/routes/Publish/Files/index.test.tsx | 4 ++-- client/src/routes/Publish/Files/index.tsx | 2 +- client/src/routes/Publish/index.tsx | 6 +++--- client/src/routes/Search.tsx | 2 +- 16 files changed, 25 insertions(+), 21 deletions(-) diff --git a/client/src/components/atoms/CategoryImage.test.tsx b/client/src/components/atoms/CategoryImage.test.tsx index ae9016b..101ca91 100644 --- a/client/src/components/atoms/CategoryImage.test.tsx +++ b/client/src/components/atoms/CategoryImage.test.tsx @@ -5,7 +5,7 @@ import formPublish from '../../data/form-publish.json' describe('CategoryImage', () => { it('renders fallback image', () => { - const { container } = render() + const { container } = render() expect(container.firstChild).toBeInTheDocument() expect(container.firstChild.style.backgroundImage).toMatch( /jellyfish-back/ diff --git a/client/src/components/atoms/Markdown.test.tsx b/client/src/components/atoms/Markdown.test.tsx index 1db0dee..9c6656d 100644 --- a/client/src/components/atoms/Markdown.test.tsx +++ b/client/src/components/atoms/Markdown.test.tsx @@ -4,7 +4,7 @@ import Markdown from './Markdown' describe('Markdown', () => { it('renders without crashing', () => { - const { container } = render() + const { container } = render() expect(container.firstChild).toBeInTheDocument() }) }) diff --git a/client/src/components/molecules/Pagination.tsx b/client/src/components/molecules/Pagination.tsx index 235da30..24eaab9 100644 --- a/client/src/components/molecules/Pagination.tsx +++ b/client/src/components/molecules/Pagination.tsx @@ -17,6 +17,7 @@ export default class Pagination extends PureComponent< PaginationState > { public state = { smallViewport: true } + private mq = window.matchMedia && window.matchMedia('(min-width: 600px)') public componentDidMount() { @@ -55,9 +56,9 @@ export default class Pagination extends PureComponent< pageRangeDisplayed={smallViewport ? 3 : 6} onPageChange={data => handlePageClick(data)} disableInitialCallback - previousLabel={'←'} - nextLabel={'→'} - breakLabel={'...'} + previousLabel="←" + nextLabel="→" + breakLabel="..." containerClassName={styles.pagination} pageLinkClassName={styles.number} activeLinkClassName={styles.current} diff --git a/client/src/components/molecules/VersionNumbers/VersionTable.tsx b/client/src/components/molecules/VersionNumbers/VersionTable.tsx index df0ec1b..d568d25 100644 --- a/client/src/components/molecules/VersionNumbers/VersionTable.tsx +++ b/client/src/components/molecules/VersionNumbers/VersionTable.tsx @@ -43,7 +43,7 @@ export const VersionTableContracts = ({ diff --git a/client/src/components/molecules/VersionNumbers/index.tsx b/client/src/components/molecules/VersionNumbers/index.tsx index 234f827..f451f77 100644 --- a/client/src/components/molecules/VersionNumbers/index.tsx +++ b/client/src/components/molecules/VersionNumbers/index.tsx @@ -42,9 +42,11 @@ export default class VersionNumbers extends PureComponent< // construct values which are not part of any response public commonsVersion = process.env.NODE_ENV === 'production' ? version : `${version}-dev` + public commonsNetwork = faucetUri.includes('localhost') ? 'Spree' : new URL(nodeUri).hostname.split('.')[0] + public faucetNetwork = faucetUri.includes('dev-ocean') ? new URL(faucetUri).hostname.split('.')[1] : faucetUri.includes('oceanprotocol.com') @@ -155,7 +157,7 @@ export default class VersionNumbers extends PureComponent<

v{commons.version}{' '} {market.network && `(${market.network})`} diff --git a/client/src/components/organisms/AssetsLatest.tsx b/client/src/components/organisms/AssetsLatest.tsx index 8f8c106..98878b0 100644 --- a/client/src/components/organisms/AssetsLatest.tsx +++ b/client/src/components/organisms/AssetsLatest.tsx @@ -13,7 +13,7 @@ interface AssetsLatestState { export default class AssetsLatest extends PureComponent<{}, AssetsLatestState> { public state = { latestAssets: [], isLoadingLatest: true } - public _isMounted: boolean = false + public _isMounted = false public componentDidMount() { this._isMounted = true diff --git a/client/src/components/organisms/AssetsUser.tsx b/client/src/components/organisms/AssetsUser.tsx index 36ba6bd..f0d828d 100644 --- a/client/src/components/organisms/AssetsUser.tsx +++ b/client/src/components/organisms/AssetsUser.tsx @@ -12,7 +12,7 @@ export default class AssetsUser extends PureComponent< > { public state = { results: [], isLoading: true } - public _isMounted: boolean = false + public _isMounted = false public componentDidMount() { this._isMounted = true @@ -88,7 +88,7 @@ export default class AssetsUser extends PureComponent< /> ))} {this.props.recent && ( - + All Data Sets )} diff --git a/client/src/components/organisms/Header.tsx b/client/src/components/organisms/Header.tsx index b5d43fc..a7acc61 100644 --- a/client/src/components/organisms/Header.tsx +++ b/client/src/components/organisms/Header.tsx @@ -23,7 +23,7 @@ export default class Header extends PureComponent { return (

- +

{meta.title}

diff --git a/client/src/components/templates/Asset/index.tsx b/client/src/components/templates/Asset/index.tsx index 98b8f33..f196668 100644 --- a/client/src/components/templates/Asset/index.tsx +++ b/client/src/components/templates/Asset/index.tsx @@ -57,7 +57,7 @@ class Asset extends Component { return isLoading ? (
- +
) : error !== '' ? (
{error}
diff --git a/client/src/components/templates/Channel.tsx b/client/src/components/templates/Channel.tsx index cec5a26..47ee36e 100644 --- a/client/src/components/templates/Channel.tsx +++ b/client/src/components/templates/Channel.tsx @@ -83,7 +83,7 @@ export default class Channel extends PureComponent { private handlePageClick = async (data: { selected: number }) => { // react-pagination starts counting at 0, we start at 1 - let toPage = data.selected + 1 + const toPage = data.selected + 1 this.props.history.push({ search: `?page=${toPage}` }) diff --git a/client/src/context/UserProvider.tsx b/client/src/context/UserProvider.tsx index d93d22b..86a51ed 100644 --- a/client/src/context/UserProvider.tsx +++ b/client/src/context/UserProvider.tsx @@ -125,6 +125,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> { } private accountsInterval: any = null + private networkInterval: any = null public async componentDidMount() { diff --git a/client/src/routes/Publish/Files/ItemForm.test.tsx b/client/src/routes/Publish/Files/ItemForm.test.tsx index dcdf692..3fbd8d0 100644 --- a/client/src/routes/Publish/Files/ItemForm.test.tsx +++ b/client/src/routes/Publish/Files/ItemForm.test.tsx @@ -5,7 +5,7 @@ import ItemForm from './ItemForm' const addItem = jest.fn() const setup = () => { - const utils = render() + const utils = render() const input = utils.getByPlaceholderText('Hello') const button = utils.getByText('Add File') const { container } = utils diff --git a/client/src/routes/Publish/Files/index.test.tsx b/client/src/routes/Publish/Files/index.test.tsx index defeebc..96eee37 100644 --- a/client/src/routes/Publish/Files/index.test.tsx +++ b/client/src/routes/Publish/Files/index.test.tsx @@ -38,8 +38,8 @@ const renderComponent = () => render( ) diff --git a/client/src/routes/Publish/Files/index.tsx b/client/src/routes/Publish/Files/index.tsx index e147358..2ee5e86 100644 --- a/client/src/routes/Publish/Files/index.tsx +++ b/client/src/routes/Publish/Files/index.tsx @@ -60,7 +60,7 @@ export default class Files extends PureComponent { } private addItem = async (value: string) => { - let file: File = { + const file: File = { url: value, contentType: '', found: false // non-standard diff --git a/client/src/routes/Publish/index.tsx b/client/src/routes/Publish/index.tsx index 18542eb..fe31035 100644 --- a/client/src/routes/Publish/index.tsx +++ b/client/src/routes/Publish/index.tsx @@ -38,7 +38,7 @@ interface PublishState { } if (allowPricing) { - ;(steps as any)[0].fields['price'] = { + ;(steps as any)[0].fields.price = { label: 'Price', placeholder: 'Price in Ocean tokens', type: 'string', @@ -139,7 +139,7 @@ class Publish extends Component<{}, PublishState> { } private validateInputs = (name: string, value: string) => { - let hasContent = value.length > 0 + const hasContent = value.length > 0 // Setting state for all fields if (hasContent) { @@ -176,7 +176,7 @@ class Publish extends Component<{}, PublishState> { } private runValidation = () => { - let { validationStatus } = this.state + const { validationStatus } = this.state // // Step 1 // diff --git a/client/src/routes/Search.tsx b/client/src/routes/Search.tsx index 4eb5ae1..d7b0594 100644 --- a/client/src/routes/Search.tsx +++ b/client/src/routes/Search.tsx @@ -105,7 +105,7 @@ class Search extends PureComponent { private handlePageClick = async (data: { selected: number }) => { // react-pagination starts counting at 0, we start at 1 - let toPage = data.selected + 1 + const toPage = data.selected + 1 this.props.history.push({ pathname: this.props.location.pathname,