Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint errors #450 #573

Merged
merged 1 commit into from
Mar 13, 2024
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
3 changes: 1 addition & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ module.exports = [
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
// ...eslintPluginImport.configs.recommended.rules,
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
"import/no-unused-modules": "error" ,
'prettier/prettier': [
'error',
Expand Down
4 changes: 2 additions & 2 deletions src/api/groupByService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function groupbyAsync({
await fetch(
`${BASE_PATH}/gtfs_rides_agg/group_by?date_from=${dateFromStr}&date_to=${dateToStr}&group_by=${groupBy}&${excludes}`,
)
).json()
).json() as Promise<GroupByResponse>
}

export function useGroupBy({
Expand Down Expand Up @@ -127,7 +127,7 @@ export function useGroupBy({
.filter((dataRecord) => dataRecord.operator_ref !== undefined),
)
})
.catch((er) => setError(er))
.catch((er: string) => setError(er))
.finally(() => setLoading(false))
}, [+dateTo, +dateFrom, groupBy])

Expand Down
2 changes: 1 addition & 1 deletion src/api/useVehicleLocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class LocationObservable {

const response = await fetchWithQueue(url)
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const data = await response!.json()
const data: VehicleLocation[] = await response!.json()
if (data.length === 0) {
this.loading = false
this.#notifyObservers({
Expand Down
6 changes: 3 additions & 3 deletions src/pages/BugReportForm .tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const BugReportForm = () => {
attachments: fileList,
},
)

setSubmittedUrl(response.data.url)
const url: string = response.data.url
setSubmittedUrl(url)
if (response.data.state === 'open') {
message.success(t('reportBug.success'))
form.resetFields()
Expand Down Expand Up @@ -89,7 +89,7 @@ const BugReportForm = () => {
name="type"
initialValue={selectedType}
rules={[{ required: true, message: t('bug_type_message') }]}>
<Select onChange={(value) => setSelectedType(value)}>
<Select onChange={(value: string) => setSelectedType(value)}>
<Option value="bug">{t('bug_type_bug')}</Option>
<Option value="feature">{t('bug_type_feature')}</Option>
</Select>
Expand Down
12 changes: 8 additions & 4 deletions src/pages/dashboard/ArrivalByTimeChart/ArrivalByTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import './ArrivalByTimeChats.scss'
import { useMemo } from 'react'
import moment from 'moment'
import moment, { MomentInput } from 'moment'

/**
* Group array items by a common property value returned from the callback (ie. group by value of id).
Expand Down Expand Up @@ -107,7 +107,7 @@ export default function ArrivalByTimeChart({
dataKey={
'gtfs_route_date' in operatorData[0] ? 'gtfs_route_date' : 'gtfs_route_hour'
}
tickFormatter={(tick) => moment(tick).format('dddd')}
tickFormatter={(tick: MomentInput) => moment(tick).format('dddd')}
interval={'gtfs_route_hour' in operatorData[0] ? 23 : 0}
/>
<YAxis domain={[0, 100]} tickMargin={35} unit={'%'} />
Expand All @@ -120,8 +120,12 @@ export default function ArrivalByTimeChart({
<span className="label">זמן: </span>
<span className="value">
{payload[0].payload.gtfs_route_date
? moment.utc(payload[0].payload.gtfs_route_date).format('יום ddd, L')
: moment(payload[0].payload.gtfs_route_hour).format('יום ddd, L, LT')}
? moment
.utc(payload[0].payload.gtfs_route_date as MomentInput)
.format('יום ddd, L')
: moment(payload[0].payload.gtfs_route_hour as MomentInput).format(
'יום ddd, L, LT',
)}
</span>
</li>
<li>
Expand Down
Loading