There was a simple answer up above that was missing some " so it fails. But I haven't got enough rep to either say "needs quotes" or downvote it...
REPO=my-repo
aws ecr batch-delete-image --repository-name $REPO --image-ids \
"$(aws ecr list-images --repository-name $REPO --query 'imageIds[*]' --output json)"
Simply set $REPO to your-repo, not my-repo, and run the one liner.