Skip to content

Commit

Permalink
fix: add no-debugger rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ahennr committed Jan 24, 2025
1 parent 565c5da commit 6ce69a1
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 19 deletions.
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import importPlugin from 'eslint-plugin-import';
import eslintReact from 'eslint-plugin-react';
import eslintMarkdown from 'eslint-plugin-markdown';
import eslintTerrestris from '@terrestris/eslint-config-typescript';
import eslintReactTerrestris from '@terrestris/eslint-config-typescript-react';
import eslint from '@eslint/js';
Expand Down Expand Up @@ -53,6 +54,8 @@ export default tsEslint.config({
...eslintTerrestris.rules,
...eslintReactTerrestris.rules,
...reactHooks.configs.recommended.rules,
...eslintMarkdown.configs.recommended.rules,
'no-debugger': 'error',
'react/jsx-closing-tag-location': ['warn'],
'react/jsx-closing-bracket-location': ['warn'],
'react-hooks/rules-of-hooks': ['warn'],
Expand Down
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/Button/GeoLocationButton/GeoLocationButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('<GeoLocationButton />', () => {
});

it('can be rendered', () => {
const { container } = render(<GeoLocationButton />);
const { container } = render(<GeoLocationButton />);
expect(container).toBeVisible();
});

Expand All @@ -48,13 +48,15 @@ describe('<GeoLocationButton />', () => {
showMarker={false}
onGeoLocationChange={callback}
pressed={false}
enableTracking={true}
/>
));

rerenderInMapContext(<GeoLocationButton
showMarker={false}
onGeoLocationChange={callback}
pressed={true}
enableTracking={true}
/>);

act(() => {
Expand All @@ -71,6 +73,7 @@ describe('<GeoLocationButton />', () => {
showMarker={false}
onGeoLocationChange={callback}
pressed={false}
enableTracking={true}
/>));

expect(callback).toBeCalledTimes(0);
Expand All @@ -79,6 +82,7 @@ describe('<GeoLocationButton />', () => {
showMarker={false}
onGeoLocationChange={callback}
pressed={true}
enableTracking={true}
/>);

act(() => {
Expand All @@ -103,12 +107,14 @@ describe('<GeoLocationButton />', () => {
showMarker={false}
onGeoLocationChange={callback}
pressed={false}
enableTracking={true}
/>);

rerenderInMapContext(<GeoLocationButton
showMarker={false}
onGeoLocationChange={callback}
pressed={true}
enableTracking={true}
/>);

const coordinates = [ 47.12, -64.99 ];
Expand Down
8 changes: 4 additions & 4 deletions src/Button/GeoLocationButton/GeoLocationButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export type GeoLocationButtonProps = OwnProps & Partial<ToggleButtonProps>;

export const GeoLocationButton: FC<GeoLocationButtonProps> = ({
className,
follow = false,
enableTracking = false,
onGeoLocationChange = () => undefined,
follow = false,
onError = () => undefined,
onGeoLocationChange = () => undefined,
pressed,
showMarker = true,
trackingOptions,
pressed,
...passThroughProps
}) => {

useGeoLocation({
active: !!pressed,
enableTracking: pressed,
enableTracking: pressed && enableTracking,
follow,
onError,
onGeoLocationChange,
Expand Down
13 changes: 7 additions & 6 deletions src/Panel/TimeLayerSliderPanel/TimeLayerSliderPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './TimeLayerSliderPanel.less';

import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
import React, { useMemo, useCallback, useEffect, useState } from 'react';

import {
faCalendar,
Expand All @@ -9,16 +9,17 @@ import {
faSync
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import logger from '@terrestris/base-util/dist/Logger';
import { WmsLayer } from '@terrestris/ol-util/dist/typeUtils/typeUtils';

import { DatePicker, Popover, Select, Spin } from 'antd';
import dayjs, { Dayjs } from 'dayjs';
import minmax from 'dayjs/plugin/minMax';
import _isFinite from 'lodash/isFinite';
import _isFunction from 'lodash/isFunction';
import _isNil from 'lodash/isNil';
import {ImageWMS, TileWMS} from 'ol/source';
import React, {useCallback, useEffect, useMemo, useState} from 'react';

import logger from '@terrestris/base-util/dist/Logger';
import { WmsLayer } from '@terrestris/ol-util/dist/typeUtils/typeUtils';

import SimpleButton from '../../Button/SimpleButton/SimpleButton';
import ToggleButton from '../../Button/ToggleButton/ToggleButton';
Expand All @@ -29,7 +30,7 @@ dayjs.extend(minmax);
const RangePicker = DatePicker.RangePicker;
const Option = Select.Option;

export type TimeLayerSliderPanelTooltips = {
export interface TimeLayerSliderPanelTooltips{
dataRange: string;
days: string;
hours: string;
Expand All @@ -38,7 +39,7 @@ export type TimeLayerSliderPanelTooltips = {
setToMostRecent: string;
weeks: string;
years: string;
};
}

export type PlaybackSpeedUnit = 'minute' | 'hours' | 'days' | 'weeks' | 'months' | 'years';

Expand Down
9 changes: 5 additions & 4 deletions src/Slider/TimeSlider/TimeSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React, { useMemo } from 'react';

import { Slider } from 'antd';
import dayjs, { Dayjs } from 'dayjs';
import _isArray from 'lodash/isArray';
import _isFunction from 'lodash/isFunction';
import { MarkObj } from 'rc-slider/lib/Marks';
import React, { useMemo } from 'react';

import { CSS_PREFIX } from '../../constants';

export type TimeSliderMark= {
export interface TimeSliderMark {
timestamp: Dayjs;
markConfig: MarkObj;
};
}

interface OwnProps {
className?: string;
Expand Down Expand Up @@ -54,7 +55,7 @@ const TimeSlider: React.FC<TimeSliderProps> = ({
if (!marks) {
return;
}
let convertedMks: Record<number, MarkObj> = {};
const convertedMks: Record<number, MarkObj> = {};
marks.forEach((mark) => {
const convertedTimestamp = convertDayjsToUnix(mark.timestamp);
if (Array.isArray(convertedTimestamp)) {
Expand Down

0 comments on commit 6ce69a1

Please sign in to comment.