Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escapeKey does not handle properties which begin with a number #146

Open
cjpearson opened this issue Nov 14, 2024 · 1 comment
Open

escapeKey does not handle properties which begin with a number #146

cjpearson opened this issue Nov 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cjpearson
Copy link

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

@cjpearson
Copy link
Author

cjpearson commented Nov 14, 2024

Should be fixed with this PR #143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant