Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add trailing comma to prettier config #2

Merged
merged 1 commit into from
Apr 22, 2019
Merged

add trailing comma to prettier config #2

merged 1 commit into from
Apr 22, 2019

Conversation

kdv24
Copy link
Collaborator

@kdv24 kdv24 commented Apr 19, 2019

- I haven't found a way to prevent vscode making multi-line arrays into single line
- prettier/prettier-vscode#352
@kdv24 kdv24 requested a review from thmsdnnr April 19, 2019 19:10
Copy link

@thmsdnnr thmsdnnr left a comment

Choose a reason for hiding this comment

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

Hi @kdv24,

I tried this out on my VSCode and it works. Trailing commas are preserved, and if they don't exist, they are added.

EDIT: For the collapsing to one line bit, one fix that I don't think is in the PR you linked could be putting the file into .prettierignore, which I think you can wildcard, so .* to ignore all dotfiles.

It's possible that prettier wasn't run on all these files (for instance, I don't have it set up to run on save in my editor), so we might not actually have to make prettier keep the files the way they are, if that makes sense.

On that note, my only suggestion is to check with @chris and @doug to make sure they are on board with the style updates & get their opinion on how to handle the formatting of existing project code.

As long as everyone else is on board it LGTM!

@kdv24
Copy link
Collaborator Author

kdv24 commented Apr 19, 2019

Thanks for the quick review, @thmsdnnr. I'll see what @dougmakingstuff and @bobbymart1n think. I'm not sure who else is from the Amplify Team for sure to ask.

@bobbymart1n
Copy link
Contributor

This works for me. I do have format on save set to true on my editor. I'm still a little new to VS Code and have been using Atom for the past year. As far as I'm aware, VS Code looks for a .prettierrc file if you have prettier installed which I do currently. Let me know if I'm mistaken about that though as I think I've run into VS Code having its own format on save functionality and overriding the .prettierrc file in the past.

@kdv24
Copy link
Collaborator Author

kdv24 commented Apr 19, 2019

@bobbymart1n I'm fairly new to the VS Code settings as well. I have a .prettierrc file and format on save set for me as well, but as I understand it the multi-line issue with the array isn't something prettier will do... or at least I'm not having any luck with it. For example, in src/store.js when I save it, my editor reformats

const middleware = [
  thunk,
  routerMiddleware(history),
];

to const middleweare =[thunk, routerMiddleware(history)]; all on one line.

If you change yours to multiline and save it, does it revert it back to the multi-line? I'm just trying to determine if it's autoformatting for you.

Thanks!

@kdv24 kdv24 requested a review from bobbymart1n April 22, 2019 18:06
@kdv24 kdv24 merged commit 74fec7c into main Apr 22, 2019
bobbymart1n pushed a commit that referenced this pull request May 3, 2019
Add react-intl and framework for cookie
@kdv24 kdv24 deleted the update-editorconfig branch May 15, 2019 19:13
@htharker42 htharker42 mentioned this pull request Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants