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

Oxlint #24

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
nimratcoderabbit wants to merge 5 commits into main from preview/oxlint
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
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
Comment on lines +7 to +8
Copy link

@coderabbitai coderabbitai bot Jul 14, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix const reassignment error.

You cannot reassign a value to a const variable. This will cause a compile-time error.

-const x = 1
-x = 2
+let x = 1
+x = 2

Or if reassignment isn't needed:

-const x = 1
-x = 2
+const x = 2
📝 Committable suggestion

!!️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const x = 1
x = 2
let x = 1
x = 2
🧰 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
In test.ts around lines 7 to 8, the code attempts to reassign a value to a const
variable 'x', which is not allowed. To fix this, either change the declaration
of 'x' from const to let if reassignment is needed, or remove the reassignment
if the value should remain constant.


const items = [1, 2, 3]
items.forEach(async item => {
await fetch(`/api/${item}`)
})
Comment on lines +10 to +13
Copy link

@coderabbitai coderabbitai bot Jul 14, 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 proper async handling.

Using async callbacks with forEach doesn't wait for promises to resolve, leading to unpredictable behavior. The fetch operations will run concurrently without proper coordination.

Use Promise.all() with map() to wait for all requests:

 const items = [1, 2, 3]
-items.forEach(async item => {
- await fetch(`/api/${item}`)
-})
+await Promise.all(items.map(async item => {
+ return fetch(`/api/${item}`)
+}))

Or use a for...of loop for sequential processing:

 const items = [1, 2, 3]
-items.forEach(async item => {
- await fetch(`/api/${item}`)
-})
+for (const item of items) {
+ await fetch(`/api/${item}`)
+}
📝 Committable suggestion

!!️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const items = [1, 2, 3]
items.forEach(async item => {
await fetch(`/api/${item}`)
})
const items = [1, 2, 3]
await Promise.all(
items.map(async item => {
return fetch(`/api/${item}`)
})
)
Suggested change
const items = [1, 2, 3]
items.forEach(async item => {
await fetch(`/api/${item}`)
})
const items = [1, 2, 3]
for(const item ofitems) {
await fetch(`/api/${item}`)
}
🤖 Prompt for AI Agents
In test.ts around lines 10 to 13, the use of async function inside forEach does
not wait for the promises to resolve, causing concurrency issues. Replace the
forEach with either Promise.all combined with map to run fetch calls
concurrently and wait for all to complete, or use a for...of loop with await
inside to process fetch calls sequentially and ensure proper async handling.


greet("world")

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