prefer-first-last Prefer first and last accessors over equivalent indexing array.at(0) and array.at(-1) duplicate the optional first and last endpoint lookups. array.at(array.length - 1) also duplicates last. Instead, you SHOULD use the corresponding endpoint accessor. Trapping subscript access has different empty-array behavior and remains unchanged. - Category: style - Level: warning - Fix: automatic - Scope: module Reported function first(values: int32[]): int32 | undefined { return values.at(0); } Accepted function first(values: int32[]): int32 | undefined { return values.first(); } Prior art - Clippy · getfirst - Clippy · getlastwithlen language/linter/src/rules/style/preferfirstlast.rs:8