Loading
Fix unicorn/no-array-callback-reference ESLint violations in Duo Agentic Chat
What does this MR do and why?
Closes #638371 (closed)
This MR fixes all unicorn/no-array-callback-reference ESLint violations in Duo Agentic Chat files.
The unicorn/no-array-callback-reference rule prevents passing function references directly into array iteration methods (.filter(), .map(), .find(), .some(), .every()), which silently forwards (element, index, array) to callbacks expecting only a single argument.
Changes made
- Source files (14 violations across 12 files):
- Wrapped callbacks in explicit arrow functions passing only the intended argument.
- Used distinct parameter names (e.g.,
catalogAgent) induo_agentic_chat_state_manager.vueandduo_agentic_chat_state_manager_light.vueto prevent outer variable shadowing (no-shadow).
- Spec file:
- Addressed
.map(upper)inee/spec/frontend/ai/duo_agentic_chat/plugins/attachments/components/message_attachments_prompt_spec.js.
- Addressed
- Suppression list cleanup:
- Removed all 13 resolved
duo_agentic_chatentries from.eslint_todo/unicorn-no-array-callback-reference.mjs.
- Removed all 13 resolved
Verification
1. ESLint Check
yarn eslint --rule '{"unicorn/no-array-callback-reference": "error"}' ee/app/assets/javascripts/ai/duo_agentic_chat/
# Result: 0 errors, 0 warnings2. Jest Test Suite
yarn jest ee/spec/frontend/ai/duo_agentic_chat
# Result: 113 test suites passed, 3,132 tests passed (0 failures)MR Acceptance Checklist
- Conforms to GitLab JavaScript & Vue style guidelines
- All 13 entries removed from
.eslint_todo/unicorn-no-array-callback-reference.mjs - Full Duo Agentic Chat Jest suite passes with 0 failures
- No variable shadowing introduced