Skip to content

Ignore dollar sign in string literals #1106

@bencroker

Description

@bencroker

Following on from #1104, which noted that $foo is converted to $['foo'] regardless of whether or not it exists within a string literal, I’m wondering whether the regex pattern used in statementRe could be applied here too, to prevent this from happening.

const statementRe =
/(\/(\\\/|[^/])*\/|"(\\"|[^"])*"|'(\\'|[^'])*'|`(\\`|[^`])*`|\(\s*((function)\s*\(\s*\)|(\(\s*\))\s*=>)\s*(?:\{[\s\S]*?\}|[^;){]*)\s*\)\s*\(\s*\)|[^;])+/gm

Such a task requires an elite team. I put forward:

  • @andersmurphy, who wrote the regex for statementRe.
  • @yurivish, who reported the issue and a no-op replace.
  • @gazpachoking, who has made excellent contributions to the project.

If any of you are interested, let me know so I can get you latest WIP version.

Datastar Version

v1.0.0-RC.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions