trivago / prettier-plugin-sort-imports

A prettier plugin to sort imports in typescript and javascript files by the provided RegEx order.
Apache License 2.0
3.37k stars 133 forks source link

(#276) Fixed dollar sign group replace in vue preprocessor #283

Open adamDilger opened 9 months ago

adamDilger commented 9 months ago

replace#specifying_a_string_as_the_replacement

When vue code contained groupings such as $' or $$, the call to "".replace() would treat these as special replacements producing invalid code.

Switching the replacement arg to a function returning the same string skips this logic.

The tests pass, and as this is only removing special functionality I would assume this is a safe change

EDIT: I've also added another commit to this PR which fixes having both a script and a script/setup tags in a SFC

seanogdev commented 8 months ago

I've applied this as a patch in our repo and this works perfectly, thanks @adamDilger 🙌

seanogdev commented 7 months ago

@ayusharma @byara Would we be able to get a release for this whenever you guys had a spare moment? 🙏

adamDilger commented 6 months ago

I've added another bugfix onto this branch/PR, for #218 , as there would have been conflicting changes if these fixes were separated out.

If this is not valid I'm happy to revert and re-PR once the first fix has been merged

adamkdean commented 5 months ago

I found this issue even when $ exists in a string