Repository: prettier/prettier-eslint
Pull request #71 (2017-04-20 15:55:06)

fix: trailingComma all only if functions enabled
This is in line with eslint's defaults for string values: http://eslint.org/docs/rules/comma-dangle.

Fixes https://github.com/prettier/prettier-eslint/issues/69.

codecov-io: # [Codecov](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=h1) Report
> Merging [#71](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=desc) into [master](https://codecov.io/gh/prettier/prettier-eslint/commit/a7cc1de8c534432fa4ffb8ffe47973c978737f33?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/prettier/prettier-eslint/pull/71/graphs/tree.svg?width=650&height=150&src=pr&token=SKAX5tKPfD)](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=tree)

```diff
@@          Coverage Diff          @@
##           master    #71   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines         145    145           
=====================================
  Hits          145    145
```


| [Impacted Files](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/utils.js](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=tree#diff-c3JjL3V0aWxzLmpz) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=footer). Last update [a7cc1de...6d8d09d](https://codecov.io/gh/prettier/prettier-eslint/pull/71?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/README.md b/README.md
index 2453541..c72e197 100644
--- a/README.md
+++ b/README.md
@@ -163,6 +163,28 @@ fall back to the `prettier` defaults:
 }
 ```
 
+## Troubleshooting
+
+#### eslint-disable-line
+
+While using `// eslint-disable-line`, sometimes you may get linting errors after the code has been processed by this module. That is because
+```js
+if (x) { // eslint-disable-line
+}
+```
+changes to
+```js
+if (x) {
+  // eslint-disable-line
+}
+```
+You can notice that `// eslint-disable-line` has moved to a new line. This can be fixed by using `//eslint-disable-next-line` instead of `// eslint-disable-line`
+```js
+// eslint-disable-next-line
+if (x) {
+}
+```
+
 ## Inspiration
 
 - [`prettier`][prettier]
diff --git a/src/utils.js b/src/utils.js
index e1b1719..00eb860 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -161,7 +161,7 @@ function getTrailingComma(value, rules) {
     }
   }
 
-  return value === 'never' ? 'none' : 'all'
+  return value === 'never' ? 'none' : 'es5'
 
   function getValFromObjectConfig(eslintValue) {
     const [, {arrays, objects, functions}] = eslintValue


Test patch:
diff --git a/src/utils.test.js b/src/utils.test.js
index 96d615f..3a7d8fb 100644
--- a/src/utils.test.js
+++ b/src/utils.test.js
@@ -120,7 +120,22 @@ const getPrettierOptionsFromESLintRulesTests = [
   },
   {rules: {'max-len': 2}, options: {printWidth: 80}},
   {rules: {'comma-dangle': [2, 'never']}, options: {trailingComma: 'none'}},
-  {rules: {'comma-dangle': [2, 'always']}, options: {trailingComma: 'all'}},
+  {rules: {'comma-dangle': [2, 'always']}, options: {trailingComma: 'es5'}},
+  {
+    rules: {
+      'comma-dangle': [
+        2,
+        {
+          arrays: 'always-multiline',
+          objects: 'always-multiline',
+          imports: 'always-multiline',
+          exports: 'always-multiline',
+          functions: 'always-multiline',
+        },
+      ],
+    },
+    options: {trailingComma: 'all'},
+  },
   {
     rules: {
       'comma-dangle': [