0

I have the array:

["R'", "L", "U", "D'", "F'", "B"]

and it keeps getting formatted to use single quotes on only some of the values because the other ones have a literal single quote:

["R'", 'L', 'U', "D'", "F'", 'B']

I don't want to have inconsistent quotes and I don't want to be forced to escape my single quotes. But I want the project to default to single quotes for strings.

Is there no way to do this? I've searched for many hours on SO and GitHub issues and see no mention of this problem.

Justin
  • 945
  • 12
  • 26
  • how about adding a comment // prettier-ignore to ignore this array – Peter Aug 01 '23 at 02:22
  • @Peter I have many arrays like this. Part of the website includes Rubik's cube moves – Justin Aug 01 '23 at 02:23
  • any reason not to escape single quotes? seem like you want to have consistent quotes, that is the only logical ways out – Peter Aug 01 '23 at 02:34
  • The same reason I don't want inconsistent quotes: because it's ugly and hard to read – Justin Aug 01 '23 at 02:35
  • how about using Backticks [`R'`, `L`, `U`, `D'`, `F'`, `B`] – Peter Aug 01 '23 at 02:42
  • I'd be fine with that but I don't want backticks everywhere in the code. Trying to solve this problem with prettier/eslint so it doesn't keep yelling at me and/or force itself when I wanna format any of these files. – Justin Aug 01 '23 at 02:50

0 Answers0