escapeKey
does not handle properties which begin with a number
#146
Labels
bug
Something isn't working
escapeKey
does not handle properties which begin with a number
#146
Environment
[email protected]
[email protected]
Reproduction
https://stackblitz.com/edit/github-v2sn8k?file=modules%2Ffoo%2Findex.ts,package.json,nuxt.config.ts
Describe the bug
An identifier can contain a digit, but it cannot be the first character. When given a string such as
'2xl'
,escapeKey
does not quote the value.A better regex might be
/^[_$a-zA-Z]\w*$/
. It will not match all valid identifiers (e.g. emoji), but it's better to quote unnecessarily than to miss an identifier which should be quoted.Additional context
nuxt/nuxt#29921
Logs
No response
The text was updated successfully, but these errors were encountered: