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

Check for valid name before reformatting bracket notation to use dots #77

Merged
merged 1 commit into from
May 16, 2024

Conversation

j-malt
Copy link
Contributor

@j-malt j-malt commented May 7, 2024

Closes #70 (and maybe #68) by checking that the bracketed name can be converted to a dot notation before doing it. Otherwise just uses regular brackets. The regex here is /^[a-zA-Z_$][0-9a-zA-Z_$]*$/ which roughly should match any valid Javascript variable, which should cover valid HubL variable names as well. See updated snapshot for updated behaviour.

jsines
jsines previously approved these changes May 9, 2024
TanyaScales
TanyaScales previously approved these changes May 9, 2024
@j-malt j-malt changed the base branch from jm/prettier-v3 to master May 9, 2024 18:26
@j-malt j-malt dismissed stale reviews from TanyaScales and jsines May 9, 2024 18:26

The base branch was changed.

@j-malt j-malt merged commit 5c26803 into master May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bracket notation will be reformatted even when dot notation is invalid
3 participants