Skip to content

Commit

Permalink
style(eslint): turn an ESLint rule back on
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayata Suenaga committed Aug 11, 2023
1 parent fbaa463 commit 352805a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
},
],
'no-invalid-this': 'error',
'no-use-before-define': 'off',
'prefer-arrow-callback': 'off',
'react/function-component-definition': [
'error',
Expand Down Expand Up @@ -42,7 +41,6 @@ module.exports = {
},
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-use-before-define': 'off',
},
},
],
Expand Down
18 changes: 9 additions & 9 deletions src/MapView/MapView.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import 'mapbox-gl/dist/mapbox-gl.css';
import Direction from './Direction';
import {DEFAULT_INITIAL_STATE} from './CONST';

const getMapDimension = (mapRef: RefObject<MapRef>): {width: number; height: number} | undefined => {
if (!mapRef.current?.getMap()) {
return undefined;
}

const {clientWidth, clientHeight} = mapRef.current.getCanvas();
return {width: clientWidth, height: clientHeight};
};

const MapView = forwardRef<MapViewHandle, MapViewProps>(function MapView(
{accessToken, waypoints, style, mapPadding, markerComponent: MarkerComponent, directionCoordinates, initialState = DEFAULT_INITIAL_STATE},
ref,
Expand Down Expand Up @@ -88,13 +97,4 @@ const MapView = forwardRef<MapViewHandle, MapViewProps>(function MapView(
);
});

const getMapDimension = (mapRef: RefObject<MapRef>): {width: number; height: number} | undefined => {
if (!mapRef.current?.getMap()) {
return undefined;
}

const {clientWidth, clientHeight} = mapRef.current.getCanvas();
return {width: clientWidth, height: clientHeight};
};

export default MapView;

0 comments on commit 352805a

Please sign in to comment.