Skip to content

Commit 8caada8

Browse files
committed
[style] Upgrade linter & fix linter/tsc warnings
1 parent ce420a4 commit 8caada8

9 files changed

+4067
-1195
lines changed

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@
4242
"hoist-non-react-statics": "^3.3.2"
4343
},
4444
"devDependencies": {
45-
"@commitlint/config-conventional": "^11.0.0",
45+
"@commitlint/config-conventional": "^13.1.0",
4646
"@react-navigation/bottom-tabs": "^5.11.2",
4747
"@react-navigation/material-top-tabs": "^5.3.10",
4848
"@react-navigation/native": "^5.8.10",
4949
"@react-navigation/stack": "^5.12.8",
50-
"@types/react": "^17.0.0",
51-
"@types/react-native": "^0.63.37",
52-
"commitlint": "^11.0.0",
50+
"@types/react": "^17.0.15",
51+
"@types/react-native": "^0.64.12",
52+
"commitlint": "^13.1.0",
5353
"conventional-changelog-cli": "^2.1.1",
54-
"eslint": "^7.15.0",
55-
"expo-module-scripts": "^1.2.0",
56-
"prettier": "^2.2.1",
54+
"eslint": "^7.32.0",
55+
"expo-module-scripts": "^2.0.0",
56+
"prettier": "^2.3.2",
5757
"react-native-shared-element": "^0.7.0",
5858
"react-navigation": "^4.4.4",
5959
"react-navigation-stack": "^2.10.4"

src/SharedElementRendererContext.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as React from "react";
22

33
import { ISharedElementRendererData } from "./SharedElementRendererData";
44

5-
const SharedElementRendererContext = React.createContext<ISharedElementRendererData | null>(
6-
null
7-
);
5+
const SharedElementRendererContext =
6+
React.createContext<ISharedElementRendererData | null>(null);
87

98
export default SharedElementRendererContext;

src/SharedElementRendererData.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ type SceneRoute = {
6262
*/
6363

6464
export default class SharedElementRendererData
65-
implements ISharedElementRendererData {
65+
implements ISharedElementRendererData
66+
{
6667
private scenes: SceneRoute[] = [];
6768
private updateSubscribers = new Set<SharedElementRendererUpdateHandler>();
6869
private sharedElements: SharedElementsStrictConfig | null = null;
@@ -359,13 +360,8 @@ export default class SharedElementRendererData
359360
}
360361

361362
getTransitions(): SharedElementTransitionProps[] {
362-
const {
363-
sharedElements,
364-
prevScene,
365-
scene,
366-
isShowing,
367-
sceneAnimValue,
368-
} = this;
363+
const { sharedElements, prevScene, scene, isShowing, sceneAnimValue } =
364+
this;
369365

370366
if (!sharedElements || !scene || !prevScene) return NO_SHARED_ELEMENTS;
371367
return sharedElements.map(({ id, otherId, ...other }) => {

src/SharedElementRendererView.tsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ export default class SharedElementRendererView extends React.PureComponent<Props
3030
// console.log('SharedElementRendererView.render: ', transitions);
3131
return (
3232
<View style={StyleSheet.absoluteFill} pointerEvents="none">
33-
{transitions.map((
34-
// @ts-ignore
35-
{ key, ...props },
36-
index
37-
) => (
38-
<SharedElementTransition key={`${key}:${index}`} {...props} />
39-
))}
33+
{transitions.map(
34+
(
35+
// @ts-ignore
36+
{ key, ...props },
37+
index
38+
) => (
39+
<SharedElementTransition key={`${key}:${index}`} {...props} />
40+
)
41+
)}
4042
</View>
4143
);
4244
}

src/SharedElementSceneContext.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as React from "react";
22

33
import SharedElementSceneData from "./SharedElementSceneData";
44

5-
const SharedElementSceneContext = React.createContext<SharedElementSceneData | null>(
6-
null
7-
);
5+
const SharedElementSceneContext =
6+
React.createContext<SharedElementSceneData | null>(null);
87

98
export default SharedElementSceneContext;

src/createSharedElementScene.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ function isValidNavigationState(
3939
// Gets the current screen from navigation state
4040
function getActiveRoute(state: NavigationState): Route<any> {
4141
const route = state.routes[state.index];
42-
return route.state && isValidNavigationState(route.state)
43-
? getActiveRoute(route.state) // Dive into nested navigators
42+
const routeState = route.state as Partial<NavigationState>;
43+
return route.state && isValidNavigationState(routeState)
44+
? getActiveRoute(routeState) // Dive into nested navigators
4445
: route;
4546
}
4647

src/createSharedElementStackNavigator.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export default function createSharedElementStackNavigator<
100100
);
101101

102102
if (debug) {
103+
// eslint-disable-next-line react-hooks/rules-of-hooks
103104
React.useLayoutEffect(() => {
104105
rendererDataProxy.addDebugRef();
105106
return function cleanup() {

src/v4/createSharedElementStackNavigator.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function createSharedElementStackSceneNavigator(
3333
...routeConfigs,
3434
};
3535
for (const key in routeConfigs) {
36-
let routeConfig: any = wrappedRouteConfigs[key];
36+
const routeConfig: any = wrappedRouteConfigs[key];
3737
const component =
3838
typeof routeConfig === "object" && routeConfig.screen
3939
? routeConfig.screen
@@ -59,7 +59,7 @@ function createSharedElementStackSceneNavigator(
5959
// hook in into the transition lifecycle events.
6060
const defaultNavigationOptions = stackConfig?.defaultNavigationOptions;
6161
function defaultNavigationOptionsFn(props: any) {
62-
let defaultNavigationOptionsResult =
62+
const defaultNavigationOptionsResult =
6363
typeof defaultNavigationOptions === "function"
6464
? defaultNavigationOptions(props)
6565
: defaultNavigationOptions;

0 commit comments

Comments
 (0)