-
Notifications
You must be signed in to change notification settings - Fork 5
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
Oxlint #24
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,5 @@ | ||
reviews: | ||
tools: | ||
# oxlint does not run if biome is enabled | ||
biome: | ||
enabled: false |
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 | ||
} | ||
} |
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}`) | ||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||
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 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
Suggested change
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.
Fix const reassignment error.
You cannot reassign a value to a const variable. This will cause a compile-time error.
Or if reassignment isn't needed:
📝 Committable suggestion
🧰 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