1- import { devtoolsEventClient } from '@tanstack/devtools-vite/ client'
1+ import { devtoolsEventClient } from '@tanstack/devtools-client'
22import { useEffect , useState } from 'react'
33import type { CSSProperties } from 'react'
44
@@ -22,12 +22,10 @@ export const PackageJsonPanel = () => {
2222 setPackageJson ( event . payload . packageJson )
2323 setOutdatedDeps ( event . payload . outdatedDeps || { } )
2424 } )
25- return ( ) => {
26- off ?.( )
27- }
25+ return off
2826 } , [ ] )
2927
30- const hasOutdated = Object . keys ( outdatedDeps || { } ) . length > 0
28+ const hasOutdated = Object . keys ( outdatedDeps ) . length > 0
3129
3230 // Helpers
3331 const stripRange = ( v ?: string ) => ( v ?? '' ) . replace ( / ^ [ ~ ^ > < = v \s ] * / , '' )
@@ -120,7 +118,12 @@ export const PackageJsonPanel = () => {
120118 dep : string
121119 specified : string
122120 } ) => {
123- const info = outdatedDeps [ dep ]
121+ const info = outdatedDeps [ dep ] as {
122+ current : string
123+ wanted : string
124+ latest : string
125+ type ?: 'dependencies' | 'devDependencies'
126+ } | undefined
124127 const current = info ?. current ?? specified
125128 const latest = info ?. latest
126129 const dt = info ? diffType ( current , latest ) : null
@@ -140,7 +143,12 @@ export const PackageJsonPanel = () => {
140143 }
141144
142145 const UpgradeRowActions = ( { name } : { name : string } ) => {
143- const info = outdatedDeps [ name ]
146+ const info = outdatedDeps [ name ] as {
147+ current : string
148+ wanted : string
149+ latest : string
150+ type ?: 'dependencies' | 'devDependencies'
151+ } | undefined
144152 if ( ! info ) return null
145153 return (
146154 < div style = { { display : 'flex' , gap : 6 } } >
@@ -163,7 +171,7 @@ export const PackageJsonPanel = () => {
163171 )
164172 }
165173
166- const makeLists = ( names ?: string [ ] ) => {
174+ const makeLists = ( names ?: Array < string > ) => {
167175 const entries = Object . entries ( outdatedDeps ) . filter (
168176 ( [ n ] ) => ! names || names . includes ( n ) ,
169177 )
@@ -178,7 +186,7 @@ export const PackageJsonPanel = () => {
178186 return { wantedList, latestList }
179187 }
180188
181- const BulkActions = ( { names } : { names ?: string [ ] } ) => {
189+ const BulkActions = ( { names } : { names ?: Array < string > } ) => {
182190 const { wantedList, latestList } = makeLists ( names )
183191 if ( wantedList . length === 0 && latestList . length === 0 ) return null
184192 return (
@@ -202,6 +210,7 @@ export const PackageJsonPanel = () => {
202210
203211 const renderDeps = ( title : string , deps ?: Record < string , string > ) => {
204212 const names = Object . keys ( deps || { } )
213+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
205214 const someOutdatedInSection = names . some ( ( n ) => ! ! outdatedDeps [ n ] )
206215 return (
207216 < div style = { sectionStyle } >
@@ -227,13 +236,18 @@ export const PackageJsonPanel = () => {
227236 </ thead >
228237 < tbody >
229238 { Object . entries ( deps || { } ) . map ( ( [ dep , version ] ) => {
230- const info = outdatedDeps [ dep ]
239+ const info = outdatedDeps [ dep ] as {
240+ current : string
241+ wanted : string
242+ latest : string
243+ type ?: 'dependencies' | 'devDependencies'
244+ } | undefined
231245 const isOutdated = ! ! info && info . current !== info . latest
232246 return (
233247 < tr key = { dep } >
234248 < td style = { thtd } > { dep } </ td >
235249 < td style = { thtd } >
236- < VersionCell dep = { dep } specified = { version as string } />
250+ < VersionCell dep = { dep } specified = { version } />
237251 </ td >
238252 < td style = { thtd } >
239253 { isOutdated
0 commit comments