mirror of
https://github.com/zhigang1992/react.git
synced 2026-01-28 22:30:13 +08:00
style: remove warning from eslint
This commit is contained in:
@@ -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 */
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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>> = ({
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user