id: ux-anchor-no-href
language: tsx
severity: error
message: <a onClick> without href — not a real link, not keyboard-focusable
note: '{"severity":"high","category":"convention","resolution":"Use a <button> for actions, or give the <a> a real href. An anchor with only onClick is invisible to keyboard and screen readers (ANTI-SLOP UX §11)."}'
rule:
  any:
    - all:
        - kind: jsx_opening_element
        - has: { field: name, regex: '^a$' }
        - has: { kind: jsx_attribute, regex: '^onClick' }
        - not: { has: { kind: jsx_attribute, regex: '^href=' } }
    - all:
        - kind: jsx_self_closing_element
        - has: { field: name, regex: '^a$' }
        - has: { kind: jsx_attribute, regex: '^onClick' }
        - not: { has: { kind: jsx_attribute, regex: '^href=' } }
