Skip to content

Commit

Permalink
Bump prettier to version 3.3.3 (#3198)
Browse files Browse the repository at this point in the history
## Description

Bump prettier version to 3.3.3.
Required for
[this](#3146 (comment))
issue to be resolved.

## Test plan

- confirm all CIs are passing
- confirm none of the examples are crashing
  • Loading branch information
latekvo authored Nov 27, 2024
1 parent 3daca2d commit e827e9b
Show file tree
Hide file tree
Showing 22 changed files with 126 additions and 69 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"esbuild": "^0.20.2",
"esbuild-register": "^3.5.0",
"eslint-plugin-mdx": "^2.2.0",
"prettier": "^2.8.4",
"prettier": "^3.3.3",
"typescript": "^4.7.4",
"webpack-cli": "^5.0.1"
},
Expand Down
3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
"babel-jest": "^29.7.0",
"babel-plugin-module-resolver": "^5.0.2",
"eslint": "^7.32.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "2.7.1",
"prettier": "3.3.3",
"react-test-renderer": "18.3.1",
"typescript": "^5.1.3"
},
Expand Down
16 changes: 8 additions & 8 deletions example/src/release_tests/reanimatedDrawerLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default function ReanimatedDrawerExample() {
type === DrawerType.FRONT
? DrawerType.BACK
: type === DrawerType.BACK
? DrawerType.SLIDE
: DrawerType.FRONT
? DrawerType.SLIDE
: DrawerType.FRONT
)
);

Expand All @@ -61,8 +61,8 @@ export default function ReanimatedDrawerExample() {
lock === DrawerLockMode.UNLOCKED
? DrawerLockMode.LOCKED_CLOSED
: lock === DrawerLockMode.LOCKED_CLOSED
? DrawerLockMode.LOCKED_OPEN
: DrawerLockMode.UNLOCKED
? DrawerLockMode.LOCKED_OPEN
: DrawerLockMode.UNLOCKED
)
);

Expand Down Expand Up @@ -94,8 +94,8 @@ export default function ReanimatedDrawerExample() {
{type === DrawerType.FRONT
? 'front'
: type === DrawerType.BACK
? 'back'
: 'slide'}
? 'back'
: 'slide'}
</Text>
</View>
</GestureDetector>
Expand All @@ -106,8 +106,8 @@ export default function ReanimatedDrawerExample() {
{lock === DrawerLockMode.UNLOCKED
? 'unlocked'
: lock === DrawerLockMode.LOCKED_OPEN
? 'locked-open'
: 'locked-closed'}
? 'locked-open'
: 'locked-closed'}
</Text>
</View>
</GestureDetector>
Expand Down
34 changes: 30 additions & 4 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,11 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"

"@pkgr/core@^0.1.0":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31"
integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==

"@react-native-async-storage/async-storage@^1.23.1":
version "1.23.1"
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.23.1.tgz#cad3cd4fab7dacfe9838dce6ecb352f79150c883"
Expand Down Expand Up @@ -4082,6 +4087,14 @@ eslint-plugin-prettier@^4.2.1:
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-plugin-prettier@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95"
integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==
dependencies:
prettier-linter-helpers "^1.0.0"
synckit "^0.9.1"

eslint-plugin-react-hooks@^4.6.0:
version "4.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.2.tgz#c829eb06c0e6f484b3fbb85a97e57784f328c596"
Expand Down Expand Up @@ -7218,10 +7231,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier@2.7.1:
version "2.7.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==
prettier@3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==

[email protected]:
version "5.6.0"
Expand Down Expand Up @@ -8370,6 +8383,14 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==

synckit@^0.9.1:
version "0.9.2"
resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62"
integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==
dependencies:
"@pkgr/core" "^0.1.0"
tslib "^2.6.2"

table@^6.0.9:
version "6.8.2"
resolved "https://registry.yarnpkg.com/table/-/table-6.8.2.tgz#c5504ccf201213fa227248bdc8c5569716ac6c58"
Expand Down Expand Up @@ -8557,6 +8578,11 @@ tslib@^2.0.1, tslib@^2.1.0, tslib@^2.4.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

tslib@^2.6.2:
version "2.8.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@
"eslint-config-satya164": "^3.1.8",
"eslint-import-resolver-babel-module": "^5.2.0",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-prettier": "^5.2.1",
"expo": "^35.0.1",
"husky": "^8.0.1",
"jest": "^28.1.0",
"lint-staged": "^12.3.2",
"madge": "^6.1.0",
"prettier": "2.7.1",
"prettier": "3.3.3",
"react": "18.2.0",
"react-native": "0.74.3",
"react-native-builder-bob": "^0.17.1",
Expand Down
2 changes: 1 addition & 1 deletion src/ActionType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const ActionType = {
} as const;

// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
export type ActionType = typeof ActionType[keyof typeof ActionType];
export type ActionType = (typeof ActionType)[keyof typeof ActionType];
4 changes: 2 additions & 2 deletions src/Directions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const DiagonalDirections = {
} as const;

// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
export type Directions = typeof Directions[keyof typeof Directions];
export type Directions = (typeof Directions)[keyof typeof Directions];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type DiagonalDirections =
typeof DiagonalDirections[keyof typeof DiagonalDirections];
(typeof DiagonalDirections)[keyof typeof DiagonalDirections];
2 changes: 1 addition & 1 deletion src/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const State = {
} as const;

// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
export type State = typeof State[keyof typeof State];
export type State = (typeof State)[keyof typeof State];
3 changes: 2 additions & 1 deletion src/TouchEventType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const TouchEventType = {
} as const;

// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
export type TouchEventType = typeof TouchEventType[keyof typeof TouchEventType];
export type TouchEventType =
(typeof TouchEventType)[keyof typeof TouchEventType];
4 changes: 2 additions & 2 deletions src/components/Pressable/Pressable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ export default function Pressable(props: PressableProps) {

const normalizedHitSlop: Insets = useMemo(
() =>
typeof hitSlop === 'number' ? numberAsInset(hitSlop) : hitSlop ?? {},
typeof hitSlop === 'number' ? numberAsInset(hitSlop) : (hitSlop ?? {}),
[hitSlop]
);

const normalizedPressRetentionOffset: Insets = useMemo(
() =>
typeof pressRetentionOffset === 'number'
? numberAsInset(pressRetentionOffset)
: pressRetentionOffset ?? {},
: (pressRetentionOffset ?? {}),
[pressRetentionOffset]
);

Expand Down
16 changes: 8 additions & 8 deletions src/components/ReanimatedSwipeable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
rowState.value === 1
? leftWidth.value
: rowState.value === -1
? -rightWidth.value
: 0;
? -rightWidth.value
: 0;

const offsetDrag = userDrag.value / friction + startOffset;

Expand Down Expand Up @@ -387,8 +387,8 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
? rightWidth.value
: leftWidth.value
: moveToRight
? leftWidth.value
: rightWidth.value;
? leftWidth.value
: rightWidth.value;

const progressSpringConfig = {
...translationSpringConfig,
Expand Down Expand Up @@ -614,10 +614,10 @@ const Swipeable = forwardRef<SwipeableMethods, SwipeableProps>(
rowState.value === -1
? SwipeDirection.RIGHT
: rowState.value === 1
? SwipeDirection.LEFT
: event.translationX > 0
? SwipeDirection.RIGHT
: SwipeDirection.LEFT;
? SwipeDirection.LEFT
: event.translationX > 0
? SwipeDirection.RIGHT
: SwipeDirection.LEFT;

if (!dragStarted.value) {
dragStarted.value = true;
Expand Down
8 changes: 4 additions & 4 deletions src/components/Swipeable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ export default class Swipeable extends Component<
rowState === -1
? 'right'
: rowState === 1
? 'left'
: translationX > 0
? 'left'
: 'right';
? 'left'
: translationX > 0
? 'left'
: 'right';

if (rowState === 0) {
this.props.onSwipeableOpenStartDrag?.(direction);
Expand Down
2 changes: 1 addition & 1 deletion src/components/touchables/GenericTouchable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const TOUCHABLE_STATE = {
MOVED_OUTSIDE: 2,
} as const;

type TouchableState = typeof TOUCHABLE_STATE[keyof typeof TOUCHABLE_STATE];
type TouchableState = (typeof TOUCHABLE_STATE)[keyof typeof TOUCHABLE_STATE];

interface InternalProps {
extraButtonProps: TouchableNativeFeedbackExtraProps;
Expand Down
4 changes: 2 additions & 2 deletions src/ghQueueMicrotask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export const ghQueueMicrotask =
typeof setImmediate === 'function'
? setImmediate.bind(null)
: typeof requestAnimationFrame === 'function'
? requestAnimationFrame.bind(null)
: queueMicrotask.bind(null);
? requestAnimationFrame.bind(null)
: queueMicrotask.bind(null);
2 changes: 1 addition & 1 deletion src/handlers/createHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const UNRESOLVED_REFS_RETRY_LIMIT = 1;
// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
export default function createHandler<
T extends BaseGestureHandlerProps<U>,
U extends Record<string, unknown>
U extends Record<string, unknown>,
>({
name,
allowedProps = [],
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/gestureHandlerCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
}
export interface HandlerStateChangeEvent<
ExtraEventPayloadT = Record<string, unknown>
ExtraEventPayloadT = Record<string, unknown>,
> {
nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
}
Expand All @@ -169,7 +169,7 @@ export type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =
GestureEventPayload & GestureEventPayloadT;

export type GestureStateChangeEvent<
GestureStateChangeEventPayloadT = Record<string, unknown>
GestureStateChangeEventPayloadT = Record<string, unknown>,
> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;

export type CommonGestureConfig = {
Expand All @@ -186,7 +186,7 @@ export type CommonGestureConfig = {
// Events payloads are types instead of interfaces due to TS limitation.
// See https://github.com/microsoft/TypeScript/issues/15300 for more info.
export type BaseGestureHandlerProps<
ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>
ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>,
> = CommonGestureConfig & {
id?: string;
waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/gestures/gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const CALLBACK_TYPE = {

// Allow using CALLBACK_TYPE as object and type
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];
export type CALLBACK_TYPE = (typeof CALLBACK_TYPE)[keyof typeof CALLBACK_TYPE];

export abstract class Gesture {
/**
Expand All @@ -125,7 +125,7 @@ export abstract class Gesture {

let nextGestureId = 0;
export abstract class BaseGesture<
EventPayloadT extends Record<string, unknown>
EventPayloadT extends Record<string, unknown>,
> extends Gesture {
private gestureId = -1;
public handlerTag = -1;
Expand Down Expand Up @@ -433,7 +433,7 @@ export abstract class BaseGesture<

export abstract class ContinousBaseGesture<
EventPayloadT extends Record<string, unknown>,
EventChangePayloadT extends Record<string, unknown>
EventChangePayloadT extends Record<string, unknown>,
> extends BaseGesture<EventPayloadT> {
/**
* Set the callback that is being called every time the gesture receives an update while it's active.
Expand Down
22 changes: 10 additions & 12 deletions src/jestUtils/jestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ try {
}

type GestureHandlerTestEvent<
TEventPayload extends Record<string, unknown> = Record<string, unknown>
TEventPayload extends Record<string, unknown> = Record<string, unknown>,
> = (
| GestureEvent<TEventPayload>
| HandlerStateChangeEvent<TEventPayload>
Expand Down Expand Up @@ -454,17 +454,15 @@ type AllHandlers =
// prettier-ignore
type ClassComponentConstructor<P> = new (props: P) => React.Component<P, any, any>;

type ExtractPayloadFromProps<T> = T extends BaseGestureHandlerProps<
infer TPayload
>
? TPayload
: never;

type ExtractConfig<T> = T extends BaseGesture<infer TGesturePayload>
? TGesturePayload
: T extends ClassComponentConstructor<infer THandlerProps>
? ExtractPayloadFromProps<THandlerProps>
: Record<string, unknown>;
type ExtractPayloadFromProps<T> =
T extends BaseGestureHandlerProps<infer TPayload> ? TPayload : never;

type ExtractConfig<T> =
T extends BaseGesture<infer TGesturePayload>
? TGesturePayload
: T extends ClassComponentConstructor<infer THandlerProps>
? ExtractPayloadFromProps<THandlerProps>
: Record<string, unknown>;

export function fireGestureHandler<THandler extends AllGestures | AllHandlers>(
componentOrGesture: ReactTestInstance | GestureType,
Expand Down
8 changes: 4 additions & 4 deletions src/web/tools/GestureHandlerWebDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,24 @@ export class GestureHandlerWebDelegate
const { userSelect } = this.gestureHandler.getConfig();

this.view.style['userSelect'] = isHandlerEnabled
? userSelect ?? 'none'
? (userSelect ?? 'none')
: this.defaultViewStyles.userSelect;

this.view.style['webkitUserSelect'] = isHandlerEnabled
? userSelect ?? 'none'
? (userSelect ?? 'none')
: this.defaultViewStyles.userSelect;
}

private setTouchAction(isHandlerEnabled: boolean) {
const { touchAction } = this.gestureHandler.getConfig();

this.view.style['touchAction'] = isHandlerEnabled
? touchAction ?? 'none'
? (touchAction ?? 'none')
: this.defaultViewStyles.touchAction;

// @ts-ignore This one disables default events on Safari
this.view.style['WebkitTouchCallout'] = isHandlerEnabled
? touchAction ?? 'none'
? (touchAction ?? 'none')
: this.defaultViewStyles.touchAction;
}

Expand Down
Loading

0 comments on commit e827e9b

Please sign in to comment.