p42ai / js-assistant

120+ refactorings and code-assists for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=p42ai.refactor
MIT License
119 stars 7 forks source link

push-operator-into-assignment error #3

Closed franck-paul closed 2 years ago

franck-paul commented 2 years ago

I got this message “Can push + operator into += assignment.” for this line of code:

content = excerpt + content;

The proposed replacement is (which is marked as safe):

content += excerpt;

Which is not the same as I which to put excerpt before content in resulting content variable.

lgrammel commented 2 years ago

Thanks for the bug report. You are right, this is incorrect for string & template literals. I'll put out a fix.

lgrammel commented 2 years ago

@franck-paul I just released version 1.46.4, which fixes the bug. Please re-open this issue if you still encounter the bug in 1.46.4 or higher. Thanks again for the bug report!