Skip to content

Commit 3adf4a6

Browse files
ci: apply automated fixes
1 parent 470069a commit 3adf4a6

File tree

10 files changed

+48
-54
lines changed

10 files changed

+48
-54
lines changed

examples/react/basic/src/index.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,26 @@ queryPlugin.on('test', (event) => {
1616
})
1717

1818
function App() {
19-
const [value, setValue] = useState<any>(({
20-
initial: "value",
21-
should: "change",
19+
const [value, setValue] = useState<any>({
20+
initial: 'value',
21+
should: 'change',
2222
in: 2,
23-
array: [
24-
1, 2, 3
25-
]
26-
}))
23+
array: [1, 2, 3],
24+
})
2725
useEffect(() => {
2826
setTimeout(() => {
29-
setValue(({ title: 'Test Event', description: 'This is a test event.' }))
27+
setValue({ title: 'Test Event', description: 'This is a test event.' })
3028
}, 2000)
3129
}, [])
3230
// console.log('Current value:', value)
3331
return (
3432
<div>
3533
<h1>TanStack Devtools React Basic Example</h1>
36-
<tsd-json-tree
37-
value={JSON.stringify(value)}
38-
/>
34+
<tsd-json-tree value={JSON.stringify(value)} />
3935
<Devtools />
4036
</div>
4137
)
4238
}
4339

44-
4540
const root = createRoot(document.getElementById('root')!)
4641
root.render(<App />)

examples/solid/basic/src/setup.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ const rootRoute = createRootRoute({
2222
About
2323
</Link>
2424
</div>
25-
<tsd-json-tree value={{ title: 'Test Event', description: 'This is a test event.' }} />
25+
<tsd-json-tree
26+
value={{ title: 'Test Event', description: 'This is a test event.' }}
27+
/>
2628
<hr />
2729
<Outlet />
2830
</>
@@ -44,7 +46,6 @@ function About() {
4446
return (
4547
<div class="p-2">
4648
<h3>Hello from About!</h3>
47-
4849
</div>
4950
)
5051
}

packages/devtools-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@
7676
"vite-plugin-solid": "^2.11.6",
7777
"@types/react": "19.1.10"
7878
}
79-
}
79+
}

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { For, Show, createEffect, createSignal } from 'solid-js'
22
import clsx from 'clsx'
3-
import { customElement, noShadowDOM } from "solid-element"
3+
import { customElement, noShadowDOM } from 'solid-element'
44
import { useStyles } from '../styles/use-styles'
55

66
export function JsonTree(props: { value: any }) {
7-
87
return <JsonValue isRoot value={props.value} />
98
}
109

@@ -168,32 +167,33 @@ const ObjectValue = ({
168167
)
169168
}
170169

171-
172-
export const registerJsonTreeComponent = (elName: string = "tsd-json-tree") => customElement(elName, { value: {}, }, (props, { element }) => {
173-
noShadowDOM()
174-
function getValue(value: any) {
175-
176-
if (typeof value === 'string') {
177-
try {
178-
const parsedValue = JSON.parse(value)
179-
return parsedValue
180-
} catch (e) {
181-
return value
170+
export const registerJsonTreeComponent = (elName: string = 'tsd-json-tree') =>
171+
customElement(elName, { value: {} }, (props, { element }) => {
172+
noShadowDOM()
173+
function getValue(value: any) {
174+
if (typeof value === 'string') {
175+
try {
176+
const parsedValue = JSON.parse(value)
177+
return parsedValue
178+
} catch (e) {
179+
return value
180+
}
182181
}
182+
return value
183183
}
184-
return value
185-
}
186-
const [value, setValue] = createSignal(getValue(props.value))
184+
const [value, setValue] = createSignal(getValue(props.value))
187185

188-
createEffect(() => {
189-
element.addPropertyChangedCallback((name, value) => {
190-
if (name === "value") {
191-
const finalValue = getValue(value)
192-
setValue(finalValue)
193-
}
186+
createEffect(() => {
187+
element.addPropertyChangedCallback((name, value) => {
188+
if (name === 'value') {
189+
const finalValue = getValue(value)
190+
setValue(finalValue)
191+
}
192+
})
194193
})
194+
return (
195+
<Show keyed when={value()}>
196+
<JsonTree value={value()} />
197+
</Show>
198+
)
195199
})
196-
return <Show keyed when={value()}><JsonTree value={value()} /></Show>
197-
})
198-
199-

packages/devtools-ui/src/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { } from "react";
2-
import type { } from "solid-js";
1+
import type {} from 'react'
2+
import type {} from 'solid-js'
33

44
declare module 'react' {
55
// eslint-disable-next-line @typescript-eslint/no-namespace
66
namespace JSX {
77
interface IntrinsicElements {
8-
'tsd-json-tree': { value: any, }
8+
'tsd-json-tree': { value: any }
99
}
1010
}
1111
}
@@ -20,4 +20,4 @@ declare module 'solid-js' {
2020
}
2121

2222
type _ = string
23-
export type { _ }
23+
export type { _ }

packages/devtools-ui/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const config = defineConfig({
1919
export default mergeConfig(
2020
config,
2121
tanstackViteConfig({
22-
entry: ['./src/index.ts', "./src/types.ts"],
22+
entry: ['./src/index.ts', './src/types.ts'],
2323
srcDir: './src',
2424
}),
2525
)

packages/devtools/src/core.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import type {
1010
TanStackDevtoolsPlugin,
1111
} from './context/devtools-context'
1212

13-
1413
export interface TanStackDevtoolsInit {
1514
/**
1615
* Configuration for the devtools shell. These configuration options are used to set the
@@ -71,7 +70,7 @@ export class TanStackDevtoolsCore {
7170
const Devtools = this.#Component
7271
this.#eventBus = new ClientEventBus(this.#eventBusConfig)
7372
this.#eventBus.start()
74-
registerJsonTreeComponent();
73+
registerJsonTreeComponent()
7574
return (
7675
<DevtoolsProvider plugins={this.#plugins} config={this.#config}>
7776
<Portal mount={mountTo}>

packages/devtools/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { _ } from "@tanstack/devtools-ui/types"
1+
import type { _ } from '@tanstack/devtools-ui/types'
22

33
export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './constants'
44
export { TanStackDevtoolsCore } from './core'

packages/react-devtools/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import * as Devtools from './devtools'
55
export const TanStackDevtools: (typeof Devtools)['TanStackDevtools'] =
66
process.env.NODE_ENV !== 'development'
77
? function () {
8-
return null
9-
}
8+
return null
9+
}
1010
: Devtools.TanStackDevtools
1111

1212
export type {
1313
TanStackDevtoolsReactPlugin,
1414
TanStackDevtoolsReactInit,
15-
1615
} from './devtools'

packages/solid-devtools/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as Devtools from './devtools'
44
export const TanStackDevtools: (typeof Devtools)['TanStackDevtools'] = isDev
55
? Devtools.TanStackDevtools
66
: function () {
7-
return null
8-
}
7+
return null
8+
}
99

1010
export type { TanStackDevtoolsSolidPlugin } from './core'

0 commit comments

Comments
 (0)