prettier-plugin-sort-imports icon indicating copy to clipboard operation
prettier-plugin-sort-imports copied to clipboard

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

Open adamDilger opened this issue 1 year ago • 4 comments

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

adamDilger avatar Feb 14 '24 23:02 adamDilger

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

seanogdev avatar Mar 16 '24 20:03 seanogdev

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

seanogdev avatar Apr 05 '24 12:04 seanogdev

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

adamDilger avatar May 02 '24 00:05 adamDilger

I found this issue even when $ exists in a string

adamkdean avatar Jun 10 '24 14:06 adamkdean