Change default value of trailingComma to "all" (#11479)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-08-01 11:05:17 +08:00
1 parent a4954041af
commit 83400d19b4
181 files changed
+6431 -6257

No files matched your search

+3 -3
View File
@@ -114,19 +114,19 @@ Use single quotes instead of double quotes in JSX.
## Trailing Commas
_Default value changed from `none` to `es5` in v2.0.0_
_Default value changed from `es5` to `all` in v3.0.0_
Print trailing commas wherever possible in multi-line comma-separated syntactic structures. (A single-line array, for example, never gets trailing commas.)
Valid options:
- `"all"` - Trailing commas wherever possible (including [function parameters and calls](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas#Trailing_commas_in_functions)). To run, JavaScript code formatted this way needs an engine that supports ES2017 (Node.js 8+ or a modern browser) or [downlevel compilation](https://babeljs.io/docs/en/index). This also enables trailing commas in type parameters in TypeScript (supported since TypeScript 2.7 released in January 2018).
- `"es5"` - Trailing commas where valid in ES5 (objects, arrays, etc.). No trailing commas in type parameters in TypeScript.
- `"none"` - No trailing commas.
- `"all"` - Trailing commas wherever possible (including [function parameters and calls](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas#Trailing_commas_in_functions)). To run, JavaScript code formatted this way needs an engine that supports ES2017 (Node.js 8+ or a modern browser) or [downlevel compilation](https://babeljs.io/docs/en/index). This also enables trailing commas in type parameters in TypeScript (supported since TypeScript 2.7 released in January 2018).
| Default | CLI Override | API Override |
| ------- | ------------------------------------------------------ | ------------------------------------------------------ |
| `"es5"` | <code>--trailing-comma <es5&#124;none&#124;all></code> | <code>trailingComma: "<es5&#124;none&#124;all>"</code> |
| `"all"` | <code>--trailing-comma <all&#124;es5&#124;none></code> | <code>trailingComma: "<all&#124;es5&#124;none>"</code> |
## Bracket Spacing