Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Preview/oxlint #26

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

Closed
alexcoderabbitai wants to merge 6 commits into main from preview/oxlint
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coderabbit.yml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
reviews:
tools:
# oxlint does not run if biome is enabled
biome:
enabled: false
14 changes: 14 additions & 0 deletions .oxlintrc.json
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"rules": {
"typescript": "error",
"correctness": "error",
"suspicious": "error",
"perf": "warn",
"style": "warn"
},
"env": {
"browser": true,
"es2021": true,
"node": true
}
}
16 changes: 16 additions & 0 deletions test.ts
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function greet(name: string) {
console.log("Hello, " + name)
}

let unused = 123

const x = 1
x = 2

const items = [1, 2, 3]
items.forEach(async item => {
await fetch(`/api/${item}`)
})
Copy link

@coderabbitai coderabbitai bot Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace forEach with for-of loop for async operations.

Using async callbacks with forEach doesn't work as expected since forEach doesn't await the promises. The async callbacks will run concurrently without proper sequencing.

-items.forEach(async item => {
- await fetch(`/api/${item}`)
-})
+for (const item of items) {
+ await fetch(`/api/${item}`)
+}

Alternatively, if concurrent execution is desired:

-items.forEach(async item => {
- await fetch(`/api/${item}`)
-})
+await Promise.all(items.map(async item => {
+ await fetch(`/api/${item}`)
+}))
🤖 Prompt for AI Agents
In test.ts around lines 11 to 13, the use of forEach with an async callback does
not properly await the asynchronous operations, causing them to run concurrently
without sequencing. Replace the forEach loop with a for-of loop to properly
await each fetch call sequentially. This ensures that each asynchronous
operation completes before moving to the next iteration.


greet("world")

AltStyle によって変換されたページ (->オリジナル) /