Skip to content

Commit

Permalink
fix: Infer trailingComma correctly
Browse files Browse the repository at this point in the history
This should infer `es5` when eslint's `comma-dangle` is set to `always-multiline`.

Fixes #96.
  • Loading branch information
zimme committed Dec 5, 2017
1 parent fcdbaf1 commit 81e36e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function getTrailingComma(value, fallbacks, rules) {

if (value === "never") {
prettierValue = "none";
} else if (value === "always") {
} else if (value && value.indexOf("always") === 0) {
prettierValue = "es5";
} else if (typeof actualValue === "object") {
prettierValue = getValFromTrailingCommaConfig(actualValue);
Expand Down

4 comments on commit 81e36e5

@TomiS
Copy link

@TomiS TomiS commented on 81e36e5 Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zimme Not sure if it's this commit but I just updated to 8.2.4 and started getting TypeError: value.indexOf is not a function errors when running prettier-eslint in either Atom or command line. Downgrade to 8.2.3 solved the problem.

@zimme
Copy link
Member Author

@zimme zimme commented on 81e36e5 Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomiS Thanks, will fix it straight away 👍

@zimme
Copy link
Member Author

@zimme zimme commented on 81e36e5 Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fix with the next version, getting published as I write this.

@TomiS
Copy link

@TomiS TomiS commented on 81e36e5 Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me now. Thanks for quick response.

Please sign in to comment.