Skip to content

Commit

Permalink
chore: fix "react-in-jsx-scope" ESLint errors
Browse files Browse the repository at this point in the history
This fixes all 50 violations of the [`react/react-in-jsx-scope`][0] lint
rule.

In the docs for that rule:

> If you are using the [new JSX transform from React 17][1], you should
> disable this rule by extending `react/jsx-runtime` in your eslint
> config (add `"plugin:react/jsx-runtime"` to `"extends"`).

We are, so we can do this! It also lets us remove many `React` imports.

[0]: https://github.com/jsx-eslint/eslint-plugin-react/blob/4467db503e38b9356517cf6926d11be544ccf4b1/docs/rules/react-in-jsx-scope.md
[1]: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
  • Loading branch information
EvanHahn authored and ErikSin committed Apr 29, 2024
1 parent 8fceead commit 715e1c0
Show file tree
Hide file tree
Showing 46 changed files with 7 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
extends: ['@react-native', 'prettier'],
extends: ['@react-native', 'plugin:react/jsx-runtime', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
overrides: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"eslint": "^8.19.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.34.1",
"execa": "^8.0.1",
"glob": "^9.3.0",
"husky": "^8.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/frontend/Navigation/AppStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {NativeStackNavigationOptions} from '@react-navigation/native-stack/lib/typescript/src/types';
import {WHITE} from '../lib/styles';
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/Navigation/ScreenGroups/AppScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {
createBottomTabNavigator,
} from '@react-navigation/bottom-tabs';
import {NavigatorScreenParams} from '@react-navigation/native';
import * as React from 'react';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import {useForegroundPermissions} from 'expo-location';

import {HomeHeader} from '../../sharedComponents/HomeHeader';
import {RootStack} from '../AppStack';
import {MessageDescriptor} from 'react-intl';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {RootStack} from '../AppStack';
import {IntroToCoMapeo} from '../../screens/IntroToCoMapeo';
import {DeviceNaming} from '../../screens/DeviceNaming';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/AddPhoto.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {View, StyleSheet, TouchableNativeFeedback} from 'react-native';
import {Text} from '../sharedComponents/Text';
import debug from 'debug';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/AppPasscode/PasscodeIntro.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {defineMessages, useIntl} from 'react-intl';
import {StyleSheet, View, ScrollView} from 'react-native';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/CameraScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {View, StyleSheet} from 'react-native';
import {useIsFocused} from '@react-navigation/native';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/FatalError.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {StyleSheet, View} from 'react-native';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import RNRestart from 'react-native-restart';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/GpsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {View, ScrollView, StyleSheet} from 'react-native';
import {
defineMessages,
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/IntroToCoMapeo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import TopoBackground from '../images/TopoLogo.svg';
import CoMapeoTextAsSVG from '../images/CoMapeoText.svg';
import {StyleSheet, View, Image} from 'react-native';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/MapScreen/ObsevationMapLayer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Observation} from '@mapeo/schema';
import React from 'react';
import MapboxGL from '@rnmapbox/maps';
import {useAllObservations} from '../../hooks/useAllObservations';
import {useNavigationFromHomeTabs} from '../../hooks/useNavigationWithTypes';
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/screens/MapScreen/UserLocation.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {UserLocation as MBUserLocation} from '@rnmapbox/maps';
import * as React from 'react';
import {useCurrentTrackStore} from '../../hooks/tracks/useCurrentTrackStore';
import {useIsFullyFocused} from '../../hooks/useIsFullyFocused';
import {UserTooltipMarker} from './track/UserTooltipMarker';

// import {useExperiments} from '../../hooks/useExperiments';
interface UserLocationProps {
minDisplacement: number;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {View, StyleSheet} from 'react-native';

import {IconButton} from '../../sharedComponents/IconButton';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/ObservationEdit/DescriptionField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {defineMessages, useIntl} from 'react-intl';
import {StyleSheet, TextInput} from 'react-native';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/ObservationEdit/PresetView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {defineMessages, useIntl} from 'react-intl';
import {View, Text, StyleSheet} from 'react-native';
import {BLACK, LIGHT_BLUE} from '../../lib/styles';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/ObservationEdit/SaveButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {Alert, AlertButton, View} from 'react-native';
import debug from 'debug';
import {defineMessages, useIntl} from 'react-intl';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {View, StyleSheet, Dimensions} from 'react-native';
import {Text} from '../../sharedComponents/Text';
import {defineMessages, useIntl} from 'react-intl';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/ObservationsList/SettingsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {SettingsIcon} from '../../sharedComponents/icons';

import {IconButton} from '../../sharedComponents/IconButton';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {ScrollView, StyleSheet} from 'react-native';
import {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import {MessageDescriptor, defineMessages, useIntl} from 'react-intl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {StyleSheet, View} from 'react-native';
import {Text} from '../../../../../sharedComponents/Text';
import {defineMessages, useIntl} from 'react-intl';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import React from 'react';
import {WHITE} from '../../../../../lib/styles';
import {Button} from '../../../../../sharedComponents/Button';
import {DeviceNameWithIcon} from '../../../../../sharedComponents/DeviceNameWithIcon';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {defineMessages, useIntl} from 'react-intl';
import {Text} from '../../../../sharedComponents/Text';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import {DARK_GREY, LIGHT_GREY} from '../../../../lib/styles';
import React from 'react';
import {TouchableOpacity} from 'react-native-gesture-handler';
import {DeviceNameWithIcon} from '../../../../sharedComponents/DeviceNameWithIcon';
import {RoleWithIcon} from '../../../../sharedComponents/RoleWithIcon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {MessageDescriptor, defineMessages, useIntl} from 'react-intl';
import {
CREATOR_ROLE_ID,
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/Settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {FormattedMessage, defineMessages} from 'react-intl';
import {ScrollView} from 'react-native-gesture-handler';
import {useNavigationFromRoot} from '../../hooks/useNavigationWithTypes';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/screens/Success.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {StyleSheet, View} from 'react-native';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/CustomHeaderLeft.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {HeaderBackButton} from '@react-navigation/elements';
import {HeaderBackButtonProps} from '@react-navigation/native-stack/lib/typescript/src/types';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/DateDistance.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {Text} from './Text';
import {FormattedRelativeTime, FormattedDate} from 'react-intl';
import {useAppState} from '@react-native-community/hooks';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/DeviceNameWithIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {View, StyleSheet} from 'react-native';
import DeviceMobile from '../images/DeviceMobile.svg';
import DeviceDesktop from '../images/DeviceDesktop.svg';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/ErrorModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {BottomSheetModal, useBottomSheetModal} from './BottomSheetModal';
import {Button} from './Button';
import {StyleSheet, View} from 'react-native';
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/sharedComponents/HomeHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {FC} from 'react';
import {View, StyleSheet} from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import {IconButton} from './IconButton';
import {ObservationListIcon, SyncIconCircle} from './icons';
import {GPSPill} from './GPSPill';
import {BottomTabHeaderProps} from '@react-navigation/bottom-tabs';
import {FC} from 'react';

export const HomeHeader: FC<BottomTabHeaderProps> = ({navigation}) => {
return (
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {View, StyleSheet, Easing} from 'react-native';
import {DotIndicator} from 'react-native-indicators';
import {ViewStyleProp} from '../sharedTypes';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Pill.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {FormattedMessage, MessageDescriptor} from 'react-intl';
import {View, Text, StyleSheet} from 'react-native';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/ProjectInviteBottomSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {
BottomSheetContent,
BottomSheetModal,
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {View, StyleSheet} from 'react-native';
import {Picker} from '@react-native-picker/picker';

Expand Down
2 changes: 0 additions & 2 deletions src/frontend/sharedComponents/SelectOne.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react';

import {List, ListItem, ListItemText, ListItemIcon} from './List';

type SelectOneProps<T> = {
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/TextButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {StyleSheet} from 'react-native';
import {Text} from './Text';
import {TouchableNativeFeedback} from '../sharedComponents/Touchables';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Touchables/index.ios.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {TouchableHighlight} from 'react-native';

export {Touchable, TouchableHighlight, TouchableOpacity} from 'react-native';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Touchables/index.ios.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {TouchableHighlight, TouchableHighlightProps} from 'react-native';

export {Touchable, TouchableHighlight, TouchableOpacity} from 'react-native';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Touchables/index.web.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {TouchableHighlight} from 'react-native';

export {Touchable, TouchableHighlight, TouchableOpacity} from 'react-native';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/Touchables/index.web.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {TouchableHighlight, TouchableHighlightProps} from 'react-native';

export {Touchable, TouchableHighlight, TouchableOpacity} from 'react-native';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/WifiBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {StyleSheet, View} from 'react-native';
import {defineMessages, FormattedMessage} from 'react-intl';
import DeviceInfo from 'react-native-device-info';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/icons/Progress.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {Circle, CircleSnail} from 'react-native-progress';

type Props = {
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/icons/Progress.web.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {View} from 'react-native';

export const Progress = ({size = 30, color = 'white'}) => (
Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/icons/SaveIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {View, StyleSheet} from 'react-native';
import Icon from 'react-native-vector-icons/Octicons';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/icons/SyncIconCircle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {View, StyleSheet} from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';

Expand Down
1 change: 0 additions & 1 deletion src/frontend/sharedComponents/icons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
Expand Down

0 comments on commit 715e1c0

Please sign in to comment.