diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..378eac25d31 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +build diff --git a/apps/common-app/package.json b/apps/common-app/package.json index f2d54856186..94d0545254c 100644 --- a/apps/common-app/package.json +++ b/apps/common-app/package.json @@ -48,7 +48,7 @@ "eslint": "^8.57.0", "eslint-plugin-reanimated": "workspace:*", "patch-package": "^8.0.0", - "prettier": "2.8.8", + "prettier": "^3.3.3", "react": "18.3.1", "react-native": "0.75.2", "react-native-gesture-handler": "2.18.0", diff --git a/apps/common-app/src/examples/CustomHandler/useAnimatedPagerHandler.ts b/apps/common-app/src/examples/CustomHandler/useAnimatedPagerHandler.ts index 0e7fa68a6c2..c76d8cb5bf4 100644 --- a/apps/common-app/src/examples/CustomHandler/useAnimatedPagerHandler.ts +++ b/apps/common-app/src/examples/CustomHandler/useAnimatedPagerHandler.ts @@ -7,7 +7,7 @@ import { useEvent, useHandler } from 'react-native-reanimated'; import type { ReanimatedEvent } from 'react-native-reanimated'; export function useAnimatedPagerScrollHandler< - TContext extends Record + TContext extends Record, >( handlers: { onPageScroll: ( @@ -37,7 +37,7 @@ export function useAnimatedPagerScrollHandler< } export function useAnimatedPagerScrollStateHandler< - TContext extends Record + TContext extends Record, >( handlers: { onPageScrollStateChanged: ( @@ -70,7 +70,7 @@ export function useAnimatedPagerScrollStateHandler< } export function useAnimatedPagerSelectedPageHandler< - TContext extends Record + TContext extends Record, >( handlers: { onPageSelected: ( diff --git a/apps/common-app/src/examples/LayoutAnimations/ChangeTheme.tsx b/apps/common-app/src/examples/LayoutAnimations/ChangeTheme.tsx index 3aca2991333..69f86fa1ec5 100644 --- a/apps/common-app/src/examples/LayoutAnimations/ChangeTheme.tsx +++ b/apps/common-app/src/examples/LayoutAnimations/ChangeTheme.tsx @@ -30,16 +30,16 @@ function List() { layout: undefined, } : theme - ? { - entering: RotateInUpRight, - exiting: RotateOutUpLeft, - layout: Layout.easing(Easing.exp).delay(200), - } - : { - entering: SlideInRight, - exiting: SlideOutLeft, - layout: Layout.springify().delay(200), - }, + ? { + entering: RotateInUpRight, + exiting: RotateOutUpLeft, + layout: Layout.easing(Easing.exp).delay(200), + } + : { + entering: SlideInRight, + exiting: SlideOutLeft, + layout: Layout.springify().delay(200), + }, [disabled, theme] ); diff --git a/apps/common-app/src/examples/LiquidSwipe/Weave.tsx b/apps/common-app/src/examples/LiquidSwipe/Weave.tsx index 38cbb867a8c..4548295b143 100644 --- a/apps/common-app/src/examples/LiquidSwipe/Weave.tsx +++ b/apps/common-app/src/examples/LiquidSwipe/Weave.tsx @@ -99,84 +99,84 @@ export default function Weave({ L${maskWidth} ${curveStartY} C${maskWidth} ${curveStartY - horRadius.value * 0.1346194756} ${maskWidth - horRadius.value * 0.05341339583} ${ - curveStartY - vertRadius.value * 0.2412779634 - } + curveStartY - vertRadius.value * 0.2412779634 + } ${maskWidth - horRadius.value * 0.1561501458} ${ - curveStartY - vertRadius.value * 0.3322374268 - } + curveStartY - vertRadius.value * 0.3322374268 + } C${maskWidth - horRadius.value * 0.2361659167} ${ - curveStartY - vertRadius.value * 0.4030805244 - } + curveStartY - vertRadius.value * 0.4030805244 + } ${maskWidth - horRadius.value * 0.3305285625} ${ - curveStartY - vertRadius.value * 0.4561193293 - } + curveStartY - vertRadius.value * 0.4561193293 + } ${maskWidth - horRadius.value * 0.5012484792} ${ - curveStartY - vertRadius.value * 0.5350576951 - } + curveStartY - vertRadius.value * 0.5350576951 + } C${maskWidth - horRadius.value * 0.515878125} ${ - curveStartY - vertRadius.value * 0.5418222317 - } + curveStartY - vertRadius.value * 0.5418222317 + } ${maskWidth - horRadius.value * 0.5664134792} ${ - curveStartY - vertRadius.value * 0.5650349878 - } + curveStartY - vertRadius.value * 0.5650349878 + } ${maskWidth - horRadius.value * 0.574934875} ${ - curveStartY - vertRadius.value * 0.5689655122 - } + curveStartY - vertRadius.value * 0.5689655122 + } C${maskWidth - horRadius.value * 0.7283715208} ${ - curveStartY - vertRadius.value * 0.6397387195 - } + curveStartY - vertRadius.value * 0.6397387195 + } ${maskWidth - horRadius.value * 0.8086618958} ${ - curveStartY - vertRadius.value * 0.6833456585 - } + curveStartY - vertRadius.value * 0.6833456585 + } ${maskWidth - horRadius.value * 0.8774032292} ${ - curveStartY - vertRadius.value * 0.7399037439 - } + curveStartY - vertRadius.value * 0.7399037439 + } C${maskWidth - horRadius.value * 0.9653464583} ${ - curveStartY - vertRadius.value * 0.8122605122 - } + curveStartY - vertRadius.value * 0.8122605122 + } ${maskWidth - horRadius.value} ${ - curveStartY - vertRadius.value * 0.8936183659 - } + curveStartY - vertRadius.value * 0.8936183659 + } ${maskWidth - horRadius.value} ${curveStartY - vertRadius.value} C${maskWidth - horRadius.value} ${ - curveStartY - vertRadius.value * 1.100142878 - } + curveStartY - vertRadius.value * 1.100142878 + } ${maskWidth - horRadius.value * 0.9595746667} ${ - curveStartY - vertRadius.value * 1.1887991951 - } + curveStartY - vertRadius.value * 1.1887991951 + } ${maskWidth - horRadius.value * 0.8608411667} ${ - curveStartY - vertRadius.value * 1.270484439 - } + curveStartY - vertRadius.value * 1.270484439 + } C${maskWidth - horRadius.value * 0.7852123333} ${ - curveStartY - vertRadius.value * 1.3330544756 - } + curveStartY - vertRadius.value * 1.3330544756 + } ${maskWidth - horRadius.value * 0.703382125} ${ - curveStartY - vertRadius.value * 1.3795848049 - } + curveStartY - vertRadius.value * 1.3795848049 + } ${maskWidth - horRadius.value * 0.5291125625} ${ - curveStartY - vertRadius.value * 1.4665102805 - } + curveStartY - vertRadius.value * 1.4665102805 + } C${maskWidth - horRadius.value * 0.5241858333} ${ - curveStartY - vertRadius.value * 1.4689677195 - } + curveStartY - vertRadius.value * 1.4689677195 + } ${maskWidth - horRadius.value * 0.505739125} ${ - curveStartY - vertRadius.value * 1.4781625854 - } + curveStartY - vertRadius.value * 1.4781625854 + } ${maskWidth - horRadius.value * 0.5015305417} ${ - curveStartY - vertRadius.value * 1.4802616098 - } + curveStartY - vertRadius.value * 1.4802616098 + } C${maskWidth - horRadius.value * 0.3187486042} ${ - curveStartY - vertRadius.value * 1.5714239024 - } + curveStartY - vertRadius.value * 1.5714239024 + } ${maskWidth - horRadius.value * 0.2332057083} ${ - curveStartY - vertRadius.value * 1.6204116463 - } + curveStartY - vertRadius.value * 1.6204116463 + } ${maskWidth - horRadius.value * 0.1541165417} ${ - curveStartY - vertRadius.value * 1.687403 - } + curveStartY - vertRadius.value * 1.687403 + } C${maskWidth - horRadius.value * 0.0509933125} ${ - curveStartY - vertRadius.value * 1.774752061 - } + curveStartY - vertRadius.value * 1.774752061 + } ${maskWidth} ${curveStartY - vertRadius.value * 1.8709256829} ${maskWidth} ${curveStartY - vertRadius.value * 2} L${maskWidth} ${0} diff --git a/apps/common-app/src/examples/RuntimeTests/ReJest/matchers/Matchers.ts b/apps/common-app/src/examples/RuntimeTests/ReJest/matchers/Matchers.ts index ced4722458d..56b331ccda6 100644 --- a/apps/common-app/src/examples/RuntimeTests/ReJest/matchers/Matchers.ts +++ b/apps/common-app/src/examples/RuntimeTests/ReJest/matchers/Matchers.ts @@ -15,7 +15,10 @@ import type { SingleViewSnapshot } from '../TestRunner/UpdatesContainer'; export class Matchers { private _negation = false; // eslint-disable-next-line no-useless-constructor - constructor(private _currentValue: TestValue, private _testCase: TestCase) {} + constructor( + private _currentValue: TestValue, + private _testCase: TestCase, + ) {} get not() { this._negation = true; diff --git a/apps/common-app/src/examples/SharedElementTransitions/ChangeTheme.tsx b/apps/common-app/src/examples/SharedElementTransitions/ChangeTheme.tsx index dde15a9fa04..451132256f3 100644 --- a/apps/common-app/src/examples/SharedElementTransitions/ChangeTheme.tsx +++ b/apps/common-app/src/examples/SharedElementTransitions/ChangeTheme.tsx @@ -79,8 +79,8 @@ function getTheme(theme: boolean, disabled: boolean) { const transition = disabled ? undefined : theme - ? customTransition - : new SharedTransition(); + ? customTransition + : new SharedTransition(); return { style, transition }; } diff --git a/apps/fabric-example/package.json b/apps/fabric-example/package.json index c598c1ad3d8..f41e7339d4b 100644 --- a/apps/fabric-example/package.json +++ b/apps/fabric-example/package.json @@ -45,7 +45,7 @@ "eslint": "^8.57.0", "jest": "^29.6.3", "patch-package": "^8.0.0", - "prettier": "2.8.8", + "prettier": "^3.3.3", "react-test-renderer": "18.3.1", "typescript": "~5.3.0" }, diff --git a/apps/macos-example/package.json b/apps/macos-example/package.json index f4dc6824fde..08839776ffe 100644 --- a/apps/macos-example/package.json +++ b/apps/macos-example/package.json @@ -42,7 +42,7 @@ "babel-jest": "^29.6.3", "eslint": "^8.57.0", "jest": "^29.6.3", - "prettier": "2.8.8", + "prettier": "^3.3.3", "react-test-renderer": "18.2.0", "typescript": "~5.3.0" }, diff --git a/apps/next-example/package.json b/apps/next-example/package.json index 3e7647aee42..3046d80632e 100644 --- a/apps/next-example/package.json +++ b/apps/next-example/package.json @@ -29,7 +29,7 @@ "cypress": "^13.2.0", "eslint": "^8.57.0", "next-compose-plugins": "^2.2.1", - "prettier": "2.8.8", + "prettier": "^3.3.3", "start-server-and-test": "^2.0.1" } } diff --git a/apps/paper-example/package.json b/apps/paper-example/package.json index 2e5ab22b9f1..bf8686276ca 100644 --- a/apps/paper-example/package.json +++ b/apps/paper-example/package.json @@ -44,7 +44,7 @@ "eslint": "^8.57.0", "jest": "^29.6.3", "patch-package": "^8.0.0", - "prettier": "2.8.8", + "prettier": "^3.3.3", "react-test-renderer": "18.3.1", "typescript": "~5.3.0" }, diff --git a/apps/tvos-example/package.json b/apps/tvos-example/package.json index af9ee3b2867..9d0f74fde13 100644 --- a/apps/tvos-example/package.json +++ b/apps/tvos-example/package.json @@ -30,7 +30,7 @@ "babel-jest": "^29.6.3", "eslint": "^8.57.0", "jest": "^29.6.3", - "prettier": "2.8.8", + "prettier": "^3.3.3", "react-test-renderer": "18.2.0", "typescript": "~5.3.0" }, diff --git a/apps/web-example/package.json b/apps/web-example/package.json index 82a0a9ddc77..97518f41cc8 100644 --- a/apps/web-example/package.json +++ b/apps/web-example/package.json @@ -28,7 +28,7 @@ "@expo/metro-runtime": "^3.2.1", "@types/eslint": "^8", "eslint": "^8.57.0", - "prettier": "2.8.8", + "prettier": "^3.3.3", "serve": "^14.2.3", "typescript": "~5.3.0" } diff --git a/package.json b/package.json index b805631f6a3..c2ee4a3d373 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "eslint": "^8.57.0", "husky": "^9.0.11", "lint-staged": "^15.2.2", - "prettier": "2.8.8", + "prettier": "^3.3.3", "typescript": "~5.3.0" }, "resolutions": { diff --git a/packages/eslint-plugin-reanimated/package.json b/packages/eslint-plugin-reanimated/package.json index b633140b13f..3944e126a7e 100644 --- a/packages/eslint-plugin-reanimated/package.json +++ b/packages/eslint-plugin-reanimated/package.json @@ -20,7 +20,7 @@ "esbuild": "^0.20.0", "eslint": "^8.57.0", "jest": "^29.7.0", - "prettier": "2.8.8", + "prettier": "^3.3.3", "ts-jest": "^29.1.2", "typescript": "~5.3.0" } diff --git a/packages/react-native-reanimated/__typetests__/common/useAnimatedPropsTest.tsx b/packages/react-native-reanimated/__typetests__/common/useAnimatedPropsTest.tsx index 0d2c948db5f..6999098c899 100644 --- a/packages/react-native-reanimated/__typetests__/common/useAnimatedPropsTest.tsx +++ b/packages/react-native-reanimated/__typetests__/common/useAnimatedPropsTest.tsx @@ -41,7 +41,7 @@ function UseAnimatedPropsTest() { function UseAnimatedPropsTestView1() { const animatedProps = useAnimatedProps( - () => ({ pointerEvents: 'none' } as const) + () => ({ pointerEvents: 'none' }) as const ); return ; } diff --git a/packages/react-native-reanimated/package.json b/packages/react-native-reanimated/package.json index 60e24a47a2d..ef3b6701c8c 100644 --- a/packages/react-native-reanimated/package.json +++ b/packages/react-native-reanimated/package.json @@ -142,7 +142,7 @@ "eslint-plugin-tsdoc": "^0.2.17", "jest": "^29.0.0", "madge": "^5.0.1", - "prettier": "2.8.8", + "prettier": "^3.3.3", "react": "18.3.1", "react-native": "0.75.2", "react-native-builder-bob": "^0.18.3", diff --git a/packages/react-native-reanimated/plugin/package.json b/packages/react-native-reanimated/plugin/package.json index 0d95b6979c0..8fa29cb06cf 100644 --- a/packages/react-native-reanimated/plugin/package.json +++ b/packages/react-native-reanimated/plugin/package.json @@ -17,7 +17,7 @@ "esbuild": "^0.17.11", "eslint": "^8.0.0-0", "eslint-plugin-standard": "^5.0.0", - "prettier": "^2.5.1", + "prettier": "^3.3.3", "tsc-watch": "^6.0.0", "typescript": "^4.1.3" }, diff --git a/packages/react-native-reanimated/plugin/src/autoworkletization.ts b/packages/react-native-reanimated/plugin/src/autoworkletization.ts index d54cefadaee..5d6e865fd6c 100644 --- a/packages/react-native-reanimated/plugin/src/autoworkletization.ts +++ b/packages/react-native-reanimated/plugin/src/autoworkletization.ts @@ -87,8 +87,8 @@ export function processCalleesAutoworkletizableCallbacks( 'name' in callee ? callee.name : 'property' in callee && 'name' in callee.property - ? callee.property.name - : undefined; + ? callee.property.name + : undefined; if (name === undefined) { return; } diff --git a/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx b/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx index 5f107066fe4..c012c8a95cc 100644 --- a/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx +++ b/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx @@ -5,7 +5,7 @@ import { ReanimatedError } from '../../errors'; type FixedLengthArray< T, L extends number, - PassedObject = [T, ...Array] + PassedObject = [T, ...Array], > = PassedObject & { readonly length: L; [I: number]: T; diff --git a/packages/react-native-reanimated/src/animation/util.ts b/packages/react-native-reanimated/src/animation/util.ts index 8211e818c21..7d29d813d9b 100644 --- a/packages/react-native-reanimated/src/animation/util.ts +++ b/packages/react-native-reanimated/src/animation/util.ts @@ -504,14 +504,14 @@ function decorateAnimation( type AnimationToDecoration< T extends AnimationObject | StyleLayoutAnimation, - U extends AnimationObject | StyleLayoutAnimation + U extends AnimationObject | StyleLayoutAnimation, > = T extends StyleLayoutAnimation ? Record : U | (() => U) | AnimatableValue; export function defineAnimation< T extends AnimationObject | StyleLayoutAnimation, // type that's supposed to be returned - U extends AnimationObject | StyleLayoutAnimation = T // type that's received + U extends AnimationObject | StyleLayoutAnimation = T, // type that's received >(starting: AnimationToDecoration, factory: () => T): T { 'worklet'; if (IN_STYLE_UPDATER) { diff --git a/packages/react-native-reanimated/src/commonTypes.ts b/packages/react-native-reanimated/src/commonTypes.ts index 4db6ed3f65b..436b22cf6d4 100644 --- a/packages/react-native-reanimated/src/commonTypes.ts +++ b/packages/react-native-reanimated/src/commonTypes.ts @@ -65,9 +65,8 @@ export type ShareableRef = { // In case of objects with depth or arrays of objects or arrays of arrays etc. // we add this utility type that makes it a `SharaebleRef` of the outermost type. -export type FlatShareableRef = T extends ShareableRef - ? ShareableRef - : ShareableRef; +export type FlatShareableRef = + T extends ShareableRef ? ShareableRef : ShareableRef; export type MapperRawInputs = unknown[]; @@ -86,7 +85,7 @@ export type MapperRegistry = { export type WorkletStackDetails = [ error: Error, lineOffset: number, - columnOffset: number + columnOffset: number, ]; type WorkletClosure = Record; @@ -122,7 +121,7 @@ interface WorkletBaseDev extends WorkletBaseCommon { export type WorkletFunction< Args extends unknown[] = unknown[], - ReturnValue = unknown + ReturnValue = unknown, > = ((...args: Args) => ReturnValue) & (WorkletBaseRelease | WorkletBaseDev); /** @@ -149,7 +148,7 @@ export type WorkletFunction< export function isWorkletFunction< Args extends unknown[] = unknown[], ReturnValue = unknown, - BuildType extends WorkletBaseDev | WorkletBaseRelease = WorkletBaseDev + BuildType extends WorkletBaseDev | WorkletBaseRelease = WorkletBaseDev, >(value: unknown): value is WorkletFunction & BuildType { 'worklet'; // Since host objects always return true for `in` operator, we have to use dot notation to check if the property exists. @@ -348,14 +347,14 @@ type MaybeSharedValueRecursive = Value extends (infer Item)[] | SharedValueDisableContravariance | (MaybeSharedValueRecursive | Item)[] : Value extends object - ? - | SharedValueDisableContravariance - | { - [Key in keyof Value]: - | MaybeSharedValueRecursive - | Value[Key]; - } - : MaybeSharedValue; + ? + | SharedValueDisableContravariance + | { + [Key in keyof Value]: + | MaybeSharedValueRecursive + | Value[Key]; + } + : MaybeSharedValue; type DefaultStyle = ViewStyle & ImageStyle & TextStyle; diff --git a/packages/react-native-reanimated/src/component/FlatList.tsx b/packages/react-native-reanimated/src/component/FlatList.tsx index 42377ad4d8f..e4625412535 100644 --- a/packages/react-native-reanimated/src/component/FlatList.tsx +++ b/packages/react-native-reanimated/src/component/FlatList.tsx @@ -116,7 +116,7 @@ const FlatListForwardRefRender = function ( export const ReanimatedFlatList = forwardRef(FlatListForwardRefRender) as < // We need explicit any here, because this is the exact same type that is used in React Native types. // eslint-disable-next-line @typescript-eslint/no-explicit-any - ItemT = any + ItemT = any, >( props: ReanimatedFlatListPropsWithLayout & { ref?: React.ForwardedRef; diff --git a/packages/react-native-reanimated/src/hook/commonTypes.ts b/packages/react-native-reanimated/src/hook/commonTypes.ts index e87de3d3007..8a40be51aca 100644 --- a/packages/react-native-reanimated/src/hook/commonTypes.ts +++ b/packages/react-native-reanimated/src/hook/commonTypes.ts @@ -90,7 +90,7 @@ export interface IWorkletEventHandler { } export interface AnimatedStyleHandle< - Style extends DefaultStyle = DefaultStyle + Style extends DefaultStyle = DefaultStyle, > { viewDescriptors: ViewDescriptorsSet; initial: { @@ -100,7 +100,7 @@ export interface AnimatedStyleHandle< } export interface JestAnimatedStyleHandle< - Style extends DefaultStyle = DefaultStyle + Style extends DefaultStyle = DefaultStyle, > extends AnimatedStyleHandle