mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-29 04:35:32 +08:00
style: remove warning from eslint
This commit is contained in:
@@ -7,6 +7,7 @@ interface Props {
|
|||||||
const TreeIndents: React.FC<Props> = ({ count }) => {
|
const TreeIndents: React.FC<Props> = ({ count }) => {
|
||||||
if (count === 0) return null
|
if (count === 0) return null
|
||||||
return (
|
return (
|
||||||
|
/* eslint-disable react/jsx-no-useless-fragment */
|
||||||
<>
|
<>
|
||||||
{[...new Array(count)].map((_, index) => (
|
{[...new Array(count)].map((_, index) => (
|
||||||
<span className="indent" key={`indent-${index}`}>
|
<span className="indent" key={`indent-${index}`}>
|
||||||
@@ -18,6 +19,7 @@ const TreeIndents: React.FC<Props> = ({ count }) => {
|
|||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
|
/* eslint-enable */
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ const makeChildren = (value: Array<FileTreeValue> = []) => {
|
|||||||
return `${a.name}`.charCodeAt(0) - `${b.name}`.charCodeAt(0)
|
return `${a.name}`.charCodeAt(0) - `${b.name}`.charCodeAt(0)
|
||||||
})
|
})
|
||||||
.map((item, index) => {
|
.map((item, index) => {
|
||||||
if (item.type === directoryType) return (
|
if (item.type === directoryType) return (
|
||||||
<TreeFolder name={item.name} extra={item.extra} key={`folder-${item.name}-${index}`}>
|
<TreeFolder name={item.name} extra={item.extra} key={`folder-${item.name}-${index}`}>
|
||||||
{makeChildren(item.files)}
|
{makeChildren(item.files)}
|
||||||
</TreeFolder>
|
</TreeFolder>
|
||||||
)
|
)
|
||||||
return <TreeFile name={item.name} extra={item.extra} key={`file-${item.name}-${index}`} />
|
return <TreeFile name={item.name} extra={item.extra} key={`file-${item.name}-${index}`} />
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const Tree: React.FC<React.PropsWithChildren<TreeProps>> = ({
|
const Tree: React.FC<React.PropsWithChildren<TreeProps>> = ({
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ export const setChildrenProps = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ShapeType = {
|
export type ShapeType = {
|
||||||
width: number,
|
width: number
|
||||||
height: number,
|
height: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getRealShape = (el: HTMLElement | null): ShapeType => {
|
export const getRealShape = (el: HTMLElement | null): ShapeType => {
|
||||||
|
|||||||
Reference in New Issue
Block a user