Skip to content

Commit 3d25f9a

Browse files
committed
lint
1 parent ed9ccb0 commit 3d25f9a

File tree

1 file changed

+12
-9
lines changed
  • packages/webui/src/client/ui/Prompter/Formatted/mdParser

1 file changed

+12
-9
lines changed

packages/webui/src/client/ui/Prompter/Formatted/mdParser/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ export class ParserStateImpl implements ParserState {
1515
charCursor: number = 0
1616
readonly dataStore: Record<string, unknown> = {}
1717

18-
constructor(private document: RootNode, private text: string) {}
18+
constructor(
19+
private document: RootNode,
20+
private text: string
21+
) {}
1922

20-
flushBuffer = () => {
23+
flushBuffer = (): void => {
2124
if (this.buffer === '') return
2225
if (this.nodeCursor === null) throw new Error('No node available to flush buffer.')
2326

@@ -27,14 +30,14 @@ export class ParserStateImpl implements ParserState {
2730
})
2831
this.buffer = ''
2932
}
30-
setMarker = () => {
33+
setMarker = (): void => {
3134
if (this.nodeCursor === null) throw new Error('No node available to flush buffer.')
3235

3336
this.nodeCursor.children.push({
3437
type: 'screenMarker',
3538
})
3639
}
37-
pushNode = (node: ParentNodeBase) => {
40+
pushNode = (node: ParentNodeBase): void => {
3841
if (this.nodeCursor === null) {
3942
this.nodeCursor = node
4043
} else {
@@ -43,20 +46,20 @@ export class ParserStateImpl implements ParserState {
4346
this.nodeStack.push(node)
4447
this.nodeCursor = node
4548
}
46-
popNode = () => {
49+
popNode = (): void => {
4750
this.nodeStack.pop()
4851
this.nodeCursor = this.nodeStack[this.nodeStack.length - 1]
4952
}
50-
replaceStack = (node: ParentNodeBase) => {
53+
replaceStack = (node: ParentNodeBase): void => {
5154
this.document.children.push(node as Node)
5255
this.nodeCursor = node
5356
this.nodeStack.length = 0
5457
this.nodeStack.push(this.nodeCursor)
5558
}
56-
peek = (n = 1) => {
59+
peek = (n = 1): string => {
5760
return this.text.slice(this.charCursor + 1, this.charCursor + n + 1)
5861
}
59-
consume = () => {
62+
consume = (): string => {
6063
if (this.text[this.charCursor + 1] === undefined) throw new Error('No more text available to parse')
6164
this.charCursor++
6265
return this.text[this.charCursor]
@@ -79,7 +82,7 @@ export default function createParser(): Parser {
7982
const charHandlers: Record<string, CharHandler[]> = {}
8083

8184
for (const construct of nodeConstructs) {
82-
for (const [char, handler] of Object.entries(construct.char)) {
85+
for (const [char, handler] of Object.entries<CharHandler>(construct.char)) {
8386
if (!charHandlers[char]) charHandlers[char] = []
8487
charHandlers[char].push(handler)
8588
}

0 commit comments

Comments
 (0)