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', () => {
it('renders fallback image', () => {
const { container } = render(<CategoryImage category={''} />)
const { container } = render(<CategoryImage category="" />)
expect(container.firstChild).toBeInTheDocument()
expect(container.firstChild.style.backgroundImage).toMatch(
/jellyfish-back/

View File

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

View File

@ -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}

View File

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

View File

@ -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<
<p className={styles.versionsMinimal}>
<a
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}{' '}
{market.network && `(${market.network})`}

View File

@ -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

View File

@ -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 && (
<Link className={styles.link} to={'/history'}>
<Link className={styles.link} to="/history">
All Data Sets
</Link>
)}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
//

View File

@ -105,7 +105,7 @@ class Search extends PureComponent<SearchProps, SearchState> {
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,