From c3b9b5c6f8cd9f314a80943b6da3e01e1227e4b3 Mon Sep 17 00:00:00 2001 From: John Haupenthal Date: Sat, 12 Oct 2024 23:46:54 -0700 Subject: [PATCH] fix: resolve tsc discrepancy --- .github/workflows/ci.yml | 2 +- example/app/_layout.tsx | 1 + example/app/index.tsx | 1 + example/app/scrollviews/nocontext.tsx | 3 ++- example/app/scrollviews/vertical.tsx | 3 +-- example/components/blocks/Blocks.tsx | 3 +-- example/components/blocks/FireOnceBlock.tsx | 2 +- example/components/blocks/ImageBlock.tsx | 2 +- example/components/blocks/NoLazyChild.tsx | 1 + example/components/cards/Card.tsx | 1 + example/components/cards/HorizontalCard.tsx | 4 +++- example/components/cards/NoLazyCard.tsx | 3 ++- example/components/cards/VerticalCard.tsx | 3 ++- example/package.json | 8 +------- example/tsconfig.json | 4 +--- example/yarn.lock | 18 ------------------ package.json | 1 - yarn.lock | 9 --------- 18 files changed, 20 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a78a1a..391e571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: uses: ./.github/actions/setup - name: Lint files - run: yarn lint --ignore-pattern "example/" + run: yarn lint - name: Typecheck files run: yarn typecheck diff --git a/example/app/_layout.tsx b/example/app/_layout.tsx index dc9bee1..3a27973 100644 --- a/example/app/_layout.tsx +++ b/example/app/_layout.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Stack } from 'expo-router'; export default function Layout() { diff --git a/example/app/index.tsx b/example/app/index.tsx index 07e2f29..900f213 100644 --- a/example/app/index.tsx +++ b/example/app/index.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Stack } from 'expo-router'; import { Dimensions, diff --git a/example/app/scrollviews/nocontext.tsx b/example/app/scrollviews/nocontext.tsx index 1f590e9..2cd8865 100644 --- a/example/app/scrollviews/nocontext.tsx +++ b/example/app/scrollviews/nocontext.tsx @@ -1,4 +1,5 @@ -import { ScrollView, StyleSheet, Text } from 'react-native'; +import React from 'react'; +import { ScrollView, StyleSheet } from 'react-native'; import { Blocks } from '../../components/blocks/Blocks'; export default function NoContext() { diff --git a/example/app/scrollviews/vertical.tsx b/example/app/scrollviews/vertical.tsx index b41d8f9..15fdefc 100644 --- a/example/app/scrollviews/vertical.tsx +++ b/example/app/scrollviews/vertical.tsx @@ -1,5 +1,4 @@ -import { useRef } from 'react'; - +import React, { useRef } from 'react'; import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { LazyScrollView, diff --git a/example/components/blocks/Blocks.tsx b/example/components/blocks/Blocks.tsx index d08838f..601dc32 100644 --- a/example/components/blocks/Blocks.tsx +++ b/example/components/blocks/Blocks.tsx @@ -1,7 +1,6 @@ -import { useCallback } from 'react'; - import { chunk } from 'lodash'; import shuffle from 'lodash/shuffle'; +import React, { useCallback } from 'react'; import { Dimensions, ImageSourcePropType, diff --git a/example/components/blocks/FireOnceBlock.tsx b/example/components/blocks/FireOnceBlock.tsx index 8c4cc17..20299f4 100644 --- a/example/components/blocks/FireOnceBlock.tsx +++ b/example/components/blocks/FireOnceBlock.tsx @@ -1,4 +1,4 @@ -import { ComponentProps, useMemo, useState } from 'react'; +import React, { ComponentProps, useMemo, useState } from 'react'; import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'; import { LazyChild } from 'react-native-lazy-scrollview'; import { SQUARE_SIZE } from '../../constants'; diff --git a/example/components/blocks/ImageBlock.tsx b/example/components/blocks/ImageBlock.tsx index 41a85a5..c095f24 100644 --- a/example/components/blocks/ImageBlock.tsx +++ b/example/components/blocks/ImageBlock.tsx @@ -1,4 +1,4 @@ -import { ComponentProps, useState } from 'react'; +import React, { ComponentProps, useState } from 'react'; import { ActivityIndicator, Image, diff --git a/example/components/blocks/NoLazyChild.tsx b/example/components/blocks/NoLazyChild.tsx index d572f78..2e37721 100644 --- a/example/components/blocks/NoLazyChild.tsx +++ b/example/components/blocks/NoLazyChild.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { SQUARE_SIZE } from '../../constants'; diff --git a/example/components/cards/Card.tsx b/example/components/cards/Card.tsx index 269a43c..581c05b 100644 --- a/example/components/cards/Card.tsx +++ b/example/components/cards/Card.tsx @@ -1,4 +1,5 @@ import { useRouter } from 'expo-router'; +import React from 'react'; import { Image, StyleSheet, diff --git a/example/components/cards/HorizontalCard.tsx b/example/components/cards/HorizontalCard.tsx index 682f095..e4c67eb 100644 --- a/example/components/cards/HorizontalCard.tsx +++ b/example/components/cards/HorizontalCard.tsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import React, { useEffect } from 'react'; import { interpolate, useAnimatedStyle, @@ -14,7 +14,9 @@ export function HorizontalCard() { useEffect(() => { animation.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + const animatedStyle = useAnimatedStyle(() => { return { marginTop: 16, diff --git a/example/components/cards/NoLazyCard.tsx b/example/components/cards/NoLazyCard.tsx index ebcda3e..208a399 100644 --- a/example/components/cards/NoLazyCard.tsx +++ b/example/components/cards/NoLazyCard.tsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import React, { useEffect } from 'react'; import { interpolate, useAnimatedStyle, @@ -14,6 +14,7 @@ export function NoLazyCard() { useEffect(() => { animation.value = withRepeat(withTiming(1, { duration: 2000 }), -1); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const animatedStyle = useAnimatedStyle(() => { diff --git a/example/components/cards/VerticalCard.tsx b/example/components/cards/VerticalCard.tsx index d5d9c5d..83d24c5 100644 --- a/example/components/cards/VerticalCard.tsx +++ b/example/components/cards/VerticalCard.tsx @@ -1,4 +1,4 @@ -import { useEffect } from 'react'; +import React, { useEffect } from 'react'; import { interpolate, useAnimatedStyle, @@ -14,6 +14,7 @@ export function VerticalCard() { useEffect(() => { animation.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const animatedStyle = useAnimatedStyle(() => { return { diff --git a/example/package.json b/example/package.json index 1de7dd9..978ec3d 100644 --- a/example/package.json +++ b/example/package.json @@ -28,14 +28,8 @@ "@babel/core": "^7.24.0", "@expo/webpack-config": "~19.0.1", "@types/lodash": "^4.14.194", - "@types/react": "~18.2.79", "babel-loader": "^8.1.0", "babel-plugin-module-resolver": "^4.1.0" }, - "private": true, - "eslintConfig": { - "rules": { - "react/react-in-jsx-scope": "off" - } - } + "private": true } diff --git a/example/tsconfig.json b/example/tsconfig.json index 2db003a..6c74ae6 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -1,6 +1,4 @@ { "extends": "../tsconfig", - "compilerOptions": { - "jsx": "react-jsx" - } + "compilerOptions": {} } diff --git a/example/yarn.lock b/example/yarn.lock index bf0ac1a..2825078 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -2670,11 +2670,6 @@ dependencies: undici-types "~5.26.4" -"@types/prop-types@*": - version "15.7.13" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.13.tgz#2af91918ee12d9d32914feb13f5326658461b451" - integrity sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA== - "@types/qs@*": version "6.9.16" resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.16.tgz#52bba125a07c0482d26747d5d4947a64daf8f794" @@ -2685,14 +2680,6 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== -"@types/react@~18.2.79": - version "18.2.79" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.79.tgz#c40efb4f255711f554d47b449f796d1c7756d865" - integrity sha512-RwGAGXPl9kSXwdNTafkOEuFrTBD5SA2B3iEB96xi8+xu5ddUa/cpvyVCSNn+asgLCTHkb5ZxN8gbuibYJi4s1w== - dependencies: - "@types/prop-types" "*" - csstype "^3.0.2" - "@types/retry@0.12.0": version "0.12.0" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d" @@ -4124,11 +4111,6 @@ csso@^4.2.0: dependencies: css-tree "^1.1.2" -csstype@^3.0.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" - integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== - dag-map@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/dag-map/-/dag-map-1.0.2.tgz#e8379f041000ed561fc515475c1ed2c85eece8d7" diff --git a/package.json b/package.json index f073f1d..3e913d3 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "@testing-library/jest-native": "^5.4.1", "@testing-library/react-native": "^12.0.0-rc.0", "@types/jest": "^28.1.2", - "@types/react": "~17.0.21", "@types/react-native": "0.70.0", "commitlint": "^17.0.2", "del-cli": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index 264f815..806395a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2553,15 +2553,6 @@ "@types/scheduler" "*" csstype "^3.0.2" -"@types/react@~17.0.21": - version "17.0.53" - resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.53.tgz#10d4d5999b8af3d6bc6a9369d7eb953da82442ab" - integrity sha512-1yIpQR2zdYu1Z/dc1OxC+MA6GR240u3gcnP4l6mvj/PJiVaqHsQPmWttsvHsfnhfPbU2FuGmo0wSITPygjBmsw== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "*" - csstype "^3.0.2" - "@types/scheduler@*": version "0.16.2" resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"