style: remove warning from eslint

This commit is contained in:
unix
2020-03-25 12:59:15 +08:00
parent 42e47f3210
commit fe64d20760
3 changed files with 11 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ interface Props {
const TreeIndents: React.FC<Props> = ({ count }) => {
if (count === 0) return null
return (
/* eslint-disable react/jsx-no-useless-fragment */
<>
{[...new Array(count)].map((_, index) => (
<span className="indent" key={`indent-${index}`}>
@@ -18,6 +19,7 @@ const TreeIndents: React.FC<Props> = ({ count }) => {
</span>
))}
</>
/* eslint-enable */
)
}

View File

@@ -42,13 +42,13 @@ const makeChildren = (value: Array<FileTreeValue> = []) => {
return `${a.name}`.charCodeAt(0) - `${b.name}`.charCodeAt(0)
})
.map((item, index) => {
if (item.type === directoryType) return (
<TreeFolder name={item.name} extra={item.extra} key={`folder-${item.name}-${index}`}>
{makeChildren(item.files)}
</TreeFolder>
)
return <TreeFile name={item.name} extra={item.extra} key={`file-${item.name}-${index}`} />
})
if (item.type === directoryType) return (
<TreeFolder name={item.name} extra={item.extra} key={`folder-${item.name}-${index}`}>
{makeChildren(item.files)}
</TreeFolder>
)
return <TreeFile name={item.name} extra={item.extra} key={`file-${item.name}-${index}`} />
})
}
const Tree: React.FC<React.PropsWithChildren<TreeProps>> = ({

View File

@@ -82,8 +82,8 @@ export const setChildrenProps = (
}
export type ShapeType = {
width: number,
height: number,
width: number
height: number
}
export const getRealShape = (el: HTMLElement | null): ShapeType => {