JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="imatextarea">
 - foob
 - bar
 - baznn</textarea>

CSS

textarea{
    width:50vw;
    height:50vh;
}

JavaScript

//let us count lines in a string easily. Thx to http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea
String.prototype.lines = function() { return this.split(/\r*\n/); }
//lets get ourselves a good ol' regex
var rex=/( - \w$)/gm
//now, lets save original state of textarea
var txtArea=document.getElementById('imatextarea');
var lastCont=txtArea.textContent;
//finally, to the listener
txtArea.addEventListener('input',function(){
    //does content match, for three lines?
    if(txtArea.value.match(rex).length!==3||txtArea.value.lines()>3){
        txtArea.value=lastCont;
    }else{
        lastCont=txtArea.value;
    }
},false);