Here is a tool for this. Found it on the sublime forums.
- Install Package control
- Run Package Control: Install Package from the command palette. Type Ctrl + Shift + P (Windows) or Command + Shift + P to open the command palette
- Search for
jsFormatand hit enter Ctrl+Alt+fto format