Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Update eslint config, fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb-sti1 committed Sep 18, 2023
1 parent 6996c65 commit 00dcac6
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 62 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"private": true,
"license": "UNLICENSED",
"scripts": {
"build": "CI=false nest build",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
Expand Down
4 changes: 4 additions & 0 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module.exports = {
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
],
root: true,
env: {
Expand All @@ -21,5 +23,7 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
},
};
119 changes: 93 additions & 26 deletions frontend/package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,13 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.46",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react-leaflet": "^3.0.0",
"@types/react-router-dom": "^5.3.3",
"axios": "^1.5.0",
"chart.js": "^3.8.0",
"d3": "^7.8.5",
"leaflet": "^1.9.4",
"react": "^18.2.0",
"react-docgen": "^5.4.3",
"react-chartjs-2": "^4.2.0",
"react-docgen": "^5.4.3",
"react-dom": "^18.2.0",
"react-gradient-hook": "^1.5.3",
"react-leaflet": "^4.2.1",
Expand All @@ -31,7 +22,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "CI=false react-scripts build",
"build": "react-scripts build",
"test": "CI=true react-scripts test",
"eject": "react-scripts eject",
"doc": "styleguidist build --config styleguide.config.js",
Expand All @@ -56,9 +47,18 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.46",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react-leaflet": "^3.0.0",
"@types/react-router-dom": "^5.3.3",
"@types/d3": "^7.1.0",
"@types/leaflet": "^1.9.4",
"@types/react": "^17.0.24",
"@types/react-slider": "^1.3.1",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.48.0",
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/Components/Map/Renderers/DistHotline.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { FC, useEffect, useMemo, useState } from 'react';
import { FC, useEffect, useMemo } from 'react';
import { LeafletEvent, Polyline } from 'leaflet';
import { HotlineOptions, useCustomHotline } from 'react-leaflet-hotline';

import { useGraph } from '../../../context/GraphContext';

import { Condition, Node, WayId } from '../../../models/path';

import DistRenderer from '../../../assets/hotline/DistRenderer';
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/Components/Palette/PaletteEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FC, MouseEvent, useState } from 'react';
import { FC, useState } from 'react';
import { Gradient } from 'react-gradient-hook';
import { CursorOptions } from 'react-gradient-hook/lib/types';
import { useMap } from 'react-leaflet';
import { Palette } from 'react-leaflet-hotline';

import '../../css/palette.css';
Expand Down
22 changes: 11 additions & 11 deletions frontend/src/Components/RoadConditions/ConditionsGraph.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { FC, useCallback, useEffect, useMemo, useRef } from 'react';
import { FC, useEffect, useMemo, useRef } from 'react';
import {
ChartData,
Chart,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
ActiveElement,
CategoryScale,
Chart,
ChartData,
ChartEvent,
ChartOptions,
ChartTypeRegistry,
Legend,
LinearScale,
LineElement,
Plugin,
PointElement,
Title,
Tooltip,
} from 'chart.js';
import { Color, Palette } from 'react-leaflet-hotline';
import { Line } from 'react-chartjs-2';
Expand Down Expand Up @@ -104,7 +104,7 @@ const ConditionsGraph: FC<Props> = ({ type, data, palette }) => {
onClick: (
event: ChartEvent,
elts: ActiveElement[],
chart: Chart<keyof ChartTypeRegistry, number[], unknown>,
_chart: Chart<keyof ChartTypeRegistry, number[], unknown>,
) => {
if (elts.length === 0) return;
const elt = elts[0]; // doesnt work if multiple datasets
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/RoadConditions/ConditionsMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ConditionsMap: FC<Props> = ({
const { name, max, grid, samples } = type;

const ref = useRef(null);
const [width, _] = useSize(ref);
const [width] = useSize(ref);

const onClick = useCallback((way_id: string, way_length: number) => {
console.log('onclick called');
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/RoadConditions/Ways.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { FC, useEffect, useMemo, useState } from 'react';
import { TRGB } from 'react-gradient-hook/lib/types';
import { HotlineOptions } from 'react-leaflet-hotline';
import { HotlineEventHandlers } from 'react-leaflet-hotline/dist/types/types';
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/assets/hotline/DistRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LatLng, Map } from 'leaflet';
import { HotlineOptions, Renderer } from 'react-leaflet-hotline';

import { Condition, Node, WayId } from '../../models/path';
import { Condition, WayId } from '../../models/path';
import { DotHover } from '../graph/types';
import { DistData, DistPoint } from './hotline';
import Edge from './Edge';
Expand Down Expand Up @@ -52,7 +52,9 @@ export default class DistRenderer extends Renderer<DistData> {
this.dotHover !== undefined && this.dotHover.label !== way_id ? 0.3 : 1;
try {
gradient.addColorStop(dist, `rgba(${edge.get().join(',')},${opacity})`);
} catch {}
} catch {
// eslint-disable-next-line no-empty
}
}

/**
Expand All @@ -72,7 +74,9 @@ export default class DistRenderer extends Renderer<DistData> {
else if (d.way_dist >= 1 || i >= conditions.length)
return conditions[conditions.length - 1].value;

while (conditions[i].way_dist <= d.way_dist && ++i < conditions.length) {}
while (conditions[i].way_dist <= d.way_dist && ++i < conditions.length) {
// eslint-disable-next-line no-empty
}

if (i === 0) return conditions[0].value;
else if (i >= conditions.length - 1)
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/context/GraphHoverContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {

import { Map } from 'leaflet';

import useMinMaxAxis from '../hooks/useMinMaxAxis';
import { AddMinMaxFunc, DotHover, RemMinMaxFunc } from '../assets/graph/types';
import { DotHover } from '../assets/graph/types';

interface HoverContextProps {
dotHover: DotHover | undefined;
Expand Down

0 comments on commit 00dcac6

Please sign in to comment.