question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reserved keywords as variable names with escaping

See original GitHub issue
var \u{63}ase = 123;

outputs

var case = 123;

which is invalid.

https://jlongster.github.io/prettier/#{"content"%3A"var \\u{63}ase %3D 123%3B"%2C"options"%3A{"printWidth"%3A80%2C"tabWidth"%3A2%2C"singleQuote"%3Afalse%2C"trailingComma"%3Afalse%2C"bracketSpacing"%3Atrue}}

I had no idea you could even write that! This happens for all the reserved words (switch, let, var…). The proper fix is likely to escape the first character for all of them.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hzoocommented, Jan 16, 2017

Yeah I believe it just means https://github.com/babel/babylon/issues/206 would need to be fixed

1reaction
jlongstercommented, Jan 16, 2017

OMG you can write that??

Read more comments on GitHub >

github_iconTop Results From Across the Web

TS: Escaping reserved keyword and use as variable name
My problem is that I'm getting incoming json to my front with variable name "is-saved" , how can I use it in my...
Read more >
Reserved Keywords as Variable Names Using C# - C# Corner
An explanation of how to save reserved keywords as variable names using ... string constructor to ignore escape characters and line breaks.
Read more >
How to name something when the logical option is a reserved ...
In C# you can use the " @ " prefix to escape reserved keywords so they can be used as identifers (like @default...
Read more >
Keywords - Visual Basic | Microsoft Learn
The following keywords are reserved, which means that you cannot use them as names for programming elements such as variables or procedures.
Read more >
C++. Identifiers, reserved words, literals, escape sequences
Identifiers can consist of one or more characters. Variable names must begin from a letter or underscore. In C++, uppercase and lowercase ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found