Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow backtick strings to avoid escaping single or double quotes #421
I just encountered an interesting situation in which I have to use both single quotes
const sql = `INSERT INTO "user" ("firstName", "lastName") VALUES('Linus', 'Unnebäck')`
This is however not acceptable by standard since "Strings must use singlequote.". But the rules on the front page clearly states that it okay when it is to avoid escaping:
Therefor I would consider this a bug, any thoughts?
Postgres wants me to use double-quotes for identifier escaping. Also, there could be other occurrences when I want to use both single- and double-quotes in the same string.
Than I'm not following the rules, and also it looks ugly :(
Yeah, I think this rule is being overly restrictive. I opened an eslint issue for this before releasing v6: eslint/eslint#5147
Ideally we could enforce this:
There's an ongoing discussion about this and related issues here: eslint/eslint#5234 Weigh in there if you have opinions.