Skip to content

Commit d85338d

Browse files
committed
chore: upgrade plugins decl a bit and fix all broken eslint issues
1 parent 18d431f commit d85338d

File tree

8 files changed

+24
-7
lines changed

8 files changed

+24
-7
lines changed

examples/SampleApp/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const App = () => {
139139
...(colorScheme === 'dark' ? DarkTheme : DefaultTheme).colors,
140140
background: streamChatTheme.colors?.white_snow || '#FCFCFC',
141141
},
142+
fonts: (colorScheme === 'dark' ? DarkTheme : DefaultTheme).fonts,
142143
dark: colorScheme === 'dark',
143144
}}
144145
>
@@ -182,7 +183,7 @@ const DrawerNavigatorWrapper: React.FC<{
182183
<Chat<StreamChatGenerics>
183184
client={chatClient}
184185
enableOfflineSupport
185-
// @ts-expect-error
186+
// @ts-expect-error - the `ImageComponent` prop is generic, meaning we can expect an error
186187
ImageComponent={FastImage}
187188
isMessageAIGenerated={(message: MessageType) => !!message.ai_generated}
188189
>

examples/SampleApp/eslint.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import eslintPluginReact from 'eslint-plugin-react';
22
import eslintPluginReactNative from 'eslint-plugin-react-native';
3+
import eslintPluginReactNativeOfficial from '@react-native/eslint-plugin';
34
import eslintPluginComments from 'eslint-plugin-eslint-comments';
45
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
56
import eslintPluginJest from 'eslint-plugin-jest';
@@ -8,6 +9,11 @@ import eslintReactNativeConfig from '@react-native/eslint-config';
89

910
import tsEslint from 'typescript-eslint';
1011

12+
/**
13+
* @react-native/eslint-config is for some reason still using the old notation
14+
* for globals. We parse them manually here to make sure they're compatible with
15+
* the new config. All globals which were previously set to true are now readonly.
16+
*/
1117
const globals = Object.keys(eslintReactNativeConfig.globals).reduce((acc, key) => {
1218
if (eslintReactNativeConfig.globals[key]) {
1319
acc[key] = 'readonly';
@@ -36,7 +42,13 @@ export default tsEslint.config(
3642
console: 'readonly',
3743
},
3844
},
45+
settings: {
46+
react: {
47+
version: 'detect',
48+
},
49+
},
3950
plugins: {
51+
'@react-native': eslintPluginReactNativeOfficial,
4052
react: eslintPluginReact,
4153
'react-native': eslintPluginReactNative,
4254
'eslint-comments': eslintPluginComments,

examples/SampleApp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@react-native-community/cli-platform-ios": "15.1.3",
6060
"@react-native/babel-preset": "0.77.1",
6161
"@react-native/eslint-config": "^0.77.1",
62+
"@react-native/eslint-plugin": "^0.77.1",
6263
"@react-native/metro-config": "0.77.1",
6364
"@react-native/typescript-config": "0.77.1",
6465
"@rnx-kit/metro-config": "^2.0.1",

examples/SampleApp/src/components/AddMemberBottomSheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const AddMemberBottomSheet: React.FC = () => {
102102
reset();
103103
setOverlay('none');
104104
} catch (err) {
105+
console.warn('An error has occurred while adding members: ', err);
105106
setError(true);
106107
}
107108
setAddMemberQueryInProgress(false);

examples/SampleApp/src/hooks/usePaginatedAttachments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const usePaginatedAttachments = (
6161
hasMoreResults.current = false;
6262
}
6363
} catch (e) {
64+
console.warn('An error has occurred while fetching attachments: ', e);
6465
// do nothing;
6566
}
6667
queryInProgress.current = false;

examples/SampleApp/src/screens/AdvancedUserSelectorScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const LabeledTextInput: React.FC<LabeledTextInputProps> = ({
8686
backgroundColor: white_smoke,
8787
borderColor,
8888
borderWidth: 1,
89-
paddingVertical: !!value || !!error ? 16 : 8,
89+
paddingVertical: !!value || error ? 16 : 8,
9090
},
9191
]}
9292
>
@@ -102,7 +102,7 @@ export const LabeledTextInput: React.FC<LabeledTextInputProps> = ({
102102
{label}
103103
</Text>
104104
)}
105-
{!!error && (
105+
{error && (
106106
<Text
107107
style={[
108108
styles.labelText,
@@ -236,6 +236,7 @@ export const AdvancedUserSelectorScreen: React.FC = () => {
236236
Alert.alert(
237237
'Login resulted in error. Please make sure you have entered valid credentials',
238238
);
239+
console.warn(e);
239240
}
240241
}}
241242
style={[

examples/SampleApp/src/screens/GroupChannelDetailsScreen.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ export const GroupChannelDetailsScreen: React.FC<GroupChannelDetailsProps> = ({
282282
>
283283
<View style={styles.memberRow}>
284284
<Avatar
285-
channelId={channel.id}
286-
id={member.user?.id}
287285
image={member.user?.image}
288286
name={member.user?.name}
289287
online={member.user?.online}
@@ -355,7 +353,9 @@ export const GroupChannelDetailsScreen: React.FC<GroupChannelDetailsProps> = ({
355353
<TouchableOpacity
356354
onPress={() => {
357355
setGroupName(channel.data?.name);
358-
textInputRef.current && textInputRef.current.blur();
356+
if (textInputRef.current) {
357+
textInputRef.current.blur();
358+
}
359359
}}
360360
style={{
361361
paddingRight: 8,

examples/SampleApp/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@
22862286
eslint-plugin-react-hooks "^4.6.0"
22872287
eslint-plugin-react-native "^4.0.0"
22882288

2289-
"@react-native/[email protected]":
2289+
"@react-native/[email protected]", "@react-native/eslint-plugin@^0.77.1":
22902290
version "0.77.1"
22912291
resolved "https://registry.yarnpkg.com/@react-native/eslint-plugin/-/eslint-plugin-0.77.1.tgz#34e13d7bab2af1a0d68fc609547ba205df51331d"
22922292
integrity sha512-K1nuM/aLWYpUq8y/KJ34UCazYE4gdY1mxkwXhRSadDVpogK4Z/0xbSGYZQDHfvmOyQMZkM6mplQLztGrxD/CvA==

0 commit comments

Comments
 (0)