Skip to content

Commit caad233

Browse files
committed
disable rule that force explicit .toString()
1 parent c0cb787 commit caad233

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

packages/components/eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export default tseslint.config(
7171
}],
7272

7373
'space-infix-ops': 'error',
74+
75+
"@typescript-eslint/restrict-template-expressions": "off"
7476
},
7577
},
7678
{

packages/components/src/components/Folder.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function Folder({ folderKey }: FolderProps) {
2525
useEffect(() => {
2626
listFiles(prefix)
2727
.then(setFiles)
28-
.catch((error:unknown) => {
28+
.catch((error: unknown) => {
2929
setFiles([])
3030
setError(error)
3131
})

packages/components/src/components/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function Layout({ children, className, progress, error, title }:
3838
</div>
3939
{progress !== undefined && progress < 1 &&
4040
<div className={'progress-bar'} role='progressbar'>
41-
<div style={{ width: `${(100 * progress).toString()}%` }} />
41+
<div style={{ width: `${100 * progress}%` }} />
4242
</div>
4343
}
4444
</main>

packages/components/src/components/Markdown.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Markdown({ text, className }: MarkdownProps) {
2323
// Code blocks
2424
if (line.startsWith('```')) {
2525
if (inCodeBlock) {
26-
elements.push(<pre key={`code-${i.toString()}`}>{codeBlock.join('\n')}</pre>)
26+
elements.push(<pre key={`code-${i}`}>{codeBlock.join('\n')}</pre>)
2727
inCodeBlock = false
2828
codeBlock = []
2929
} else {
@@ -62,7 +62,7 @@ export default function Markdown({ text, className }: MarkdownProps) {
6262
if (line.startsWith('#')) {
6363
const level = line.split(' ')[0].length
6464
const text = line.slice(level + 1)
65-
const HeaderTag = `h${level.toString()}` as keyof JSX.IntrinsicElements
65+
const HeaderTag = `h${level}` as keyof JSX.IntrinsicElements
6666
elements.push(<HeaderTag key={i}>{text}</HeaderTag>)
6767
continue
6868
}
@@ -77,7 +77,7 @@ export default function Markdown({ text, className }: MarkdownProps) {
7777

7878
// Links
7979
if (line.includes('[') && line.includes(']') && line.includes('(') && line.includes(')')) {
80-
const linkedLine = line.replace(/\[(.*?)\]\((.*?)\)/g, (_, linkText: string, url: string) => {
80+
const linkedLine = line.replace(/\[(.*?)\]\((.*?)\)/g, (_, linkText, url) => {
8181
return `<a href="${url}">${linkText}</a>`
8282
})
8383
elements.push(<p dangerouslySetInnerHTML={{ __html: linkedLine }} key={i}></p>)
@@ -87,13 +87,13 @@ export default function Markdown({ text, className }: MarkdownProps) {
8787
// Lists
8888
if (line.startsWith('-') || line.startsWith('*') || line.startsWith('+')) {
8989
const listItem = line.slice(1).trim()
90-
listItems.push(<li key={`list-item-${i.toString()}`}>{listItem}</li>)
90+
listItems.push(<li key={`list-item-${i}`}>{listItem}</li>)
9191
inList = true
9292
continue
9393
}
9494

9595
if (inList && listItems.length > 0) {
96-
elements.push(<ul key={`list-${i.toString()}`}>{listItems}</ul>)
96+
elements.push(<ul key={`list-${i}`}>{listItems}</ul>)
9797
listItems = []
9898
inList = false
9999
}
@@ -104,12 +104,12 @@ export default function Markdown({ text, className }: MarkdownProps) {
104104

105105
// Flush any remaining code block
106106
if (inCodeBlock && codeBlock.length > 0) {
107-
elements.push(<pre key={`code-${lines.length.toString()}`}>{codeBlock.join('\n')}</pre>)
107+
elements.push(<pre key={`code-${lines.length}`}>{codeBlock.join('\n')}</pre>)
108108
}
109109

110110
// Flush any remaining list items
111111
if (inList && listItems.length > 0) {
112-
elements.push(<ul key={`list-${lines.length.toString()}`}>{listItems}</ul>)
112+
elements.push(<ul key={`list-${lines.length}`}>{listItems}</ul>)
113113
}
114114

115115
return <div className={className}>{elements}</div>

packages/components/src/lib/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function listFiles(prefix: string, recursive?: boolean): Promise<Fi
2929
if (res.ok) {
3030
return await res.json() as FileMetadata[]
3131
} else {
32-
throw new Error(`file list error ${res.status.toString()} ${await res.text()}`)
32+
throw new Error(`file list error ${res.status} ${await res.text()}`)
3333
}
3434
}
3535

0 commit comments

Comments
 (0)