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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃帹 Format SnackPlayer code snippets #1752

Conversation

@cHaLkdusT
Copy link
Contributor

cHaLkdusT commented Mar 16, 2020

Make all SnackPlayer code snippets consistent with our Prettier config

@react-native-bot

This comment has been minimized.

Copy link

react-native-bot commented Mar 16, 2020

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
Contributor

rachelnabors left a comment

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

This comment has been minimized.

Copy link
Contributor

Simek commented Mar 16, 2020

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

@cHaLkdusT

This comment has been minimized.

Copy link
Contributor Author

cHaLkdusT commented Mar 16, 2020

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 = () => {

This comment has been minimized.

Copy link
@Simek

Simek Mar 17, 2020

Contributor

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

This comment has been minimized.

Copy link
@rachelnabors

rachelnabors Mar 20, 2020

Contributor

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

This comment has been minimized.

Copy link
@Simek

Simek Mar 20, 2020

Contributor

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';

This comment has been minimized.

Copy link
@Simek

Simek Mar 18, 2020

Contributor

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

@rachelnabors

This comment has been minimized.

Copy link
Contributor

rachelnabors commented Mar 20, 2020

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 cHaLkdusT:consistent-SnackPlayer-code-snippets branch Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can鈥檛 perform that action at this time.