From cd9ad2c57cb1e53ffc8699e929daba5f58e1c24c Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Wed, 23 Aug 2017 17:44:07 +0200 Subject: [PATCH] Clarify --trailing-comma a bit Refs. #2655 --- README.md | 5 +++-- bin/prettier.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 845b89e96..c0e8ce691 100644 --- a/README.md +++ b/README.md @@ -549,12 +549,13 @@ Default | CLI Override | API Override `false` | `--single-quote` | `singleQuote: ` ### Trailing Commas -Print trailing commas wherever possible. +Print trailing commas wherever possible when multi-line. (A single-line array, +for example, never gets trailing commas.) Valid options: * `"none"` - No trailing commas. * `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.) - * `"all"` - Trailing commas wherever possible (function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). + * `"all"` - Trailing commas wherever possible (including function arguments). This requires node 8 or a [transform](https://babeljs.io/docs/plugins/syntax-trailing-function-commas/). Default | CLI Override | API Override --------|--------------|------------- diff --git a/bin/prettier.js b/bin/prettier.js index 4e51517af..880030105 100755 --- a/bin/prettier.js +++ b/bin/prettier.js @@ -305,7 +305,7 @@ if ( " --no-bracket-spacing Do not print spaces between brackets.\n" + " --jsx-bracket-same-line Put > on the last line instead of at a new line.\n" + " --trailing-comma \n" + - " Print trailing commas wherever possible. Defaults to none.\n" + + " Print trailing commas wherever possible when multi-line. Defaults to none.\n" + " --parser \n" + " Specify which parse to use. Defaults to babylon.\n" + " --cursor-offset Print (to stderr) where a cursor at the given position would move to after formatting.\n" +