Skip to content

Commit

Permalink
fix: biome lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiu8081 committed Dec 18, 2023
1 parent 78452ea commit d66fec2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 1 addition & 5 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentSize": 2,
"lineWidth": 180
"indentWidth": 2
},
"javascript": {
"formatter": {
Expand All @@ -16,9 +15,6 @@
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noImplicitBoolean": "off"
},
"suspicious": {
"noExplicitAny": "off"
}
Expand Down
10 changes: 7 additions & 3 deletions example/browser/src.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@ import { startListen } from 'blive-message-listener/browser'
import type { MsgHandler } from 'blive-message-listener'

const logDom = document.getElementById('log')
if (!logDom) {
throw new Error('log dom not found')
}

const handler: MsgHandler = {
onStartListen: () => {
console.log('start listen')
logDom!.innerHTML += 'start listen<br>'
logDom.innerHTML += 'start listen<br>'
},
onIncomeDanmu: (msg) => {
console.log(msg)
logDom!.innerHTML += `${JSON.stringify(msg.body)}<br>`
logDom.innerHTML += `${JSON.stringify(msg.body)}<br>`
},
raw: {

INTERACT_WORD: (msg) => {
console.log(msg)
logDom!.innerHTML += `${JSON.stringify(msg)}<br>`
logDom.innerHTML += `${JSON.stringify(msg)}<br>`
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions src/listener/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ export const listenAll = (instance: KeepLiveTCP | KeepLiveWS | KeepLiveWSB, room
}

// Rest raw events
rawHandlerNames.forEach((eventName) => {
for (const eventName of rawHandlerNames) {
instance.on(eventName as any, (data: WSMessage<any>) => {
rawHandler[eventName](data.data)
rawHandler[eventName]?.(data.data)
})
})
}
}
8 changes: 4 additions & 4 deletions src/parser/INTERACT_WORD_ENTRY_EFFECT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ const parser = (data: any, roomId: number): UserActionMsg => {
const msgType = data.cmd
if (msgType === 'ENTRY_EFFECT') {
return parserGuard(data, roomId)
} else if (msgType === 'LIKE_INFO_V3_CLICK') {
}
if (msgType === 'LIKE_INFO_V3_CLICK') {
return parserLike(data, roomId)
} else {
// INTERACT_WORD
return parserNormal(data, roomId)
}
// INTERACT_WORD
return parserNormal(data, roomId)
}

export const INTERACT_WORD = {
Expand Down

0 comments on commit d66fec2

Please sign in to comment.