Skip to content

Commit c0aaf41

Browse files
committed
refactor: update to linter etc
Signed-off-by: Christian Stewart <[email protected]>
1 parent 3def600 commit c0aaf41

File tree

5 files changed

+34
-37
lines changed

5 files changed

+34
-37
lines changed

src/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { useEffect, useState } from 'react'
2-
import { useWebSocket } from './useWebSocket'
32
import { WebSocketConn } from 'starpc'
3+
import { useWebSocket } from './useWebSocket.js'
44
import { RgraphqlDemoClient } from '../app/service/service_srpc.pb.js'
55
import { RGQLClientMessage, Client as RGraphQLClient } from 'rgraphql'
66
import { pushable } from 'it-pushable'
7-
import { pipe } from 'it-pipe'
87

98
import './App.css'
109
import { buildAppSchema } from './schema.js'

src/useWebSocket.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,22 @@ export const useWebSocket = (url: string) => {
6262
error: 'Connection error occurred',
6363
})
6464
}
65+
66+
return socket
6567
} catch (error) {
6668
console.error('Failed to create WebSocket:', error)
69+
return undefined
6770
}
6871
}, [url])
6972

7073
useEffect(() => {
71-
connect()
74+
const socket = connect()
7275

7376
return () => {
7477
if (reconnectTimeoutRef.current) {
7578
clearTimeout(reconnectTimeoutRef.current)
7679
}
77-
ws?.close()
80+
socket?.close()
7881
}
7982
}, [connect])
8083

tsconfig.app.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

tsconfig.json

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
11
{
2-
"files": [],
3-
"references": [
4-
{ "path": "./tsconfig.app.json" },
5-
{ "path": "./tsconfig.node.json" }
6-
]
2+
"compilerOptions": {
3+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4+
"target": "ES2020",
5+
"useDefineForClassFields": true,
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"module": "ESNext",
8+
"skipLibCheck": true,
9+
"baseUrl": "./",
10+
11+
"moduleResolution": "bundler",
12+
"allowImportingTsExtensions": true,
13+
"isolatedModules": true,
14+
"moduleDetection": "force",
15+
"noEmit": true,
16+
"jsx": "react-jsx",
17+
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true,
22+
"noUncheckedSideEffectImports": true,
23+
24+
"paths": {
25+
"@go/*": ["vendor/*"]
26+
}
27+
},
28+
"include": ["src"]
729
}

tsconfig.node.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"lib": ["ES2023"],
66
"module": "ESNext",
77
"skipLibCheck": true,
8+
"baseUrl": "./",
89

910
"moduleResolution": "bundler",
1011
"allowImportingTsExtensions": true,

0 commit comments

Comments
 (0)