Skip to content

Commit b391cb1

Browse files
committed
chore: lerna & projects setup for conventional commits
1 parent c8c37e9 commit b391cb1

27 files changed

+6737
-1884
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.husky/commit-msg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx commitlint --edit $1
5+
npx commitlint --edit $1
File renamed without changes.

commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

dotgit/hooks/pre-commit-format.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
set -e
44

5-
if ! yarn run lint; then
6-
yarn run lint-fix
5+
if ! yarn lerna run lint; then
6+
yarn lerna run lint-fix
77
echo "some files were not formatted correctly (prettier/eslint) commit aborted!"
88
echo "your changes are still staged, you can accept formatting changes with git add or ignore them by adding --no-verify to git commit"
99
exit 1

examples/SampleApp/App.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ const DrawerNavigator: React.FC = () => {
8686

8787
return (
8888
<Drawer.Navigator
89-
screenOptions={{
90-
gestureEnabled: Platform.OS === 'ios' && overlay === 'none',
91-
}}
9289
drawerContent={(props) => <MenuDrawer {...props} />}
9390
drawerStyle={{
9491
width: 300,
9592
}}
93+
screenOptions={{
94+
gestureEnabled: Platform.OS === 'ios' && overlay === 'none',
95+
}}
9696
>
9797
<Drawer.Screen component={HomeScreen} name='HomeScreen' options={{ headerShown: false }} />
9898
</Drawer.Navigator>

examples/SampleApp/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
"name": "SampleApp",
33
"version": "0.0.22",
44
"private": true,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/GetStream/stream-chat-react-native.git"
8+
},
59
"scripts": {
610
"android": "npx react-native run-android",
711
"ios": "npx react-native run-ios",
812
"start": "npx react-native start",
913
"test": "jest",
1014
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
15+
"lint-fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
1116
"postinstall": "patch-package"
1217
},
1318
"dependencies": {
@@ -50,6 +55,11 @@
5055
"@typescript-eslint/parser": "4.24.0",
5156
"babel-jest": "26.6.3",
5257
"eslint": "7.26.0",
58+
"eslint-plugin-babel": "^5.3.1",
59+
"eslint-plugin-better-styled-components": "^1.1.2",
60+
"eslint-plugin-markdown": "^2.2.0",
61+
"eslint-plugin-sort-destructure-keys": "^1.3.5",
62+
"eslint-plugin-typescript-sort-keys": "^1.7.0",
5363
"jest": "26.6.3",
5464
"metro-react-native-babel-preset": "0.66.0",
5565
"react-test-renderer": "17.0.2",

examples/SampleApp/src/ChatUsers.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@ import { UserResponse } from 'stream-chat';
22
import { LocalUserType } from './types';
33

44
export const USER_TOKENS: Record<string, string> = {
5-
vishal:
6-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlzaGFsIn0.HOlVh-ZyQnjyuL20G-67RTgKufBuAH-I-gbEELFlass',
7-
vir: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlyIn0.Whk_WyeN9TIuNahSu3KFVRTohF7HDbQq9Ka17kZ6zq4',
8-
tommaso:
9-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.sfDKQ5peCwo0oObPDo-AFKauqv5uYbesukOOLpKaDOQ',
105
neil: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoibmVpbCJ9.ty2YhwFaVEYkq1iUfY8s1G0Um3MpiVYpWK-b5kMky0w',
11-
thierry:
12-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGhpZXJyeSJ9.Rm6o4HHlUE5zYoaJG1YoEE-V219j4KHTqZ9zqXlCHBQ',
136
qatest1:
147
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MSJ9.5Nnj6MsauhjP7_D8jW9WbRovLv5uaxn8LPZZ-HB3mh4',
158
qatest2:
169
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoicWF0ZXN0MiJ9.9v0igQXv_IfL_uKZ6Xz9MXJOS-DMdkeWScJv-POFoTE',
10+
thierry:
11+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidGhpZXJyeSJ9.Rm6o4HHlUE5zYoaJG1YoEE-V219j4KHTqZ9zqXlCHBQ',
12+
tommaso:
13+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidG9tbWFzbyJ9.sfDKQ5peCwo0oObPDo-AFKauqv5uYbesukOOLpKaDOQ',
14+
vir: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlyIn0.Whk_WyeN9TIuNahSu3KFVRTohF7HDbQq9Ka17kZ6zq4',
15+
vishal:
16+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlzaGFsIn0.HOlVh-ZyQnjyuL20G-67RTgKufBuAH-I-gbEELFlass',
1717
};
1818
export const USERS: Record<string, UserResponse<LocalUserType>> = {
1919
neil: {
2020
id: 'neil',
2121
image: 'https://ca.slack-edge.com/T02RM6X6B-U01173D1D5J-0dead6eea6ea-512',
2222
name: 'Neil Hannah',
2323
},
24+
qatest1: {
25+
id: 'qatest1',
26+
image: `https://randomuser.me/api/portraits/thumb/men/10.jpg`,
27+
name: 'QA Test 1',
28+
},
29+
qatest2: {
30+
id: 'qatest2',
31+
image: `https://randomuser.me/api/portraits/thumb/men/11.jpg`,
32+
name: 'QA Test 2',
33+
},
2434
thierry: {
2535
id: 'thierry',
2636
image: 'https://ca.slack-edge.com/T02RM6X6B-U02RM6X6D-g28a1278a98e-512',
@@ -41,14 +51,4 @@ export const USERS: Record<string, UserResponse<LocalUserType>> = {
4151
image: 'https://ca.slack-edge.com/T02RM6X6B-UHGDQJ8A0-31658896398c-512',
4252
name: 'Vishal Narkhede',
4353
},
44-
qatest1: {
45-
id: 'qatest1',
46-
image: `https://randomuser.me/api/portraits/thumb/men/10.jpg`,
47-
name: 'QA Test 1',
48-
},
49-
qatest2: {
50-
id: 'qatest2',
51-
image: `https://randomuser.me/api/portraits/thumb/men/11.jpg`,
52-
name: 'QA Test 2',
53-
},
5454
};

examples/SampleApp/src/components/ChannelPreview.tsx

+10-11
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,17 @@ export const ChannelPreview: React.FC<
6868

6969
const { setData: setDataBottomSheet } = useBottomSheetOverlayContext();
7070

71-
const { setData, data } = useChannelInfoOverlayContext();
71+
const { data, setData } = useChannelInfoOverlayContext();
7272

73-
const { client } =
74-
useChatContext<
75-
LocalAttachmentType,
76-
LocalChannelType,
77-
LocalCommandType,
78-
LocalEventType,
79-
LocalMessageType,
80-
LocalReactionType,
81-
LocalUserType
82-
>();
73+
const { client } = useChatContext<
74+
LocalAttachmentType,
75+
LocalChannelType,
76+
LocalCommandType,
77+
LocalEventType,
78+
LocalMessageType,
79+
LocalReactionType,
80+
LocalUserType
81+
>();
8382

8483
const navigation = useNavigation<ChannelListScreenNavigationProp>();
8584

examples/SampleApp/src/components/ConfirmationBottomSheet.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const styles = StyleSheet.create({
2323
justifyContent: 'space-between',
2424
},
2525
container: {
26-
height: 224,
2726
borderTopLeftRadius: 16,
2827
borderTopRightRadius: 16,
28+
height: 224,
2929
},
3030
description: {
3131
alignItems: 'center',

examples/SampleApp/src/components/MessageSearch/MessageSearchList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ export const MessageSearchList: React.FC<MessageSearchListProps> = ({
119119
contentContainerStyle={styles.contentContainer}
120120
// TODO: Remove the following filter once we have two way scroll functionality on threads.
121121
data={messages ? messages.filter(({ parent_id }) => !parent_id) : []}
122-
ListEmptyComponent={EmptySearchIndicator}
123122
keyboardDismissMode='on-drag'
123+
ListEmptyComponent={EmptySearchIndicator}
124124
onEndReached={loadMore}
125125
onRefresh={refreshList}
126126
refreshing={refreshing}

examples/SampleApp/src/components/NewDirectMessagingSendButton.tsx

+18-20
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,25 @@ export const NewDirectMessagingSendButton = (
143143
>,
144144
) => {
145145
const navigation = useNavigation<NewDirectMessagingScreenNavigationProp>();
146-
const { channel } =
147-
useChannelContext<
148-
LocalAttachmentType,
149-
LocalChannelType,
150-
LocalCommandType,
151-
LocalEventType,
152-
LocalMessageType,
153-
LocalReactionType,
154-
LocalUserType
155-
>();
146+
const { channel } = useChannelContext<
147+
LocalAttachmentType,
148+
LocalChannelType,
149+
LocalCommandType,
150+
LocalEventType,
151+
LocalMessageType,
152+
LocalReactionType,
153+
LocalUserType
154+
>();
156155

157-
const { giphyActive, text } =
158-
useMessageInputContext<
159-
LocalAttachmentType,
160-
LocalChannelType,
161-
LocalCommandType,
162-
LocalEventType,
163-
LocalMessageType,
164-
LocalReactionType,
165-
LocalUserType
166-
>();
156+
const { giphyActive, text } = useMessageInputContext<
157+
LocalAttachmentType,
158+
LocalChannelType,
159+
LocalCommandType,
160+
LocalEventType,
161+
LocalMessageType,
162+
LocalReactionType,
163+
LocalUserType
164+
>();
167165

168166
const sendMessage = async () => {
169167
if (!channel) return;

examples/SampleApp/src/components/UserInfoOverlay.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,15 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
116116
const { overlayOpacity, visible } = props;
117117

118118
const { overlay, setOverlay } = useAppOverlayContext();
119-
const { client } =
120-
useChatContext<
121-
LocalAttachmentType,
122-
LocalChannelType,
123-
LocalCommandType,
124-
LocalEventType,
125-
LocalMessageType,
126-
LocalReactionType,
127-
LocalUserType
128-
>();
119+
const { client } = useChatContext<
120+
LocalAttachmentType,
121+
LocalChannelType,
122+
LocalCommandType,
123+
LocalEventType,
124+
LocalMessageType,
125+
LocalReactionType,
126+
LocalUserType
127+
>();
129128
const { setData } = useBottomSheetOverlayContext();
130129
const { data, reset } = useUserInfoOverlayContext();
131130

examples/SampleApp/src/hooks/useChatClient.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ import type {
1818
const getRandomInt = (min: number, max: number) => Math.floor(Math.random() * (max - min)) + min;
1919

2020
export const useChatClient = () => {
21-
const [chatClient, setChatClient] =
22-
useState<StreamChat<
23-
LocalAttachmentType,
24-
LocalChannelType,
25-
LocalCommandType,
26-
LocalEventType,
27-
LocalMessageType,
28-
LocalReactionType,
29-
LocalUserType
30-
> | null>(null);
21+
const [chatClient, setChatClient] = useState<StreamChat<
22+
LocalAttachmentType,
23+
LocalChannelType,
24+
LocalCommandType,
25+
LocalEventType,
26+
LocalMessageType,
27+
LocalReactionType,
28+
LocalUserType
29+
> | null>(null);
3130
const [isConnecting, setIsConnecting] = useState(true);
3231

3332
const loginUser = async (config: LoginConfig) => {

examples/SampleApp/src/screens/ChannelImagesScreen.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,15 @@ export const ChannelImagesScreen: React.FC<ChannelImagesScreenProps> = ({
7575
params: { channel },
7676
},
7777
}) => {
78-
const { images, setImage, setImages } =
79-
useImageGalleryContext<
80-
LocalAttachmentType,
81-
LocalChannelType,
82-
LocalCommandType,
83-
LocalEventType,
84-
LocalMessageType,
85-
LocalReactionType,
86-
LocalUserType
87-
>();
78+
const { images, setImage, setImages } = useImageGalleryContext<
79+
LocalAttachmentType,
80+
LocalChannelType,
81+
LocalCommandType,
82+
LocalEventType,
83+
LocalMessageType,
84+
LocalReactionType,
85+
LocalUserType
86+
>();
8887
const { setBlurType, setOverlay } = useOverlayContext();
8988
const { loading, loadMore, messages } = usePaginatedAttachments(channel, 'image');
9089
const {

examples/SampleApp/src/screens/ChannelListScreen.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ export const ChannelListScreen: React.FC = () => {
182182
LocalUserType
183183
>
184184
additionalFlatListProps={{
185-
keyboardDismissMode: 'on-drag',
186185
getItemLayout: (_, index) => ({
187186
index,
188187
length: 65,
189188
offset: 65 * index,
190189
}),
190+
keyboardDismissMode: 'on-drag',
191191
}}
192192
filters={filters}
193193
HeaderNetworkDownIndicator={() => null}

examples/SampleApp/src/screens/ChannelScreen.tsx

+12-13
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,18 @@ export const ChannelScreen: React.FC<ChannelScreenProps> = ({
119119
},
120120
} = useTheme();
121121

122-
const [channel, setChannel] =
123-
useState<
124-
| StreamChatChannel<
125-
LocalAttachmentType,
126-
LocalChannelType,
127-
LocalCommandType,
128-
LocalEventType,
129-
LocalMessageType,
130-
LocalReactionType,
131-
LocalUserType
132-
>
133-
| undefined
134-
>(channelFromProp);
122+
const [channel, setChannel] = useState<
123+
| StreamChatChannel<
124+
LocalAttachmentType,
125+
LocalChannelType,
126+
LocalCommandType,
127+
LocalEventType,
128+
LocalMessageType,
129+
LocalReactionType,
130+
LocalUserType
131+
>
132+
| undefined
133+
>(channelFromProp);
135134

136135
const [selectedThread, setSelectedThread] =
137136
useState<

examples/SampleApp/src/screens/NewDirectMessagingScreen.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import {
66
Group,
77
MessageInput,
88
MessageList,
9+
SendButton,
10+
SendButtonProps,
911
User,
1012
UserAdd,
1113
useTheme,
12-
SendButton,
13-
SendButtonProps,
1414
} from 'stream-chat-react-native';
1515

1616
import { RoundButton } from '../components/RoundButton';

examples/SampleApp/src/screens/ThreadScreen.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ const ThreadHeader: React.FC<ThreadHeaderProps> = ({ thread }) => {
5555
return (
5656
<ScreenHeader
5757
inSafeArea
58-
titleText='Thread Reply'
5958
subtitleText={typing ? typing : `with ${thread?.user?.name}`}
59+
titleText='Thread Reply'
6060
/>
6161
);
6262
};

examples/SampleApp/src/screens/UserSelectorScreen.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export const UserSelectorScreen: React.FC<Props> = ({ navigation }) => {
102102

103103
return (
104104
<SafeAreaView
105-
style={[styles.container, { backgroundColor: white_snow }]}
106105
edges={['right', 'top', 'left']}
106+
style={[styles.container, { backgroundColor: white_snow }]}
107107
>
108108
<ScrollView contentContainerStyle={styles.contentContainer} style={styles.scrollContainer}>
109109
<View style={styles.titleContainer}>
@@ -191,9 +191,9 @@ export const UserSelectorScreen: React.FC<Props> = ({ navigation }) => {
191191
<View
192192
style={[
193193
{
194+
backgroundColor: white_snow,
194195
paddingBottom: bottom ? bottom : 16,
195196
paddingTop: 16,
196-
backgroundColor: white_snow,
197197
},
198198
]}
199199
>

0 commit comments

Comments
 (0)