1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

new linting rule fixes

This commit is contained in:
Matthias Kretschmann 2019-09-02 13:25:46 +02:00
parent 509a69b53d
commit 348af32b65
Signed by: m
GPG Key ID: 606EEEF3C479A91F
16 changed files with 25 additions and 21 deletions

View File

@ -5,7 +5,7 @@ import formPublish from '../../data/form-publish.json'
describe('CategoryImage', () => { describe('CategoryImage', () => {
it('renders fallback image', () => { it('renders fallback image', () => {
const { container } = render(<CategoryImage category={''} />) const { container } = render(<CategoryImage category="" />)
expect(container.firstChild).toBeInTheDocument() expect(container.firstChild).toBeInTheDocument()
expect(container.firstChild.style.backgroundImage).toMatch( expect(container.firstChild.style.backgroundImage).toMatch(
/jellyfish-back/ /jellyfish-back/

View File

@ -4,7 +4,7 @@ import Markdown from './Markdown'
describe('Markdown', () => { describe('Markdown', () => {
it('renders without crashing', () => { it('renders without crashing', () => {
const { container } = render(<Markdown text={'#hello'} />) const { container } = render(<Markdown text="#hello" />)
expect(container.firstChild).toBeInTheDocument() expect(container.firstChild).toBeInTheDocument()
}) })
}) })

View File

@ -17,6 +17,7 @@ export default class Pagination extends PureComponent<
PaginationState PaginationState
> { > {
public state = { smallViewport: true } public state = { smallViewport: true }
private mq = window.matchMedia && window.matchMedia('(min-width: 600px)') private mq = window.matchMedia && window.matchMedia('(min-width: 600px)')
public componentDidMount() { public componentDidMount() {
@ -55,9 +56,9 @@ export default class Pagination extends PureComponent<
pageRangeDisplayed={smallViewport ? 3 : 6} pageRangeDisplayed={smallViewport ? 3 : 6}
onPageChange={data => handlePageClick(data)} onPageChange={data => handlePageClick(data)}
disableInitialCallback disableInitialCallback
previousLabel={'←'} previousLabel="←"
nextLabel={'→'} nextLabel="→"
breakLabel={'...'} breakLabel="..."
containerClassName={styles.pagination} containerClassName={styles.pagination}
pageLinkClassName={styles.number} pageLinkClassName={styles.number}
activeLinkClassName={styles.current} activeLinkClassName={styles.current}

View File

@ -43,7 +43,7 @@ export const VersionTableContracts = ({
</td> </td>
<td> <td>
<VersionNumber <VersionNumber
name={'Keeper Contracts'} name="Keeper Contracts"
version={keeperVersion} version={keeperVersion}
/> />
</td> </td>

View File

@ -42,9 +42,11 @@ export default class VersionNumbers extends PureComponent<
// construct values which are not part of any response // construct values which are not part of any response
public commonsVersion = public commonsVersion =
process.env.NODE_ENV === 'production' ? version : `${version}-dev` process.env.NODE_ENV === 'production' ? version : `${version}-dev`
public commonsNetwork = faucetUri.includes('localhost') public commonsNetwork = faucetUri.includes('localhost')
? 'Spree' ? 'Spree'
: new URL(nodeUri).hostname.split('.')[0] : new URL(nodeUri).hostname.split('.')[0]
public faucetNetwork = faucetUri.includes('dev-ocean') public faucetNetwork = faucetUri.includes('dev-ocean')
? new URL(faucetUri).hostname.split('.')[1] ? new URL(faucetUri).hostname.split('.')[1]
: faucetUri.includes('oceanprotocol.com') : faucetUri.includes('oceanprotocol.com')
@ -155,7 +157,7 @@ export default class VersionNumbers extends PureComponent<
<p className={styles.versionsMinimal}> <p className={styles.versionsMinimal}>
<a <a
title={`${squid.name} v${squid.version}\n${brizo.name} v${brizo.version}\n${aquarius.name} v${aquarius.version}`} title={`${squid.name} v${squid.version}\n${brizo.name} v${brizo.version}\n${aquarius.name} v${aquarius.version}`}
href={'/about'} href="/about"
> >
v{commons.version}{' '} v{commons.version}{' '}
{market.network && `(${market.network})`} {market.network && `(${market.network})`}

View File

@ -13,7 +13,7 @@ interface AssetsLatestState {
export default class AssetsLatest extends PureComponent<{}, AssetsLatestState> { export default class AssetsLatest extends PureComponent<{}, AssetsLatestState> {
public state = { latestAssets: [], isLoadingLatest: true } public state = { latestAssets: [], isLoadingLatest: true }
public _isMounted: boolean = false public _isMounted = false
public componentDidMount() { public componentDidMount() {
this._isMounted = true this._isMounted = true

View File

@ -12,7 +12,7 @@ export default class AssetsUser extends PureComponent<
> { > {
public state = { results: [], isLoading: true } public state = { results: [], isLoading: true }
public _isMounted: boolean = false public _isMounted = false
public componentDidMount() { public componentDidMount() {
this._isMounted = true this._isMounted = true
@ -88,7 +88,7 @@ export default class AssetsUser extends PureComponent<
/> />
))} ))}
{this.props.recent && ( {this.props.recent && (
<Link className={styles.link} to={'/history'}> <Link className={styles.link} to="/history">
All Data Sets All Data Sets
</Link> </Link>
)} )}

View File

@ -23,7 +23,7 @@ export default class Header extends PureComponent {
return ( return (
<header className={styles.header}> <header className={styles.header}>
<div className={styles.headerContent}> <div className={styles.headerContent}>
<NavLink to={'/'} className={styles.headerLogo}> <NavLink to="/" className={styles.headerLogo}>
<Logo className={styles.headerLogoImage} /> <Logo className={styles.headerLogoImage} />
<h1 className={styles.headerTitle}>{meta.title}</h1> <h1 className={styles.headerTitle}>{meta.title}</h1>
</NavLink> </NavLink>

View File

@ -57,7 +57,7 @@ class Asset extends Component<AssetProps, AssetState> {
return isLoading ? ( return isLoading ? (
<div className={stylesApp.loader}> <div className={stylesApp.loader}>
<Spinner message={'Loading asset...'} /> <Spinner message="Loading asset..." />
</div> </div>
) : error !== '' ? ( ) : error !== '' ? (
<div className={styles.error}>{error}</div> <div className={styles.error}>{error}</div>

View File

@ -83,7 +83,7 @@ export default class Channel extends PureComponent<ChannelProps, ChannelState> {
private handlePageClick = async (data: { selected: number }) => { private handlePageClick = async (data: { selected: number }) => {
// react-pagination starts counting at 0, we start at 1 // 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}` }) this.props.history.push({ search: `?page=${toPage}` })

View File

@ -125,6 +125,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
} }
private accountsInterval: any = null private accountsInterval: any = null
private networkInterval: any = null private networkInterval: any = null
public async componentDidMount() { public async componentDidMount() {

View File

@ -5,7 +5,7 @@ import ItemForm from './ItemForm'
const addItem = jest.fn() const addItem = jest.fn()
const setup = () => { const setup = () => {
const utils = render(<ItemForm placeholder={'Hello'} addItem={addItem} />) const utils = render(<ItemForm placeholder="Hello" addItem={addItem} />)
const input = utils.getByPlaceholderText('Hello') const input = utils.getByPlaceholderText('Hello')
const button = utils.getByText('Add File') const button = utils.getByText('Add File')
const { container } = utils const { container } = utils

View File

@ -38,8 +38,8 @@ const renderComponent = () =>
render( render(
<Files <Files
files={files} files={files}
placeholder={'Hello'} placeholder="Hello"
name={'Hello'} name="Hello"
onChange={onChange} onChange={onChange}
/> />
) )

View File

@ -60,7 +60,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
} }
private addItem = async (value: string) => { private addItem = async (value: string) => {
let file: File = { const file: File = {
url: value, url: value,
contentType: '', contentType: '',
found: false // non-standard found: false // non-standard

View File

@ -38,7 +38,7 @@ interface PublishState {
} }
if (allowPricing) { if (allowPricing) {
;(steps as any)[0].fields['price'] = { ;(steps as any)[0].fields.price = {
label: 'Price', label: 'Price',
placeholder: 'Price in Ocean tokens', placeholder: 'Price in Ocean tokens',
type: 'string', type: 'string',
@ -139,7 +139,7 @@ class Publish extends Component<{}, PublishState> {
} }
private validateInputs = (name: string, value: string) => { private validateInputs = (name: string, value: string) => {
let hasContent = value.length > 0 const hasContent = value.length > 0
// Setting state for all fields // Setting state for all fields
if (hasContent) { if (hasContent) {
@ -176,7 +176,7 @@ class Publish extends Component<{}, PublishState> {
} }
private runValidation = () => { private runValidation = () => {
let { validationStatus } = this.state const { validationStatus } = this.state
// //
// Step 1 // Step 1
// //

View File

@ -105,7 +105,7 @@ class Search extends PureComponent<SearchProps, SearchState> {
private handlePageClick = async (data: { selected: number }) => { private handlePageClick = async (data: { selected: number }) => {
// react-pagination starts counting at 0, we start at 1 // react-pagination starts counting at 0, we start at 1
let toPage = data.selected + 1 const toPage = data.selected + 1
this.props.history.push({ this.props.history.push({
pathname: this.props.location.pathname, pathname: this.props.location.pathname,