diff --git a/changelog_unreleased/api/pr-6963.md b/changelog_unreleased/api/pr-6963.md new file mode 100644 index 000000000..4c9411ddc --- /dev/null +++ b/changelog_unreleased/api/pr-6963.md @@ -0,0 +1,10 @@ +#### Change default value for `trailingComma` to `es5` ([#6963](https://github.com/prettier/prettier/pull/6963) by [@fisker](https://github.com/fisker)) + +Before version 2.0, Prettier was avoiding trailing commas by default where possible. +This made the resulting JavaScript compatible with now very old environments such as IE8, but implied [some missed opportunities](https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8). + +Prettier has included an [option to configure trailing commas](https://prettier.io/docs/en/options.html#trailing-commas) since its early days, and an initiative to change the default value has been out there [for over three years](https://github.com/prettier/prettier/issues/68). +Finally, the default value becomes `es5` instead of `none` in Prettier v2.0. + +If the old behavior is still preferred, please configure Prettier with `{ "trailingComma": "none" }`. +There is a possibility that the default value will change to `always` (meaning even more trailing commas) in a future major version of Prettier as the JavaScript ecosystem further matures. diff --git a/docs/options.md b/docs/options.md index bc5521774..0f80e402c 100644 --- a/docs/options.md +++ b/docs/options.md @@ -93,6 +93,8 @@ Use single quotes instead of double quotes in JSX. ## Trailing Commas +_Default value changed from `none` to `es5` in v2.0.0_ + Print trailing commas wherever possible when multi-line. (A single-line array, for example, never gets trailing commas.) Valid options: