millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

Add support for variable renaming #214

Closed pomeh closed 10 years ago

pomeh commented 10 years ago

If you really want to "be the best JavaScript code formatter" (and I want you to become it because I need this tool !!), esformatter should definitely support renaming variable in some form. To understand what I mean you have to check out this online but closed-source JavaScript formatter: http://www.jsnice.org. There are two things involved in this tool:

I don't know if esformatter could support this second point in any form but if yes it would be really, really powerful :)

pgilad commented 10 years ago

Actually jsfmt which is based on this project does variable renaming...

leobalter commented 10 years ago

This is not the target for esformatter. But it can be achieved using its dependecy: rocambole.

You can check a module I made as example: https://github.com/leobalter/rocambole-method-rename. It's not exactly what you want but it's on the same way.

Also, the acorn is promising as a good JS parser to solve the variable renaming problem.

pomeh commented 10 years ago

Ok I understand, it's not esformatter's job to do variable renaming.

@pgilad @leobalter thanks for the links, I didn't know about jsmft, rocambole and acorn.

twolfson commented 9 years ago

I have completed esformatter-rename which should work for this functionality

https://github.com/twolfson/esformatter-rename

millermedeiros commented 9 years ago

another plugin: https://github.com/twolfson/esformatter-phonetic