eslint fix

This commit is contained in:
He4eT 2021-07-22 14:49:31 +05:00
commit 1e0b16361f
10 changed files with 25 additions and 23 deletions

View file

@ -1,5 +1,5 @@
import { h } from 'preact'
import { useEffect, useRef, useState } from 'preact/hooks'
import { useEffect, useState } from 'preact/hooks'
import TextMessage from './TextMessage'
@ -16,7 +16,7 @@ export default function ({ inbox, currentWindow }) {
const newOrPrev = (cur, prev) => i => {
const byId = (list, i) =>
list.find(({line}) => line === i)
list.find(({ line }) => line === i)
return byId(cur, i) || byId(prev, i)
}
@ -33,7 +33,7 @@ export default function ({ inbox, currentWindow }) {
rawMessages
.map(x => x.content)
.map(([x]) => x)
.map(({text}) => text)
.map(({ text }) => text)
.map(text => text.trim())
const isEmpty =
@ -47,10 +47,11 @@ export default function ({ inbox, currentWindow }) {
text.replace(' ', ' / '))
.map(text => ({
style: 'grid',
text}))
text
}))
setMessages(isEmpty ? [] : messages)
}, [inbox, currentWindow])
}, [inbox, currentWindow, prevMessages])
return (
<section

View file

@ -6,7 +6,7 @@ const fail = details => (
<h1>
Error
</h1>
{details.map(x => (<p>{x}</p>))}
{details.map(x => (<p key={x}>{x}</p>))}
<hr />
<Link href='/'>
Home
@ -14,7 +14,7 @@ const fail = details => (
|
<a
target='_blank'
rel='noopener'
rel='noopener noreferrer'
href='https://github.com/He4eT/ifplayer/issues'>
Report bug
</a>
@ -23,7 +23,7 @@ const fail = details => (
const loading = details => (
<div class='status loading'>
{details.map(x => (<div>{x}</div>))}
{details.map(x => (<div key={x}>{x}</div>))}
</div>
)

View file

@ -57,7 +57,7 @@ export default function ({ inbox, currentWindow }) {
const { incoming, clear } =
parseInbox(inbox, currentWindow)
setMessages(clear
setMessages(messages => clear
? incoming
: messages.concat(incoming))
@ -72,7 +72,7 @@ export default function ({ inbox, currentWindow }) {
? lastInput.offsetTop
: textBufferEl.current.scrollHeight * 2
}, 0)
}, [inbox])
}, [currentWindow, inbox])
const classes = [
isFakeStatus(currentWindow)
@ -85,7 +85,7 @@ export default function ({ inbox, currentWindow }) {
tabindex='0'
ref={textBufferEl}
className={classes}>
{messages.map(TextMessage)}
{messages.map(TextMessage)}
</section>
)
}

View file

@ -32,7 +32,6 @@ export const engineByFilename = filename => {
if (format) {
return format.engine
} else {
throw new Error('Unsupported file type')
}
throw new Error('Unsupported file type')
}