Skip to content

Commit e3f0f81

Browse files
authored
fix: pin react-test-renderer version to fix npm install issues (#471)
1 parent 2d4a8c2 commit e3f0f81

File tree

14 files changed

+866
-577
lines changed

14 files changed

+866
-577
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
build/
3+
android/
4+
ios/
5+
lib/
6+
example/android
7+
example/ios

.eslintrc.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module.exports = {
18+
root: true,
19+
parser: '@typescript-eslint/parser',
20+
parserOptions: {
21+
ecmaVersion: 'latest',
22+
sourceType: 'module',
23+
ecmaFeatures: {
24+
jsx: true,
25+
},
26+
},
27+
env: {
28+
'es2021': true,
29+
'node': true,
30+
'react-native/react-native': true,
31+
},
32+
plugins: [
33+
'@typescript-eslint',
34+
'react',
35+
'react-hooks',
36+
'react-native',
37+
'import',
38+
'prettier',
39+
],
40+
extends: [
41+
'eslint:recommended',
42+
'plugin:@typescript-eslint/recommended',
43+
'plugin:react/recommended',
44+
'plugin:react-hooks/recommended',
45+
'plugin:react-native/all',
46+
'plugin:import/errors',
47+
'plugin:import/warnings',
48+
'plugin:import/typescript',
49+
'plugin:prettier/recommended',
50+
],
51+
rules: {
52+
'prettier/prettier': 'warn',
53+
'react/react-in-jsx-scope': 'off',
54+
'react-native/no-inline-styles': 'off',
55+
'react-native/sort-styles': 'off',
56+
'react-native/no-color-literals': 'off',
57+
'react-hooks/rules-of-hooks': 'error',
58+
'react-hooks/exhaustive-deps': 'warn',
59+
'@typescript-eslint/explicit-module-boundary-types': 'warn',
60+
'@typescript-eslint/no-explicit-any': 'error',
61+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Allow unused vars starting with _
62+
'import/default': 'off', // Disable for now due to react-native-select-dropdown issues
63+
},
64+
settings: {
65+
'react': {
66+
version: 'detect',
67+
},
68+
'import/resolver': {
69+
typescript: {},
70+
},
71+
},
72+
overrides: [
73+
// Configuration files can use require()
74+
{
75+
files: ['**/*.config.js', '**/babel.config.js'],
76+
rules: {
77+
'@typescript-eslint/no-require-imports': 'off',
78+
},
79+
},
80+
// Test files
81+
{
82+
files: ['**/*.test.js', '**/*.test.ts', '**/e2e/**/*.js'],
83+
env: {
84+
jest: true,
85+
},
86+
rules: {
87+
'@typescript-eslint/explicit-module-boundary-types': 'off',
88+
},
89+
},
90+
// Example directory - less strict for demo code
91+
{
92+
files: ['example/**/*'],
93+
rules: {
94+
'@typescript-eslint/explicit-module-boundary-types': 'off',
95+
},
96+
},
97+
],
98+
};

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"arrowParens": "avoid",
3+
"quoteProps": "consistent",
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "es5",
7+
"useTabs": false
8+
}

eslint.config.mjs

Lines changed: 0 additions & 45 deletions
This file was deleted.

example/src/screens/NavigationScreen.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
type NavigationCallbacks,
3434
type NavigationViewCallbacks,
3535
type NavigationViewController,
36+
type TurnByTurnEvent,
3637
type Polygon,
3738
type Polyline,
3839
useNavigation,
@@ -163,7 +164,7 @@ const NavigationScreen = () => {
163164
console.log('onRawLocationChanged:', location);
164165
}, []);
165166

166-
const onTurnByTurn = useCallback((turnByTurn: any) => {
167+
const onTurnByTurn = useCallback((turnByTurn: TurnByTurnEvent[]) => {
167168
console.log('onTurnByTurn:', turnByTurn);
168169
}, []);
169170

@@ -349,12 +350,10 @@ const NavigationScreen = () => {
349350
return arePermissionsApproved ? (
350351
<View style={styles.container}>
351352
<NavigationView
352-
style={[
353-
{
354-
...styles.map_view,
355-
margin: margin,
356-
},
357-
]}
353+
style={{
354+
...styles.map_view,
355+
margin: margin,
356+
}}
358357
androidStylingOptions={{
359358
primaryDayModeThemeColor: '#34eba8',
360359
headerDistanceValueTextColor: '#76b5c5',

package.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,37 @@
5252
"example": "yarn workspace react-native-navigation-sdk-sample",
5353
"test:types": "tsc --noEmit",
5454
"lint": "eslint \"**/*.{js,ts,tsx}\"",
55+
"lint-fix": "eslint \"**/*.{js,ts,tsx}\" --fix",
5556
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
5657
"prepare": "bob build",
5758
"prepare:example": "yarn workspace react-native-navigation-sdk-sample prepare",
5859
"build": "bob build"
5960
},
6061
"devDependencies": {
6162
"@commitlint/config-conventional": "^19.2.2",
62-
"@eslint/compat": "^1.2.7",
63-
"@eslint/eslintrc": "^3.3.0",
64-
"@eslint/js": "^9.22.0",
6563
"@evilmartians/lefthook": "^1.5.0",
6664
"@react-native/babel-preset": "^0.81.1",
67-
"@react-native/eslint-config": "^0.78.0",
6865
"@react-native/typescript-config": "^0.81.1",
6966
"@testing-library/react-native": "^13.3.3",
7067
"@types/react": "19.1.0",
68+
"@typescript-eslint/eslint-plugin": "^8.43.0",
69+
"@typescript-eslint/parser": "^8.43.0",
7170
"commitlint": "^19.3.0",
7271
"del-cli": "^5.1.0",
73-
"eslint": "^9.22.0",
74-
"eslint-config-prettier": "^10.1.1",
75-
"eslint-plugin-prettier": "^5.2.3",
76-
"prettier": "^3.3.3",
72+
"eslint": "^8.57.1",
73+
"eslint-config-google": "^0.14.0",
74+
"eslint-config-prettier": "^10.1.8",
75+
"eslint-import-resolver-typescript": "^4.4.4",
76+
"eslint-plugin-import": "^2.32.0",
77+
"eslint-plugin-prettier": "^5.5.4",
78+
"eslint-plugin-react": "^7.37.5",
79+
"eslint-plugin-react-hooks": "^5.2.0",
80+
"eslint-plugin-react-native": "^5.0.0",
81+
"prettier": "^3.6.2",
7782
"react": "19.1.0",
7883
"react-native": "0.81.1",
7984
"react-native-builder-bob": "^0.40.13",
80-
"react-test-renderer": "^19.1.0",
85+
"react-test-renderer": "19.1.0",
8186
"turbo": "^1.10.7",
8287
"typescript": "^5.8.3"
8388
},
@@ -94,14 +99,6 @@
9499
"@commitlint/config-conventional"
95100
]
96101
},
97-
"prettier": {
98-
"arrowParens": "avoid",
99-
"quoteProps": "consistent",
100-
"singleQuote": true,
101-
"tabWidth": 2,
102-
"trailingComma": "es5",
103-
"useTabs": false
104-
},
105102
"react-native-builder-bob": {
106103
"source": "src",
107104
"output": "lib",

src/maps/mapView/mapView.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,20 @@ import {
3333
type Polyline,
3434
} from '..';
3535

36-
export const MapView = (props: MapViewProps) => {
36+
export const MapView = (props: MapViewProps): React.JSX.Element => {
37+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3738
const mapViewRef = useRef<any>(null);
3839
const [viewId, setViewId] = useState<number | null>(null);
3940

4041
const { onMapViewControllerCreated } = props;
4142

4243
/**
43-
* @param {any} _ref - The reference to the NavViewManager component.
44+
* @param ref - The reference to the NavViewManager component.
4445
*/
45-
const onRefAssign = (_ref: any) => {
46-
if (mapViewRef.current !== _ref) {
47-
mapViewRef.current = _ref;
46+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
47+
const onRefAssign = (ref: any): void => {
48+
if (mapViewRef.current !== ref) {
49+
mapViewRef.current = ref;
4850
}
4951
};
5052

src/navigation/navigation/NavigationProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const NavigationProvider = ({
4343
termsAndConditionsDialogOptions,
4444
taskRemovedBehavior,
4545
children,
46-
}: NavigationProviderProps) => {
46+
}: NavigationProviderProps): React.JSX.Element => {
4747
const { navigationController, addListeners, removeListeners } =
4848
useNavigationController(
4949
termsAndConditionsDialogOptions,

src/navigation/navigation/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,5 @@ export enum TaskRemovedBehavior {
429429
/**
430430
* Defines the turn-by-turn event data.
431431
*/
432+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
432433
export interface TurnByTurnEvent {}

src/navigation/navigationView/navigationView.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,27 @@ import {
3434
type Polyline,
3535
} from '../../maps';
3636

37-
export const NavigationView = (props: NavigationViewProps) => {
37+
export const NavigationView = (
38+
props: NavigationViewProps
39+
): React.JSX.Element => {
40+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3841
const mapViewRef = useRef<any>(null);
3942
const [viewId, setViewId] = useState<number | null>(null);
4043

4144
const {
45+
onMapViewControllerCreated,
4246
androidStylingOptions,
4347
iOSStylingOptions,
4448
onNavigationViewControllerCreated,
45-
onMapViewControllerCreated,
4649
} = props;
4750

4851
/**
49-
* @param {any} _ref - The reference to the NavViewManager component.
52+
* @param ref - The reference to the NavViewManager component.
5053
*/
51-
const onRefAssign = (_ref: any) => {
52-
if (mapViewRef.current !== _ref) {
53-
mapViewRef.current = _ref;
54+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55+
const onRefAssign = (ref: any): void => {
56+
if (mapViewRef.current !== ref) {
57+
mapViewRef.current = ref;
5458
}
5559
};
5660

0 commit comments

Comments
 (0)