Skip to content

Commit 6c550ba

Browse files
ci: apply automated fixes
1 parent 63d3526 commit 6c550ba

1 file changed

Lines changed: 48 additions & 35 deletions

File tree

  • packages/devtools-ui/src/components

packages/devtools-ui/src/components/tree.tsx

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export function JsonTree<TData, TName extends CollapsiblePaths<TData>>(props: {
1010
defaultExpansionDepth?: number
1111
collapsePaths?: Array<TName>
1212
}) {
13-
1413
return (
1514
<JsonValue
1615
isRoot
@@ -37,25 +36,34 @@ function JsonValue(props: {
3736
collapsePaths?: Array<string>
3837
path: string
3938
}) {
40-
4139
const styles = useStyles()
4240

4341
return (
4442
<span class={styles().tree.valueContainer(props.isRoot ?? false)}>
45-
{props.keyName && typeof props.value !== 'object' && !Array.isArray(props.value) && (
46-
<span class={styles().tree.valueKey}>&quot;{props.keyName}&quot;: </span>
47-
)}
43+
{props.keyName &&
44+
typeof props.value !== 'object' &&
45+
!Array.isArray(props.value) && (
46+
<span class={styles().tree.valueKey}>
47+
&quot;{props.keyName}&quot;:{' '}
48+
</span>
49+
)}
4850
{(() => {
4951
if (typeof props.value === 'string') {
5052
return (
51-
<span class={styles().tree.valueString}>&quot;{props.value}&quot;</span>
53+
<span class={styles().tree.valueString}>
54+
&quot;{props.value}&quot;
55+
</span>
5256
)
5357
}
5458
if (typeof props.value === 'number') {
5559
return <span class={styles().tree.valueNumber}>{props.value}</span>
5660
}
5761
if (typeof props.value === 'boolean') {
58-
return <span class={styles().tree.valueBoolean}>{String(props.value)}</span>
62+
return (
63+
<span class={styles().tree.valueBoolean}>
64+
{String(props.value)}
65+
</span>
66+
)
5967
}
6068
if (props.value === null) {
6169
return <span class={styles().tree.valueNull}>null</span>
@@ -65,7 +73,9 @@ function JsonValue(props: {
6573
}
6674
if (typeof props.value === 'function') {
6775
return (
68-
<span class={styles().tree.valueFunction}>{String(props.value)}</span>
76+
<span class={styles().tree.valueFunction}>
77+
{String(props.value)}
78+
</span>
6979
)
7080
}
7181
if (Array.isArray(props.value)) {
@@ -118,7 +128,8 @@ const ArrayValue = (props: {
118128
const styles = useStyles()
119129

120130
const [expanded, setExpanded] = createSignal(
121-
props.depth <= props.defaultExpansionDepth && !props.collapsePaths?.includes(props.path),
131+
props.depth <= props.defaultExpansionDepth &&
132+
!props.collapsePaths?.includes(props.path),
122133
)
123134

124135
if (props.value.length === 0) {
@@ -207,7 +218,8 @@ const ObjectValue = (props: {
207218
const styles = useStyles()
208219

209220
const [expanded, setExpanded] = createSignal(
210-
props.depth <= props.defaultExpansionDepth && !props.collapsePaths?.includes(props.path),
221+
props.depth <= props.defaultExpansionDepth &&
222+
!props.collapsePaths?.includes(props.path),
211223
)
212224

213225
const keys = Object.keys(props.value)
@@ -301,33 +313,34 @@ const CopyButton = (props: { value: unknown }) => {
301313
<button
302314
class={styles().tree.actionButton}
303315
title="Copy object to clipboard"
304-
aria-label={`${copyState() === 'NoCopy'
305-
? 'Copy object to clipboard'
306-
: copyState() === 'SuccessCopy'
307-
? 'Object copied to clipboard'
308-
: 'Error copying object to clipboard'
309-
}`}
316+
aria-label={`${
317+
copyState() === 'NoCopy'
318+
? 'Copy object to clipboard'
319+
: copyState() === 'SuccessCopy'
320+
? 'Object copied to clipboard'
321+
: 'Error copying object to clipboard'
322+
}`}
310323
onClick={
311324
copyState() === 'NoCopy'
312325
? () => {
313-
navigator.clipboard
314-
.writeText(JSON.stringify(props.value, null, 2))
315-
.then(
316-
() => {
317-
setCopyState('SuccessCopy')
318-
setTimeout(() => {
319-
setCopyState('NoCopy')
320-
}, 1500)
321-
},
322-
(err) => {
323-
console.error('Failed to copy: ', err)
324-
setCopyState('ErrorCopy')
325-
setTimeout(() => {
326-
setCopyState('NoCopy')
327-
}, 1500)
328-
},
329-
)
330-
}
326+
navigator.clipboard
327+
.writeText(JSON.stringify(props.value, null, 2))
328+
.then(
329+
() => {
330+
setCopyState('SuccessCopy')
331+
setTimeout(() => {
332+
setCopyState('NoCopy')
333+
}, 1500)
334+
},
335+
(err) => {
336+
console.error('Failed to copy: ', err)
337+
setCopyState('ErrorCopy')
338+
setTimeout(() => {
339+
setCopyState('NoCopy')
340+
}, 1500)
341+
},
342+
)
343+
}
331344
: undefined
332345
}
333346
>
@@ -357,7 +370,7 @@ const Expander = (props: { expanded: boolean; onClick: () => void }) => {
357370
transform: rotate(${props.expanded ? 90 : 0}deg);
358371
`,
359372
props.expanded &&
360-
css`
373+
css`
361374
& svg {
362375
top: -1px;
363376
}

0 commit comments

Comments
 (0)