Skip to content

Commit

Permalink
front: turn on @typescript-eslint/no-unsafe-call lint
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Sep 24, 2024
1 parent f4ddc9d commit bccd311
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions front/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unsafe-call": "error",

"@typescript-eslint/ban-types": [
"error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export type FormContext = {
isCreation: boolean;
};

const IntervalEditorComponent = (props: FieldProps<GeoJsonProperties, RJSFSchema, FormContext>) => {
const IntervalEditorComponent = (
props: FieldProps<LinearMetadataItem[], RJSFSchema, FormContext>
) => {
const { name, formContext, formData, schema, onChange, registry } = props;
const { openModal, closeModal } = useModal();
const { t } = useTranslation();
Expand Down Expand Up @@ -421,7 +423,7 @@ const IntervalEditorComponent = (props: FieldProps<GeoJsonProperties, RJSFSchema
);
};

export const FormComponent = (props: FieldProps<GeoJsonProperties, RJSFSchema, FormContext>) => {
export const FormComponent = (props: FieldProps<unknown, RJSFSchema, FormContext>) => {
const { name, formContext, schema, registry } = props;
const Fields = getDefaultRegistry().fields;

Expand Down Expand Up @@ -471,10 +473,15 @@ export const FormComponent = (props: FieldProps<GeoJsonProperties, RJSFSchema, F
jsonSchema={jsonSchema}
distance={distance}
requiredFilter={requiredFilter}
{...props}
{...(props as FieldProps<LinearMetadataItem[], RJSFSchema, FormContext>)}
/>
);
return <Fields.ArrayField {...props} schema={jsonSchema} />;
return (
<Fields.ArrayField
{...(props as FieldProps<GeoJsonProperties, RJSFSchema, FormContext>)}
schema={jsonSchema}
/>
);
};

export default FormComponent;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as d3 from 'd3';
import { pointer } from 'd3-selection';
import { zoom as d3zoom } from 'd3-zoom';
import { zoom as d3zoom, type D3ZoomEvent } from 'd3-zoom';
import { mapValues } from 'lodash';

import {
Expand Down Expand Up @@ -282,8 +282,9 @@ export const enableInteractivity = <
])
.wheelDelta(wheelDelta)
// Allows evenements to be triggered on zoom and drag interactions for all graphs
.on('zoom', (event) => {
event.sourceEvent.preventDefault();
.on('zoom', (event: D3ZoomEvent<Element, ConsolidatedRouteAspect>) => {
const { sourceEvent }: { sourceEvent: Event } = event;
sourceEvent.preventDefault();
const updatedAxis = updateChart(chart, keyValues, additionalValues, rotate, event);
// Overide axis with new ones from updated chart
const newChart = {
Expand Down Expand Up @@ -357,7 +358,7 @@ export const enableInteractivity = <
chart.svg
.on('mouseover', () => displayGuide(chart, 1))
.on('mousemove', mousemove)
.on('wheel', (event) => {
.on('wheel', (event: WheelEvent) => {
if (event.ctrlKey || event.shiftKey) {
event.preventDefault();
}
Expand Down

0 comments on commit bccd311

Please sign in to comment.