gochan-org / gochan

Require template literals instead of string concatenation JS-0246
Anti-pattern
Minor
2 months ago2 years old
Unexpected string concatenation
103		if(op.trip !== "") threadObj.op += "!" + op.trip;
104		if(op.sub !== "") {
105			if(op.sub.length > subjectCuttoff)
106				threadObj.subject = op.sub.slice(0, subjectCuttoff) + "...";107			else
108				threadObj.subject = op.sub;
109		}
Unexpected string concatenation
100			op: op.name,
101			latest: data.posts[data.posts.length-1].no
102		};
103		if(op.trip !== "") threadObj.op += "!" + op.trip;104		if(op.sub !== "") {
105			if(op.sub.length > subjectCuttoff)
106				threadObj.subject = op.sub.slice(0, subjectCuttoff) + "...";
Unexpected string concatenation
231	const cursor = (msgbox.selectionStart !== undefined)?msgbox.selectionStart:msgbox.value.length;
232	let quoted = lines.join("\n");
233	if(quoted !== "") quoted += "\n";
234	msgbox.value = msgbox.value.slice(0, cursor) + `>>${no}\n` +235		quoted + msgbox.value.slice(cursor);236
237	if(msgbox.id === "postmsg")
238		window.scroll(0,msgbox.offsetTop - 48);
Unexpected string concatenation
225
226	if(selected !== "") {
227		for(let l = 0; l < lines.length; l++) {
228			lines[l] = ">" + lines[l];229		}
230	}
231	const cursor = (msgbox.selectionStart !== undefined)?msgbox.selectionStart:msgbox.value.length;
Unexpected string concatenation
217		openQR();
218	}
219	const msgboxID = "postmsg";
220	let msgbox = document.getElementById("qr" + msgboxID) as HTMLInputElement;221	if(msgbox === null)
222		msgbox = document.getElementById(msgboxID) as HTMLInputElement;
223	const selected = selectedText();