Open jay-meister opened 8 years ago
@JMurphyWeb I agree that ` (back tick) could be useful for multi-line SQL queries. ✅ If you are able to investigate this further, please do. 🔎
@JMurphyWeb are you sure backticks are valid ES5? I'm not so sure. I think the unexpected token error you're seeing is because we've set ecmaVersion: 5
and so all ES6 syntax is treated as a syntax error.
Another way to do multi-line strings without +
string concatenation is with Array.join
:
var query = [
'SELECT * FROM foo',
'WHERE bar=$1',
].join(' ');
I didn't know that you had defined the version, and that it could not be ignored, so thanks for pointing that out.
Back-ticks are useful for writing sql queries that can span multiple lines without lots of these:
' \n + '
. We are not using es6 template literals so it will still make sense to any one seeing the code.I am struggling to ignore it though.
It still gives me the error unexpected token '`'
Assistance much appreciated.