millermedeiros/esformatter — pull request #46 by jzaefferer (2013-06-21 12:58:58+00:00)
Title: WIP: jQuery preset

This PR itself isn't meant to be merged. It might eventually lead to an implementation of a jQuery preset (#19). For now it just highlights a few issues and limitations.

* Multiple variable declarations without assignments are supposed to go on one line. This needs a new configuration option
* More whitespace within array declarations, e.g. `[ x, y ]`. It looks like there's no config for this, so needs to be added.
* More whitespace within `for( x in y )`. There is ForInStatement, ForInStatementExpression, ForInStatementOpeningBrace and ForInStatementClosingBrace, all set to `1` by default, yet the necessary whitespace isn't added. Either I misunderstand what these properties are supposed to do and we need extra config, or they are buggy.
* Indented comments loose their indentation. This must be a bug. I'm not sure though why it fails here, while it seems to work in the function_declaration test.
* There's an exception for function and object arguments, which don't get extra whitespace before and after. This needs a new config option.
* More whitespace within if statements, e.g. `if ( x === y )`. Similar to `for`, there's IfStatementConditional, IfStatementOpeningBrace and IfStatementClosingBrace, but all of these are set to `1` by default, yet the whitespace isn't added.
* Similar to for and if, more whitespace within inline expressions with braces, e.g. `( value / 1 )`. I don't see any config for these.
* It looks like there's no configuration for tertiary expressions. [But those aren't defined within the jQuery style guide, yet](https://github.com/jquery/contribute.jquery.org/issues/45).

Would be great to get some feedback on these. I would then start with those that look like bugs and add at least standalone tests for them. I could then look at those that need new configuration.