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

  1. 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) in duo_agentic_chat_state_manager.vue and duo_agentic_chat_state_manager_light.vue to prevent outer variable shadowing (no-shadow).
  2. Spec file:
    • Addressed .map(upper) in ee/spec/frontend/ai/duo_agentic_chat/plugins/attachments/components/message_attachments_prompt_spec.js.
  3. Suppression list cleanup:
    • Removed all 13 resolved duo_agentic_chat entries from .eslint_todo/unicorn-no-array-callback-reference.mjs.

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 warnings

2. 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

Merge request reports

Loading
Loading