Skip to content

Prettier config update#1771

Closed
nearestnabors wants to merge 3 commits intofacebook:masterfrom
nearestnabors:prettier
Closed

Prettier config update#1771
nearestnabors wants to merge 3 commits intofacebook:masterfrom
nearestnabors:prettier

Conversation

@nearestnabors
Copy link
Copy Markdown
Contributor

In #1752 we discussed what an ideal Prettier config would look like: more space, no trailing commas. Applied everywhere

@react-native-bot
Copy link
Copy Markdown

react-native-bot commented Mar 20, 2020

Deploy preview for react-native ready!

Built with commit bb29bda

https://deploy-preview-1771--react-native.netlify.com

Changes to docs/ are reflected in the next "master" version.

Thank you for your contributions.

How to ContributeDocumentation Sources


```jsx
static in(easing);
static in easing;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a Prettier issue, can we ignore this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This seems like a pretty big deal. How many other places is it doing something/going to do something similar?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was bit surprised but it seems that only this line is affected.

I assume that the reason is that in in JS is a keyword and you usually cannot use it as a name for stand-alone variables or functions. Here it's fine because it's static method.

Copy link
Copy Markdown
Contributor

@cHaLkdusT cHaLkdusT left a comment

Choose a reason for hiding this comment

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

Can we also need to update the .prettierrc options for *.js files so that SnackPlayer snippets will also follow the prettier config?

@lcelso
Copy link
Copy Markdown
Contributor

lcelso commented Mar 20, 2020

I loved it.

@Simek
Copy link
Copy Markdown
Collaborator

Simek commented Mar 20, 2020

@cHaLkdusT Prettier rules are extension (not context) based. This means that until JS code is inside md file all *.md rules will apply to this code.

*.js rule only applies to JS files such as website/core/Footer.js.

@elicwhite
Copy link
Copy Markdown
Member

What is the reason for the website code snippets having a different prettier config than the core codebase? I could understand some things like additional spacing making things easier to read, but I’m not sure about the trailing comma change

Copy link
Copy Markdown
Contributor Author

@nearestnabors nearestnabors left a comment

Choose a reason for hiding this comment

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

@TheSavior Trailing commas are unusual in documentation sample code and tutorials—most of our un-Prettier-ed demos don't have them!

I'm not sure why the site and demo JS are handled differently, but I figure it's better not to go changing things in the site code even though the demo code might need to change with convention. So perhaps that's what was intended!

@nearestnabors
Copy link
Copy Markdown
Contributor Author

I'm going to close this and retry after the dust of 0.62 settles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants