diff --git a/samples/expo/.eslintrc.js b/samples/expo/.eslintrc.js new file mode 100644 index 0000000000..3abe647bfa --- /dev/null +++ b/samples/expo/.eslintrc.js @@ -0,0 +1,33 @@ +module.exports = { + root: true, + extends: ['expo', '@react-native'], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + settings: { + 'import/resolver': { + typescript: { + project: ['tsconfig.json'], + }, + node: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + }, + }, + }, + overrides: [ + { + files: ['*.ts', '*.tsx'], + rules: { + '@typescript-eslint/no-shadow': ['error'], + 'no-shadow': 'off', + 'no-undef': 'off', + quotes: [2, 'single', { avoidEscape: true }], + // Disable deprecated rules removed in @typescript-eslint v8 + '@typescript-eslint/func-call-spacing': 'off', + '@typescript-eslint/ban-types': 'off', + // Disable import/no-unresolved for workspace packages that may not be built yet + 'import/no-unresolved': ['error', { ignore: ['^@sentry/'] }], + }, + }, + ], + ignorePatterns: ['/node_modules', '/ios', '/android', '/.expo'], +}; diff --git a/samples/expo/.prettierignore b/samples/expo/.prettierignore new file mode 100644 index 0000000000..6cb1582f53 --- /dev/null +++ b/samples/expo/.prettierignore @@ -0,0 +1,6 @@ +node_modules/ +ios/ +android/ +.expo/ +*.md + diff --git a/samples/expo/.prettierrc.js b/samples/expo/.prettierrc.js new file mode 100644 index 0000000000..2ae7b381ed --- /dev/null +++ b/samples/expo/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: true, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/samples/expo/app.json b/samples/expo/app.json index cca528d235..dc009914bd 100644 --- a/samples/expo/app.json +++ b/samples/expo/app.json @@ -14,9 +14,7 @@ "resizeMode": "contain", "backgroundColor": "#ffffff" }, - "assetBundlePatterns": [ - "**/*" - ], + "assetBundlePatterns": ["**/*"], "ios": { "supportsTablet": true, "bundleIdentifier": "io.sentry.expo.sample", @@ -90,4 +88,4 @@ "url": "https://u.expo.dev/00000000-0000-0000-0000-000000000000" } } -} \ No newline at end of file +} diff --git a/samples/expo/app/(tabs)/_layout.tsx b/samples/expo/app/(tabs)/_layout.tsx index 30914fbc0c..1619232206 100644 --- a/samples/expo/app/(tabs)/_layout.tsx +++ b/samples/expo/app/(tabs)/_layout.tsx @@ -12,12 +12,40 @@ function TabBarIcon(props: { name: React.ComponentProps['name']; color: string; }) { + // eslint-disable-next-line react-native/no-inline-styles return ; } +function CodeIcon({ color }: { color: string }) { + return ; +} + +function InfoButton({ colorScheme }: { colorScheme: 'light' | 'dark' | null }) { + return ( + + + {({ pressed }) => ( + + )} + + + ); +} + export default function TabLayout() { const colorScheme = useColorScheme(); + const renderInfoButton = React.useCallback( + () => , + [colorScheme], + ); + return ( , - headerRight: () => ( - - - {({ pressed }) => ( - - )} - - - ), + tabBarIcon: CodeIcon, + headerRight: renderInfoButton, }} /> , + tabBarIcon: CodeIcon, }} /> diff --git a/samples/expo/app/(tabs)/index.tsx b/samples/expo/app/(tabs)/index.tsx index 0aa94be894..44cb99e51d 100644 --- a/samples/expo/app/(tabs)/index.tsx +++ b/samples/expo/app/(tabs)/index.tsx @@ -79,7 +79,9 @@ export default function TabOneScreen() { title="Native Crash" onPress={() => { if (isRunningInExpoGo()) { - console.warn('Not supported in Expo Go. Build the application to test this feature.'); + console.warn( + 'Not supported in Expo Go. Build the application to test this feature.', + ); return; } Sentry.nativeCrash(); @@ -138,7 +140,9 @@ export default function TabOneScreen() {