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

refact: unified prettier config across repository #2250

Merged
merged 7 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.export = {
module.exports = {
root: true,
extends: '@react-native',
};
6 changes: 0 additions & 6 deletions Example/.prettierrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion Example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
1 change: 0 additions & 1 deletion Example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
"name": "ScreensExample",
"displayName": "ScreensExample"
}

7 changes: 0 additions & 7 deletions FabricExample/.prettierrc.js

This file was deleted.

1 change: 1 addition & 0 deletions FabricExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Installing & running application

Before running application you need to install all dependencies. To do that:

- In project's root directory run `yarn install`
- In FabricExample directory run `yarn install`

Expand Down
2 changes: 1 addition & 1 deletion FabricExample/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
import App from '../App';

// Note: import explicitly to use the types shipped with jest.
import {it} from '@jest/globals';
import { it } from '@jest/globals';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
Expand Down
4 changes: 2 additions & 2 deletions FabricExample/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AppRegistry} from 'react-native';
import { AppRegistry } from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
10 changes: 5 additions & 5 deletions FabricExample/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');

const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -34,8 +34,8 @@ const config = {
blockList: exclusionList(
modules.map(
m =>
new RegExp(`^${escape(path.join(rnsRoot, 'node_modules', m))}\\/.*$`),
),
new RegExp(`^${escape(path.join(rnsRoot, 'node_modules', m))}\\/.*$`)
)
),

extraNodeModules: modules.reduce((acc, name) => {
Expand Down Expand Up @@ -64,15 +64,15 @@ const config = {
__dirname,
'node_modules',
moduleName,
`index${ext}`,
`index${ext}`
);

const possibleSrcPath = path.join(
__dirname,
'node_modules',
moduleName,
'src',
`index${ext}`,
`index${ext}`
);

if (fs.existsSync(possiblePath)) {
Expand Down
6 changes: 0 additions & 6 deletions TVOSExample/.prettierrc.js

This file was deleted.

1 change: 0 additions & 1 deletion TVOSExample/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
{}

2 changes: 1 addition & 1 deletion TVOSExample/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
import App from '../App';

// Note: import explicitly to use the types shipped with jest.
import {it} from '@jest/globals';
import { it } from '@jest/globals';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
Expand Down
8 changes: 2 additions & 6 deletions TVOSExample/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/**
* @format
*/

import {AppRegistry} from 'react-native';
import { AppRegistry } from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
6 changes: 0 additions & 6 deletions apps/.prettierrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion apps/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ enableFreeze(true);

export default function App() {
return <Example />;
// return <Test.Test42 />
// return <Test.Test42 />;
}
4 changes: 3 additions & 1 deletion apps/src/screens/Gestures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ interface DetailsScreenProps {
navigation: NativeStackNavigationProp<StackParamList, 'Details'>;
}

const DetailsScreen = ({ navigation }: DetailsScreenProps): React.JSX.Element => {
const DetailsScreen = ({
navigation,
}: DetailsScreenProps): React.JSX.Element => {
const headerHeight = useHeaderHeight();
const [gestureEnabled, setGestureEnabled] = useState(true);
const [fullScreenGestureEnabled, setFullScreenGestureEnabled] =
Expand Down
4 changes: 3 additions & 1 deletion apps/src/screens/HeaderOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ interface SettingsScreenProps {
navigation: NativeStackNavigationProp<StackParamList, 'Settings'>;
}

const SettingsScreen = ({ navigation }: SettingsScreenProps): React.JSX.Element => {
const SettingsScreen = ({
navigation,
}: SettingsScreenProps): React.JSX.Element => {
const toast = useToast();

const [headerTitle, setHeaderTitle] = useState('Settings');
Expand Down
5 changes: 4 additions & 1 deletion apps/src/shared/SettingsMultiInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ type Props = {
}[];
};

export function SettingsMultiInput({ label, handlers }: Props): React.JSX.Element {
export function SettingsMultiInput({
label,
handlers,
}: Props): React.JSX.Element {
return (
<Pressable>
<View style={styles.container}>
Expand Down
5 changes: 4 additions & 1 deletion apps/src/shared/Square.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ interface Props {
size?: number;
}

export const Square = ({ size = 100, color = 'red' }: Props): React.JSX.Element => (
export const Square = ({
size = 100,
color = 'red',
}: Props): React.JSX.Element => (
<View style={{ width: size, height: size, backgroundColor: color }} />
);
2 changes: 1 addition & 1 deletion apps/src/tests/Test1072.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Post({ onPress }: { onPress?: () => void }) {
function generatePhotos(
amount: number,
width: number,
height: number,
height: number
): JSX.Element[] {
const startFrom = Math.floor(Math.random() * 20) + 10;
return Array.from({ length: amount }, (_, index) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test1209.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function TabAStack() {
}

export const maybePopToTop = (
navigation: StackNavigationProp<ParamListBase>,
navigation: StackNavigationProp<ParamListBase>
) => {
const state = navigation.getState().routes;

Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test1296.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function Post({ onPress }: { onPress?: () => void }) {
function generatePhotos(
amount: number,
width: number,
height: number,
height: number
): JSX.Element[] {
const startFrom = Math.floor(Math.random() * 20) + 10;
return Array.from({ length: amount }, (_, index) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test1463.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function Post({ onPress }: { onPress?: () => void }) {
function generatePhotos(
amount: number,
width: number,
height: number,
height: number
): JSX.Element[] {
const startFrom = Math.floor(Math.random() * 20) + 10;
return Array.from({ length: amount }, (_, index) => {
Expand Down
6 changes: 3 additions & 3 deletions apps/src/tests/Test1476.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function ModalA(props: Props) {

const StackBuilder = (
configs: any,
groupOptions?: NativeStackNavigationOptions,
groupOptions?: NativeStackNavigationOptions
) => {
return () => (
<NativeStack.Group screenOptions={groupOptions}>
Expand Down Expand Up @@ -113,7 +113,7 @@ const ScreenGroup = StackBuilder(
gestureEnabled: true,
contentStyle: { backgroundColor: 'white' },
fullScreenGestureEnabled: true,
},
}
);

const ModalGroup = StackBuilder(
Expand All @@ -130,7 +130,7 @@ const ModalGroup = StackBuilder(
presentation: 'containedTransparentModal',
fullScreenGestureEnabled: true,
animationMatchesGesture: true,
},
}
);

export default function TestModalPresentation() {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test1539.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function RootScreen() {
() =>
(reaProgress.progress.value < 0.5
? reaProgress.progress.value * 50
: (1 - reaProgress.progress.value) * 50) + 50,
: (1 - reaProgress.progress.value) * 50) + 50
);
const reaStyle = useAnimatedStyle(() => {
return {
Expand Down
20 changes: 10 additions & 10 deletions apps/src/tests/Test1645.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable react-native/no-inline-styles */

import React, {useEffect, useState} from 'react';
import {Text, View} from 'react-native';
import React, { useEffect, useState } from 'react';
import { Text, View } from 'react-native';

import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {createStackNavigator} from '@react-navigation/stack';
import {NavigationContainer} from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createStackNavigator } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';

const TestBottomTabBar = createBottomTabNavigator();
const TestNativeStack1 = createNativeStackNavigator();
Expand All @@ -28,8 +28,8 @@ const TestScreen1 = () => {
flex: 1,
backgroundColor: '#000',
}}>
{Array.from({length: 100}).map((e, idx) => (
<Text style={{color: '#fff'}} key={idx}>
{Array.from({ length: 100 }).map((e, idx) => (
<Text style={{ color: '#fff' }} key={idx}>
T{idx}: {t}
</Text>
))}
Expand All @@ -54,8 +54,8 @@ const TestScreen2 = () => {
flex: 1,
backgroundColor: '#000',
}}>
{Array.from({length: 100}).map((e, idx) => (
<Text style={{color: 'red'}} key={idx}>
{Array.from({ length: 100 }).map((e, idx) => (
<Text style={{ color: 'red' }} key={idx}>
T{idx}: {t}
</Text>
))}
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test1802.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function Post({ onPress }: { onPress?: () => void }) {
function generatePhotos(
amount: number,
width: number,
height: number,
height: number
): JSX.Element[] {
const startFrom = Math.floor(Math.random() * 20) + 10;
return Array.from({ length: amount }, (_, index) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test1844.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function Post({ onPress }: { onPress?: () => void }) {
function generatePhotos(
amount: number,
width: number,
height: number,
height: number
): JSX.Element[] {
const startFrom = Math.floor(Math.random() * 20) + 10;
return Array.from({ length: amount }, (_, index) => {
Expand Down
11 changes: 9 additions & 2 deletions apps/src/tests/Test1981.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import React from 'react';
import { NavigationContainer, NavigationContext, ParamListBase } from '@react-navigation/native';
import { createNativeStackNavigator, NativeStackNavigationProp } from '@react-navigation/native-stack';
import {
NavigationContainer,
NavigationContext,
ParamListBase,
} from '@react-navigation/native';
import {
createNativeStackNavigator,
NativeStackNavigationProp,
} from '@react-navigation/native-stack';
import { View, StyleSheet, Button, Pressable, Text } from 'react-native';

type NavProp = {
Expand Down
1 change: 0 additions & 1 deletion apps/src/tests/Test2028.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import React from 'react';
import { Button, SafeAreaView, View } from 'react-native';

Expand Down
1 change: 0 additions & 1 deletion apps/src/tests/Test2223.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,3 @@ const styles = StyleSheet.create({
color: 'black',
},
});

12 changes: 6 additions & 6 deletions apps/src/tests/Test2227.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import { NavigationContainer } from '@react-navigation/native';
import {
createNativeStackNavigator,
NativeStackScreenProps,
} from '@react-navigation/native-stack';
import {Button, View, Text} from 'react-native';
import { Button, View, Text } from 'react-native';

type RootStackParamList = {
Home: undefined;
Expand All @@ -16,9 +16,9 @@ type DetailsScreenProps = NativeStackScreenProps<RootStackParamList, 'Details'>;

const Stack = createNativeStackNavigator<RootStackParamList>();

function HomeScreen({navigation}: HomeScreenProps) {
function HomeScreen({ navigation }: HomeScreenProps) {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Home Screen</Text>
<Button
title="Go to Details"
Expand All @@ -28,9 +28,9 @@ function HomeScreen({navigation}: HomeScreenProps) {
);
}

function DetailsScreen({navigation}: DetailsScreenProps) {
function DetailsScreen({ navigation }: DetailsScreenProps) {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Details Screen</Text>
<Button
title="Go to Details Again"
Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test263.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DraggableBox extends Component {
},
},
],
{ useNativeDriver: true },
{ useNativeDriver: true }
);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/src/tests/Test432.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const RootNavigator = () => {
<Text>Close</Text>
</Pressable>
),
[navigation],
[navigation]
);
return (
<RootStack.Navigator screenOptions={{ headerShown: false }}>
Expand Down
Loading
Loading