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)
**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
@ -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

View File

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

View File

@ -106,5 +106,10 @@ module.exports = {
type: 'boolean'
default: false
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."
}