Skip to content

🎨 Format SnackPlayer code snippets#1752

Closed
cHaLkdusT wants to merge 1 commit intofacebook:masterfrom
cHaLkdusT:consistent-SnackPlayer-code-snippets
Closed

🎨 Format SnackPlayer code snippets#1752
cHaLkdusT wants to merge 1 commit intofacebook:masterfrom
cHaLkdusT:consistent-SnackPlayer-code-snippets

Conversation

@cHaLkdusT
Copy link
Copy Markdown
Contributor

Make all SnackPlayer code snippets consistent with our Prettier config

@react-native-bot
Copy link
Copy Markdown

Deploy preview for react-native ready!

Built with commit 3f0f4e7

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

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

Thank you for your contributions.

How to ContributeDocumentation Sources

Copy link
Copy Markdown
Contributor

@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.

Could you see about updating the config so imports are not multi-lined? I hate seeing a third of the Snack window consumed by importing View, Input, Text, etc..

@Simek
Copy link
Copy Markdown
Collaborator

Simek commented Mar 16, 2020

IMO this PR should be in hold until Component Docs Drive (#1579) is finished.

@cHaLkdusT
Copy link
Copy Markdown
Contributor Author

Hi @rachelnabors, I've checked Prettier config, unfortunately, there's no option to make imports not multi-lined. There's an on-going discussion here: prettier/prettier#5995

Would you like revert files with multi-lined imports instead?

</TouchableOpacity>
)
}
export default (App = () => {
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.

Curly braces after export default are unnecessary (and a bit confusing). It will be nice to omit them if config allows to.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not seeing where we can add that: https://prettier.io/docs/en/options.html

Copy link
Copy Markdown
Collaborator

@Simek Simek Mar 20, 2020

Choose a reason for hiding this comment

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

It's look like for me as ESLint/Prettier issue with this particular construction. Expo Snack editor also adds those brackets on autoformat. I'm not sure why though since export is an expression/directive not a function or variable.


import React, { useState, useEffect } from "react";
import { AccessibilityInfo, View, Text, StyleSheet } from "react-native";
import React, {useState, useEffect} from 'react';
Copy link
Copy Markdown
Collaborator

@Simek Simek Mar 18, 2020

Choose a reason for hiding this comment

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

As long as I'm looking of this I'm not sure if disabling bracket spacing is a good change.

I think that having those spaces improves overall readability of the code (especially when function uses object as a parameter).

@nearestnabors
Copy link
Copy Markdown
Contributor

Sorry to close this... I updated Prettier to be a little more readable based on the conversation here and am landing redundant updates. But THANK YOU for bringing this conversation to light! Sometimes discussions themselves are worth the PR :)

@cHaLkdusT cHaLkdusT deleted the consistent-SnackPlayer-code-snippets branch March 20, 2020 14:12
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.

4 participants