id: ux-media-no-dimensions
language: tsx
severity: error
message: <video>/<iframe> without width/height — causes layout shift (CLS)
note: '{"severity":"high","category":"convention","resolution":"Reserve the footprint: set width and height (or a CSS aspect-ratio / fixed min-height) so the page does not jump as the media loads (ANTI-SLOP UX §13)."}'
rule:
  any:
    - all:
        - kind: jsx_self_closing_element
        - has: { field: name, regex: '^(video|iframe)$' }
        - not: { has: { kind: jsx_attribute, regex: '^width=' } }
    - all:
        - kind: jsx_opening_element
        - has: { field: name, regex: '^(video|iframe)$' }
        - not: { has: { kind: jsx_attribute, regex: '^width=' } }
