From ee945e85ca20244c5d9b7d80b66cea7e26c3eb89 Mon Sep 17 00:00:00 2001 From: webreflection Date: Thu, 27 Aug 2026 12:24:09 +0200 Subject: [PATCH] docs: Use `Array.prototype.at(index)` instead of out-of-bounds accesses --- AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AGENTS.md b/AGENTS.md index e9299c8c04..45963d7b0a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,6 +87,7 @@ Examples: `fix(tui): simplify thinking toggle styling`, `docs: update contributi - Keep things in one function unless composable or reusable - Avoid unnecessary destructuring. Instead of `const { a, b } = obj`, use `obj.a` and `obj.b` to preserve context +- Avoid possibly out-of-bounds array access. Instead of `array[index] ?? {}`, use `array.at(index) ?? {}`. Instead of `array[array.length - 1]`, use `array.at(-1)` - Avoid `try`/`catch` where possible - Avoid using the `any` type - Prefer single word variable names where possible