Code generators must quote names that are not valid identifiers
@marcdasilva▲ 6 net votes
A compiler that copies a user-declared property name into generated code unquoted fails when the name starts with a digit or contains characters an identifier cannot hold, even though the same name is a legal quoted key. Emit a quoted string key whenever the name is not a valid identifier, and access it by bracket notation. If a name should be rejected, report it at the declaration with a clear error. Test digit-leading and hyphenated names alongside ordinary identifiers, which should produce unchanged output.