Pretty Diff offers some conformance support to the requirements of several popular style guides. The objective is to automate certain particular requirements of style guide conformance so that code authors can focus on more important things. Pretty Diff does not attempt to magically fix code to be 100% conformant to any style guide.
This support is provided by use of an option, styleguide to the prettydiff.js and jspretty.js libraries. When this option is passed with an accepted value the settings of other various options are overwritten. This forcefulness is intentional so that code is modified according to rules applied by a group setting in opposition to an individual's preferences.
Pretty Diff suggests use of something like JSCS to achieve complete conformance to a code style. The JSCS tool is a validator designed to yell at code authors when their code violates style rules and it does not alter a code sample. Using the style guide feature of Pretty Diff together with JSCS can help a code author to achieve 100% conformance to code style rules while allowing the code author to automate away many minor code style violations.
Manipulating code is risky business. Changing code can result in unplanned consequences they may alter or break the code from the author's intentions. Due to this risk there are certain alterations that Pretty Diff will intentionally not perform. In those cases a code author should be held accountable to make decisions about why code was written in a particular way. Here is an incomplete list of things Pretty Diff intentionally does not change.
Pretty Diff will not hoist or move around reference declarations in the code. References declared with the var are naturally hoisted by JavaScript interpreters, but references declared with the ES6 keyword let will not be hoisted. Moving around references declarations with let is a change in logic that can alter how a given set of code is interpreted.
Pretty Diff will not reorder consecutively declared variables. This change can result in an error when one variable makes use of another variable at declaration time, and changing variable order in this case will break the code.
Pretty Diff will not change the order or logic, except for trivial and predictable syntax changes. The one major exception to this rule is that Pretty Diff can alphabetize object properties.
If you have ideas for additional automation rules or rule sets please open a Github issue or submit a pull request.
The following list is presented as list of Pretty Diff supported style guide values and corresponding option values. For definitions of the various options please see the documentation.