How to force a code style for a project?


I'm currently starting to learn about JavaScript on the server side with node, I've created a project with NPM, implemented some tests, etc.

Something that's bugging me is the ability to force a code style on all files, I've been reading about JSLint and it warns you about the style errors, but I'm looking for a tool that modifies your code to obey a certain standard.

Is there any tool that covers this task?


I'm looking for a command line tool, so I can add a task to the project using NPM and I can execute it as:

npm format
Problem courtesy of: eliocs


You may want to have a look at something like (and Pre Commit Hook for JSLint in Mercurial and Git) which allows you to run jslint with node, and if you are using a compatible versioning system it may do so on each commit (which is a great way to ensure every file respect your coding standard).

Solution courtesy of: Shautieh


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.