If someone breaches a Lightning channel (aka tries to spend more than he is allowed to), the other party has to intervene and prove that the coins actually belong to them. This process happens on-chain. How large would such a transaction be? Is it proportional to the number of transactions that happened while the channel was open?
The cost is proportional to the number of committed HTLCs on the channel at the time of closure. Each HTLC has an output in the commitment transaction which pays into either a HTLC-success transaction script or a HTLC-timeout transaction script, depending on whether the HTLC was incoming our outgoing. The commitment also usually has an output to the spender (timelocked) and a regular P2WSH output to the other party of the channel.
Due to both parties needing to agree up-front about the transaction fees involved (in order to sign matching transactions), the protocol works on an "estimated weight", which assumes worst-case sizes for signatures etc.
The estimated weights are broken down in full in BOLT#3, but the key values are
Commitment weight: 724 + 172 * num-untrimmed-htlc-outputs HTLC-timeout weight: 663 HTLC-success weight: 703
The transaction fee is then the agreed upon feerate in satoshi/kweight * expected_weight / 1000 (rounding down).
Clearly it is undesirable to have a large number of htlcs in flight in case of unilateral closure. There is a technical limit of 453 due to the 10k script limit in Bitcoin, but ideally you will want to use a much smaller number.
With other developments like Taproot, it should be possible to bring these costs down significantly for the most likely outcomes.