Skip to content

Commit

Permalink
some lint and typecheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Mar 6, 2024
1 parent c8373f5 commit 4d9314f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app-shell/src/system-info/__tests__/usb-devices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { createLogger } from '../../log'
import { createUsbDeviceMonitor, getWindowsDriverVersion } from '../usb-devices'
import { isWindows } from '../../os'


vi.mock('execa')
vi.mock('usb')
vi.mock('electron-store')
Expand Down Expand Up @@ -87,6 +86,7 @@ if (!isWindows()) {
const mfrIterator = getManufacturerIterator()
const productIterator = getProductIterator()
vi.mocked(usb.getDeviceList).mockReturnValueOnce(mockDevices)
// @ts-expect-error Revisit after Vite migration.
vi.mocked(usb.Device).mockImplementation((descriptorId, callback) =>
callback(
undefined,
Expand Down Expand Up @@ -143,7 +143,7 @@ if (!isWindows()) {
}
})
createUsbDeviceMonitor({ onDeviceAdd })
// @ts-expect-error
// @ts-expect-error Revisit after Vite migration.
vi.mocked(usb.Device).mockImplementation((descriptorId, callback) =>
callback(undefined, ['sn1', 'mfr1', 'pn1'][descriptorId])
)
Expand Down
31 changes: 14 additions & 17 deletions app/src/App/OnDeviceDisplayApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { ConnectViaWifi } from '../pages/ConnectViaWifi'
import { EmergencyStop } from '../pages/EmergencyStop'
import { NameRobot } from '../pages/NameRobot'
import { NetworkSetupMenu } from '../pages/NetworkSetupMenu'
import { PrivacyPolicy } from '../pages/PrivacyPolicy'
import { ProtocolSetup } from '../pages/ProtocolSetup'
import { RobotDashboard } from '../pages/RobotDashboard'
import { RobotSettingsDashboard } from '../pages/RobotSettingsDashboard'
Expand Down Expand Up @@ -61,7 +60,6 @@ import type { Dispatch } from '../redux/types'
// network calls to localhost. see ./hacks.ts for more.
hackWindowNavigatorOnLine()


export const ON_DEVICE_DISPLAY_PATHS = [
'/dashboard',
'/deck-configuration',
Expand All @@ -85,7 +83,9 @@ export const ON_DEVICE_DISPLAY_PATHS = [
'/welcome',
] as const

function getPathComponent(path: typeof ON_DEVICE_DISPLAY_PATHS[number]): JSX.Element {
function getPathComponent(
path: typeof ON_DEVICE_DISPLAY_PATHS[number]
): JSX.Element {
switch (path) {
case '/dashboard':
return <RobotDashboard />
Expand Down Expand Up @@ -152,10 +152,9 @@ export const OnDeviceDisplayApp = (): JSX.Element => {
const dispatch = useDispatch<Dispatch>()
const isIdle = useIdle(sleepTime, options)
const [currentNode, setCurrentNode] = React.useState<null | HTMLElement>(null)
const scrollRef = React.useCallback(
(node: HTMLElement | null) => { setCurrentNode(node) },
[]
)
const scrollRef = React.useCallback((node: HTMLElement | null) => {
setCurrentNode(node)
}, [])
const isScrolling = useScrolling(currentNode)

const TOUCH_SCREEN_STYLE = css`
Expand Down Expand Up @@ -206,16 +205,14 @@ export const OnDeviceDisplayApp = (): JSX.Element => {
<ToasterOven>
<ProtocolReceiptToasts />
<Switch>
{ON_DEVICE_DISPLAY_PATHS.map(
path => (
<Route key={path} exact path={path}>
<Box css={TOUCH_SCREEN_STYLE} ref={scrollRef}>
<ModalPortalRoot />
{getPathComponent(path)}
</Box>
</Route>
)
)}
{ON_DEVICE_DISPLAY_PATHS.map(path => (
<Route key={path} exact path={path}>
<Box css={TOUCH_SCREEN_STYLE} ref={scrollRef}>
<ModalPortalRoot />
{getPathComponent(path)}
</Box>
</Route>
))}
<Redirect exact from="/" to={'/loading'} />
</Switch>
</ToasterOven>
Expand Down
1 change: 1 addition & 0 deletions tsconfig-eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"react-api-client/src",
"usb-bridge/node-client/src",
"**/*.js",
"**/*.ts",
"*.js",
".*.js",
"**/*.json"
Expand Down
2 changes: 2 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable @typescript-eslint/triple-slash-reference */
/// <reference types="vitest" />
/// <reference types="vite/client" />
import path from 'path'
import { configDefaults, defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config'

// eslint-disable-next-line import/no-default-export
export default mergeConfig(
viteConfig,
defineConfig({
Expand Down

0 comments on commit 4d9314f

Please sign in to comment.