antfu / eslint-plugin-command

Comment-as-command for one-off codemod with ESLint.
https://eslint-plugin-command.antfu.me/
MIT License
199 stars 13 forks source link

feat: add `to-string-literal` and `to-template-literal` commands #2

Closed alexzhang1030 closed 6 months ago

alexzhang1030 commented 6 months ago

Description

Introducing two new commands: to-string-literal and to-template-literal to interconvert between template literal and string literal.

Linked Issues

closes #1

Additional context

antfu commented 6 months ago

Do we consider doing 'a' + b + 'c' to `a${b}c` and vice-versa?

alexzhang1030 commented 6 months ago

Do we consider doing 'a' + b + 'c' to `a${b}c` and vice-versa?

ohhhh, nice one! I will try

alexzhang1030 commented 6 months ago

Do we consider doing 'a' + b + 'c' to `a${b}c` and vice-versa?

This is implemented now, but do we need to support sub-expressions? E.g. ${a + b} -> '' + a + b + '', it might be a little complex...