-
Notifications
You must be signed in to change notification settings - Fork 3
Biome showcase #13
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
base: main
Are you sure you want to change the base?
Biome showcase #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,15 @@ | ||||||||||||||||||
function greet(name: string) { | ||||||||||||||||||
console.log("Hello, " + name) | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
let unused = 123 | ||||||||||||||||||
|
||||||||||||||||||
const x = 1 | ||||||||||||||||||
x = 2 | ||||||||||||||||||
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix const reassignment error. You cannot reassign a value to a constant. This will cause a compilation error. -const x = 1
-x = 2
+let x = 1
+x = 2 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (1.9.4)[error] 7-8: Can't assign x because it's a constant This is where the variable is defined as constant Unsafe fix: Replace const with let if you assign it to a new value. (lint/correctness/noConstAssign) 🤖 Prompt for AI Agents
|
||||||||||||||||||
|
||||||||||||||||||
const items = [1, 2, 3] | ||||||||||||||||||
items.forEach(async item => { | ||||||||||||||||||
await fetch(`/api/${item}`) | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling to fetch calls. The fetch call lacks error handling, which could cause unhandled promise rejections. - await fetch(`/api/${item}`)
+ await fetch(`/api/${item}`).catch(error => {
+ console.error(`Failed to fetch /api/${item}:`, error)
+ }) 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||
}) | ||||||||||||||||||
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Replace forEach with Promise.all for async operations. Using -items.forEach(async item => {
- await fetch(`/api/${item}`)
-})
+await Promise.all(items.map(async item => {
+ return fetch(`/api/${item}`)
+})) 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||
|
||||||||||||||||||
greet("world") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove unused variable.
The
unused
variable is declared but never used in the code.-let unused = 123
📝 Committable suggestion
🤖 Prompt for AI Agents