-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The rule suggests .at(-1) for array-like DOM objects that don't have this method, causing runtime errors.
// Before (works)
const items = document.querySelectorAll('div');
const last = items[items.length - 1];
// After applying fix (crashes)
const last = items.at(-1);
// Uncaught TypeError: document.querySelectorAll(...).at is not a function NodeList, HTMLCollection, and similar DOM types are array-like but don't extend Array, so they lack .at().
Affected types:
- NodeList / NodeListOf
- HTMLCollection / HTMLCollectionOf
- NamedNodeMap
- DOMTokenList
- FileList
- TouchList
- etc.
Metadata
Metadata
Assignees
Labels
No labels