Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] biome-ignore を解決する #561

Closed
wants to merge 10 commits into from
22 changes: 13 additions & 9 deletions examples/messaging/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,23 @@ document.addEventListener('DOMContentLoaded', async () => {
if (statsDiv && statsReportJsonDiv) {
let statsHtml = ''
const statsReportJson: Record<string, unknown>[] = []
// biome-ignore lint/complexity/noForEach: <explanation>
statsReport.forEach((report) => {
for (const [_index, report] of statsReport.entries()) {
// キャプションになる Type を表示する
statsHtml += `<h3>Type: ${report.type}</h3><ul>`
// 同時に、stats の内容を JSON に変換する
const reportJson: Record<string, unknown> = { id: report.id, type: report.type }
for (const [key, value] of Object.entries(report)) {
if (key !== 'type' && key !== 'id') {
statsHtml += `<li><strong>${key}:</strong> ${value}</li>`
reportJson[key] = value
}
}
// 子項目の表示と JSON へ追加を行う
statsHtml += Object.entries(report)
.map(([key, value]) => {
if (key !== 'type' && key !== 'id') {
reportJson[key] = value
return `<li><strong>${key}:</strong> ${value}</li>`
}
})
.join('')
statsHtml += '</ul>'
statsReportJson.push(reportJson)
})
}
statsDiv.innerHTML = statsHtml
// データ属性としても保存(オプション)
statsDiv.dataset.statsReportJson = JSON.stringify(statsReportJson)
Expand Down
Loading
Loading