Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
build/
android/
ios/
lib/
example/android
example/ios
98 changes: 98 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: {
'es2021': true,
'node': true,
'react-native/react-native': true,
},
plugins: [
'@typescript-eslint',
'react',
'react-hooks',
'react-native',
'import',
'prettier',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:react-native/all',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
rules: {
'prettier/prettier': 'warn',
'react/react-in-jsx-scope': 'off',
'react-native/no-inline-styles': 'off',
'react-native/sort-styles': 'off',
'react-native/no-color-literals': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Allow unused vars starting with _
'import/default': 'off', // Disable for now due to react-native-select-dropdown issues
},
settings: {
'react': {
version: 'detect',
},
'import/resolver': {
typescript: {},
},
},
overrides: [
// Configuration files can use require()
{
files: ['**/*.config.js', '**/babel.config.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
// Test files
{
files: ['**/*.test.js', '**/*.test.ts', '**/e2e/**/*.js'],
env: {
jest: true,
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
// Example directory - less strict for demo code
{
files: ['example/**/*'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
],
};
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "avoid",
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
45 changes: 0 additions & 45 deletions eslint.config.mjs

This file was deleted.

13 changes: 6 additions & 7 deletions example/src/screens/NavigationScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
type NavigationCallbacks,
type NavigationViewCallbacks,
type NavigationViewController,
type TurnByTurnEvent,
type Polygon,
type Polyline,
useNavigation,
Expand Down Expand Up @@ -163,7 +164,7 @@ const NavigationScreen = () => {
console.log('onRawLocationChanged:', location);
}, []);

const onTurnByTurn = useCallback((turnByTurn: any) => {
const onTurnByTurn = useCallback((turnByTurn: TurnByTurnEvent[]) => {
console.log('onTurnByTurn:', turnByTurn);
}, []);

Expand Down Expand Up @@ -349,12 +350,10 @@ const NavigationScreen = () => {
return arePermissionsApproved ? (
<View style={styles.container}>
<NavigationView
style={[
{
...styles.map_view,
margin: margin,
},
]}
style={{
...styles.map_view,
margin: margin,
}}
androidStylingOptions={{
primaryDayModeThemeColor: '#34eba8',
headerDistanceValueTextColor: '#76b5c5',
Expand Down
31 changes: 14 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,37 @@
"example": "yarn workspace react-native-navigation-sdk-sample",
"test:types": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"lint-fix": "eslint \"**/*.{js,ts,tsx}\" --fix",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
"prepare:example": "yarn workspace react-native-navigation-sdk-sample prepare",
"build": "bob build"
},
"devDependencies": {
"@commitlint/config-conventional": "^19.2.2",
"@eslint/compat": "^1.2.7",
"@eslint/eslintrc": "^3.3.0",
"@eslint/js": "^9.22.0",
"@evilmartians/lefthook": "^1.5.0",
"@react-native/babel-preset": "^0.81.1",
"@react-native/eslint-config": "^0.78.0",
"@react-native/typescript-config": "^0.81.1",
"@testing-library/react-native": "^13.3.3",
"@types/react": "19.1.0",
"@typescript-eslint/eslint-plugin": "^8.43.0",
"@typescript-eslint/parser": "^8.43.0",
"commitlint": "^19.3.0",
"del-cli": "^5.1.0",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.3",
"prettier": "^3.3.3",
"eslint": "^8.57.1",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-native": "^5.0.0",
"prettier": "^3.6.2",
"react": "19.1.0",
"react-native": "0.81.1",
"react-native-builder-bob": "^0.40.13",
"react-test-renderer": "^19.1.0",
"react-test-renderer": "19.1.0",
"turbo": "^1.10.7",
"typescript": "^5.8.3"
},
Expand All @@ -94,14 +99,6 @@
"@commitlint/config-conventional"
]
},
"prettier": {
"arrowParens": "avoid",
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
Expand Down
12 changes: 7 additions & 5 deletions src/maps/mapView/mapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ import {
type Polyline,
} from '..';

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

const { onMapViewControllerCreated } = props;

/**
* @param {any} _ref - The reference to the NavViewManager component.
* @param ref - The reference to the NavViewManager component.
*/
const onRefAssign = (_ref: any) => {
if (mapViewRef.current !== _ref) {
mapViewRef.current = _ref;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const onRefAssign = (ref: any): void => {
if (mapViewRef.current !== ref) {
mapViewRef.current = ref;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/navigation/navigation/NavigationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const NavigationProvider = ({
termsAndConditionsDialogOptions,
taskRemovedBehavior,
children,
}: NavigationProviderProps) => {
}: NavigationProviderProps): React.JSX.Element => {
const { navigationController, addListeners, removeListeners } =
useNavigationController(
termsAndConditionsDialogOptions,
Expand Down
1 change: 1 addition & 0 deletions src/navigation/navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,5 @@ export enum TaskRemovedBehavior {
/**
* Defines the turn-by-turn event data.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface TurnByTurnEvent {}
16 changes: 10 additions & 6 deletions src/navigation/navigationView/navigationView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,27 @@ import {
type Polyline,
} from '../../maps';

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

const {
onMapViewControllerCreated,
androidStylingOptions,
iOSStylingOptions,
onNavigationViewControllerCreated,
onMapViewControllerCreated,
} = props;

/**
* @param {any} _ref - The reference to the NavViewManager component.
* @param ref - The reference to the NavViewManager component.
*/
const onRefAssign = (_ref: any) => {
if (mapViewRef.current !== _ref) {
mapViewRef.current = _ref;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const onRefAssign = (ref: any): void => {
if (mapViewRef.current !== ref) {
mapViewRef.current = ref;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/navigation/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import { RouteStatus } from './types';

export const getRouteStatusFromStringValue = (value: string) => {
export const getRouteStatusFromStringValue = (value: string): RouteStatus => {
switch (value) {
case 'OK':
return RouteStatus.OK;
Expand Down
1 change: 1 addition & 0 deletions src/shared/useModuleListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ListenerMap<T> = {
// A hook to manage event listeners for a specific Native Module,
// using the cross-platform NativeEventEmitter.
export const useModuleListeners = <
// eslint-disable-next-line @typescript-eslint/no-explicit-any
T extends { [K in keyof T]: ((...args: any[]) => void) | undefined },
>(
dispatcher: keyof NativeModules,
Expand Down
4 changes: 3 additions & 1 deletion src/shared/viewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export const viewManagerName =
export const sendCommand = (
viewId: number,
command: number | undefined,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args?: any[]
) => {
): void => {
if (command === undefined) {
throw new Error(
"Command not found, please make sure you're using the referencing the right method"
Expand All @@ -43,6 +44,7 @@ export const sendCommand = (
try {
UIManager.dispatchViewManagerCommand(
viewId,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Platform.OS === 'android' ? (command.toString() as any) : command,
args
);
Expand Down
Loading
Loading