Trailing Commas

This commit removed the ability to disable trailing commas. Was that intentional? I had been using the following:

configuration.rules["MultiLineTrailingCommas"] = false

No, that looks like an oversight. We realized that the MultiLineTrailingCommas rule as previously written couldn't be correct as a SyntaxFormatRule because those transformations are executed before whitespace layout, but we we didn't preserve a way to disable the functionality when we moved it into the pretty-printer. (Disabling "rules" is easy because it's just a matter of not executing the visitor in the pipeline; conditionalizing pretty-printer logic requires explicit consideration of what the layout should be in both the enabled and disabled cases.)

If we're thinking of adding configurability back here, I think what we'd want here is a tri-state: do nothing (keep whatever the user wrote), always remove trailing commas, or always add trailing commas.

I filed SR-12484 to track this.

1 Like
Terms of Service

Privacy Policy

Cookie Policy