Skip to content

Commit 394e46b

Browse files
committed
refactor: replace deep relative imports with application aliases
Rewrite 4,107 deep module references in app code and stories while keeping all 3,454 existing sibling and single-parent references unchanged. Enforce the ../../** restriction in Oxlint, including its TypeScript override. Keep the root-level app-supportedversions.json as the shared source of truth. Add app/supportedversions.ts as a one-level re-export and use its alias in the consumer and both Jest mocks. Keep scripts/pinned-shortnames in place for the emoji generator; app/pinned-shortnames.ts re-exports that same module for the emoji data test. Neither root file is copied or moved. Validation: format/lint/typecheck, full Jest suite, deliberate restricted import rejection, iOS and Android Metro release bundles, AST preservation audit, and CI test-map validation. No deep relative references remain.
1 parent 01aceac commit 394e46b

905 files changed

Lines changed: 4141 additions & 4117 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxlintrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
"no-restricted-imports": [
2929
"error",
3030
{
31+
"patterns": [
32+
{
33+
"group": ["../../**"],
34+
"message": "Use a ~/ alias for imports two or more directories up."
35+
}
36+
],
3137
"paths": [
3238
{
3339
"name": "react",
@@ -57,6 +63,12 @@
5763
"no-restricted-imports": [
5864
"error",
5965
{
66+
"patterns": [
67+
{
68+
"group": ["../../**"],
69+
"message": "Use a ~/ alias for imports two or more directories up."
70+
}
71+
],
6072
"paths": [
6173
{
6274
"name": "react",

app/containers/ActionSheet/ActionSheet.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212
import { TrueSheet } from '@lodev09/react-native-true-sheet';
1313
import { GestureHandlerRootView } from 'react-native-gesture-handler';
1414

15-
import { useTheme } from '../../theme';
16-
import { isAndroid, isIOS } from '../../lib/methods/helpers';
15+
import { useTheme } from '~/theme';
16+
import { isAndroid, isIOS } from '~/lib/methods/helpers';
1717
import { Handle } from './Handle';
1818
import { type TActionSheetOptions } from './Provider';
1919
import BottomSheetContent from './BottomSheetContent';

app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useState, useRef, createRef, type ReactElement } from 'react';
22
import { StyleSheet, Text, type TextInputProps, View } from 'react-native';
33

4-
import { CustomIcon, type TIconsName } from '../../CustomIcon';
5-
import i18n from '../../../i18n';
6-
import { useTheme } from '../../../theme';
7-
import sharedStyles from '../../../views/Styles';
8-
import Button from '../../Button';
9-
import { FormTextInput } from '../../TextInput/FormTextInput';
4+
import { CustomIcon, type TIconsName } from '~/containers/CustomIcon';
5+
import i18n from '~/i18n';
6+
import { useTheme } from '~/theme';
7+
import sharedStyles from '~/views/Styles';
8+
import Button from '~/containers/Button';
9+
import { FormTextInput } from '~/containers/TextInput/FormTextInput';
1010
import { useActionSheet } from '../Provider';
1111

1212
const styles = StyleSheet.create({

app/containers/ActionSheet/BottomSheetContent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { FlatList, Text, View, type ViewProps } from 'react-native';
22
import { memo, type ReactElement } from 'react';
33
import { useSafeAreaInsets } from 'react-native-safe-area-context';
44

5-
import I18n from '../../i18n';
6-
import { useTheme } from '../../theme';
7-
import { isAndroid } from '../../lib/methods/helpers';
5+
import I18n from '~/i18n';
6+
import { useTheme } from '~/theme';
7+
import { isAndroid } from '~/lib/methods/helpers';
88
import { type IActionSheetItem, Item } from './Item';
99
import { type TActionSheetOptionsItem } from './Provider';
1010
import styles from './styles';

app/containers/ActionSheet/Handle.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { View } from 'react-native';
33
import { RectButton } from 'react-native-gesture-handler';
44

55
import styles from './styles';
6-
import { themes } from '../../lib/constants/colors';
7-
import { useTheme } from '../../theme';
8-
import i18n from '../../i18n';
6+
import { themes } from '~/lib/constants/colors';
7+
import { useTheme } from '~/theme';
8+
import i18n from '~/i18n';
99

1010
export const Handle = forwardRef<View, { onPress: () => void }>(({ onPress }, ref) => {
1111
const { theme } = useTheme();

app/containers/ActionSheet/Item.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { memo } from 'react';
22
import { Text, View } from 'react-native';
33

44
import { CustomIcon } from '../CustomIcon';
5-
import { useTheme } from '../../theme';
6-
import EventEmitter from '../../lib/methods/helpers/events';
7-
import I18n from '../../i18n';
5+
import { useTheme } from '~/theme';
6+
import EventEmitter from '~/lib/methods/helpers/events';
7+
import I18n from '~/i18n';
88
import { type TActionSheetOptionsItem } from './Provider';
99
import styles from './styles';
1010
import { LISTENER } from '../Toast';

app/containers/ActionSheet/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { StyleSheet } from 'react-native';
22

3-
import sharedStyles from '../../views/Styles';
3+
import sharedStyles from '~/views/Styles';
44

55
export default StyleSheet.create({
66
container: {

app/containers/AudioPlayer/PlayButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type ReactElement } from 'react';
22

33
import { CustomIcon } from '../CustomIcon';
4-
import { useTheme } from '../../theme';
4+
import { useTheme } from '~/theme';
55
import styles from './styles';
66
import RCActivityIndicator from '../ActivityIndicator';
77
import { AUDIO_BUTTON_HIT_SLOP } from './constants';

app/containers/AudioPlayer/PlaybackSpeed.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Text } from 'react-native';
22

3-
import i18n from '../../i18n';
3+
import i18n from '~/i18n';
44
import styles from './styles';
5-
import { useTheme } from '../../theme';
5+
import { useTheme } from '~/theme';
66
import { AUDIO_PLAYBACK_SPEED, AVAILABLE_SPEEDS } from './constants';
7-
import { useUserPreferences } from '../../lib/methods/userPreferences';
7+
import { useUserPreferences } from '~/lib/methods/userPreferences';
88
import NativeButton from '../NativeButton';
99

1010
const PlaybackSpeed = () => {

app/containers/AudioPlayer/Seek.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Animated, {
1111
import { scheduleOnRN } from 'react-native-worklets';
1212

1313
import styles from './styles';
14-
import { useTheme } from '../../theme';
14+
import { useTheme } from '~/theme';
1515
import { SEEK_HIT_SLOP, THUMB_SEEK_SIZE, ACTIVE_OFFSET_X, DEFAULT_TIME_LABEL } from './constants';
1616

1717
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);

0 commit comments

Comments
 (0)