-
Notifications
You must be signed in to change notification settings - Fork 34
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
Consideration for Prettier #1014
Comments
I briefly considered this when we started the rewrite. I saw that we already have an I would argue that although the old Angular code was pretty messy, the code we have rewritten so far is mostly uniform in style. For example I have been consistent about using 2-space indents, and fairly consistent about using single quotes rather than double quotes. I can see the value of Prettier, but our team is not that big. On the other hand, it is an open source project and we do want to encourage contributions from the community, so I can see it both ways. |
Thanks for your opinion! Given that our project is open source, I think you are right. I will close the issue. |
I actually meant that the project being open-source is one reason we would consider using Prettier. I think the more people are working on a project, the more important it is to unify code styles. We don't have a huge dedicated team, but theoretically anyone from the community could contribute. If we saw an uptick in community contributions in the future, we might benefit from a stricter code style. |
My apologies for the misunderstanding. I have now reopened the issue. |
@JGreenlee @jiji14 I think you should go ahead and set this up. Even considering only internal contributions, we have interns who are here for short periods of time and it is good to have that continuity of code style. It will at least cut down on the inadvertent whitespace changes issue and make pull requests cleaner. I would suggest:
|
My suggestions / the style I have generally been following the past few months:
These are all open to discussion if anyone would like to express a different preference |
what do you think about adding |
I vote yes to semicolons |
I wrote C++ code every day for 8 years. semicolons all the way! |
These all sound great to me! I think my only hesitation is using The Prettier docs (link) suggest that avoiding parentheses can make type annotations and extra arguments tricky, which is another thing to consider. No parentheses would be a cleaner look, but having them may help us avoid some syntax hiccups! |
I deleted |
Consideration for Prettier
While rewriting Angular services, I noticed mixed code styles. I believe it would be beneficial to set up Prettier configuration in our project.
what is
Prettier
?Prettier is an opinionated code formatter. It removes all original styling and ensures that all outputted code conforms to a consistent style.
why
Prettier
?It is generally accepted that having a common style guide is valuable for a project and team.
Prettier
assists in writing clean code.Examples:
tabWidth: 4
vstabWidth: 2
singleQuote: true
vssingleQuote: false
Resources
You can learn more about Prettier here: Prettier
Additionally, this article explains why coding style is important: Why Coding Style Matters
The text was updated successfully, but these errors were encountered: