See #524, #534. Add end_with_comma option to JavaScript using Pretty Diff

This commit is contained in:
Glavin Wiechert 2015-09-10 16:08:58 -03:00
parent 8854104f75
commit 971a87fcd8
3 changed files with 78 additions and 0 deletions

View File

@ -1440,6 +1440,30 @@ End output with newline (Supported by JS Beautify)
} }
``` ```
#### [JavaScript - End with comma](#javascript---end-with-comma)
**Namespace**: `js`
**Key**: `end_with_comma`
**Type**: `boolean`
**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Description**:
If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"end_with_comma": false
}
}
```
#### [Objective-C - Config Path](#objective-c---config-path) #### [Objective-C - Config Path](#objective-c---config-path)
**Namespace**: `objectivec` **Namespace**: `objectivec`
@ -5386,6 +5410,30 @@ End output with newline (Supported by JS Beautify)
} }
``` ```
#### [JavaScript - End with comma](#javascript---end-with-comma)
**Namespace**: `js`
**Key**: `end_with_comma`
**Type**: `boolean`
**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Description**:
If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"end_with_comma": false
}
}
```
### Pretty Diff ### Pretty Diff
@ -5869,6 +5917,30 @@ Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pre
} }
``` ```
#### [JavaScript - End with comma](#javascript---end-with-comma)
**Namespace**: `js`
**Key**: `end_with_comma`
**Type**: `boolean`
**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Description**:
If a terminating comma should be inserted into arrays, object literals, and destructured objects. (Supported by JS Beautify, Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"end_with_comma": false
}
}
```
### Gherkin formatter ### Gherkin formatter

View File

@ -28,6 +28,7 @@ module.exports = class PrettyDiff extends Beautifier
wrap: "wrap_line_length" wrap: "wrap_line_length"
space: "space_after_anon_function" space: "space_after_anon_function"
noleadzero: "no_lead_zero" noleadzero: "no_lead_zero"
endcomma: "end_with_comma"
# Apply language-specific options # Apply language-specific options
CSV: true CSV: true
ERB: true ERB: true

View File

@ -106,5 +106,10 @@ module.exports = {
type: 'boolean' type: 'boolean'
default: false default: false
description: "End output with newline" description: "End output with newline"
end_with_comma:
type: 'boolean'
default: false
description: "If a terminating comma should be inserted into \
arrays, object literals, and destructured objects."
} }