Skip to content

Commit 3e02d4b

Browse files
committed
lint
1 parent b553452 commit 3e02d4b

File tree

5 files changed

+114
-83
lines changed

5 files changed

+114
-83
lines changed

web-app/src/app/components/Header.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,20 @@ export default function DrawerAppBar(): React.ReactElement {
233233
onClick={() => {
234234
handleMenuItemClick('gbfs-validator');
235235
}}
236-
sx={{display: 'flex', gap: 1}}
236+
sx={{ display: 'flex', gap: 1 }}
237237
>
238-
<BikeScooterOutlined
239-
fontSize='small'
240-
sx={{ color: theme.palette.text.primary }}
241-
/>
238+
<BikeScooterOutlined
239+
fontSize='small'
240+
sx={{ color: theme.palette.text.primary }}
241+
/>
242242
{t('gbfsValidator')}
243243
</MenuItem>
244244
<MenuItem
245245
key={'gtfs-validator'}
246246
onClick={() => {
247247
handleMenuItemClick('gtfs-validator');
248248
}}
249-
sx={{display: 'flex', gap: 1}}
249+
sx={{ display: 'flex', gap: 1 }}
250250
disabled={true}
251251
>
252252
<DirectionsBusIcon

web-app/src/app/components/HeaderMobileDrawer.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default function DrawerContent({
9999
{item.title}
100100
</Button>
101101
))}
102-
102+
103103
<Divider sx={{ mt: 2 }} />
104104
{config.gbfsValidator && (
105105
<Accordion disableGutters={true} sx={{ boxShadow: 'none' }}>
@@ -218,11 +218,7 @@ export default function DrawerContent({
218218
</AccordionDetails>
219219
</Accordion>
220220
) : (
221-
<Button
222-
variant='contained'
223-
sx={{ml:2}}
224-
href={SIGN_IN_TARGET}
225-
>
221+
<Button variant='contained' sx={{ ml: 2 }} href={SIGN_IN_TARGET}>
226222
Login
227223
</Button>
228224
)}

web-app/src/app/screens/GbfsValidator/GbfsFeedSearchInput.tsx

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
FormControl,
1313
MenuItem,
1414
Select,
15-
SelectChangeEvent,
15+
type SelectChangeEvent,
1616
} from '@mui/material';
1717
import SearchIcon from '@mui/icons-material/Search';
1818
import { useState } from 'react';
@@ -37,11 +37,11 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
3737
const [oauthClientSecret, setOauthClientSecret] = useState<string>('');
3838
const [oauthTokenUrl, setOauthTokenUrl] = useState<string>('');
3939

40-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
40+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
4141
setRequiresAuth(event.target.checked);
4242
};
4343

44-
const handleAuthTypeChange = (event: SelectChangeEvent<string>) => {
44+
const handleAuthTypeChange = (event: SelectChangeEvent<string>): void => {
4545
setAuthType(event.target.value);
4646
setBasicAuthUsername('');
4747
setBasicAuthPassword('');
@@ -52,17 +52,21 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
5252
};
5353

5454
const isSubmitBoxDisabled = (): boolean => {
55-
if (!autoDiscoveryUrlInput) return true;
55+
if (autoDiscoveryUrlInput === '') return true;
5656
if (requiresAuth) {
57-
if (!authType) return true;
57+
if (authType === '') return true;
5858
if (authType === AuthTypeEnum.BASIC) {
59-
if (!basicAuthUsername || !basicAuthPassword) return true;
59+
if (basicAuthUsername === '' || basicAuthPassword === '') return true;
6060
}
6161
if (authType === AuthTypeEnum.BEARER) {
62-
if (!bearerAuthValue) return true;
62+
if (bearerAuthValue === '') return true;
6363
}
6464
if (authType === AuthTypeEnum.OAUTH) {
65-
if (!oauthClientId || !oauthClientSecret || !oauthTokenUrl)
65+
if (
66+
oauthClientId === '' ||
67+
oauthClientSecret === '' ||
68+
oauthTokenUrl === ''
69+
)
6670
return true;
6771
}
6872
}
@@ -73,13 +77,11 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
7377
// 1. dispatch action with url and auth details (state -> loading)
7478
// once done then
7579
// 2. navigate to /gbfs-validator?AutoDiscoveryUrl=url
76-
7780
// or
78-
7981
// navigate to /gbfs-validator?AutoDiscoveryUrl=url&auth details
8082
// store the auth details in context
8183
// let the GbfsValidator component handle the loading state
82-
}
84+
};
8385

8486
return (
8587
<Box
@@ -99,16 +101,18 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
99101
display: 'flex',
100102
justifyContent: 'space-between',
101103
alignItems: 'center',
102-
p: {xs: 0}
104+
p: { xs: 0 },
103105
}}
104106
>
105107
<TextField
106108
variant='outlined'
107109
placeholder='eg: https://example.com/gbfs.json'
108110
sx={{ width: '100%', mr: 2 }}
109-
onChange={(e) => setAutoDiscoveryUrlInput(e.target.value)}
111+
onChange={(e) => {
112+
setAutoDiscoveryUrlInput(e.target.value);
113+
}}
110114
InputProps={{
111-
startAdornment: <SearchIcon sx={{mr:1}}></SearchIcon>,
115+
startAdornment: <SearchIcon sx={{ mr: 1 }}></SearchIcon>,
112116
}}
113117
/>
114118
<Button
@@ -121,7 +125,9 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
121125
)}`}
122126
disabled={isSubmitBoxDisabled()}
123127
type='submit'
124-
onClick={() => validateGBFSFeed()}
128+
onClick={() => {
129+
validateGBFSFeed();
130+
}}
125131
>
126132
Validate
127133
</Button>
@@ -144,20 +150,24 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
144150
</MenuItem>
145151
<MenuItem value={AuthTypeEnum.BASIC}>Basic Auth</MenuItem>
146152
<MenuItem value={AuthTypeEnum.BEARER}>Bearer Token</MenuItem>
147-
<MenuItem value={AuthTypeEnum.OAUTH}>Oauth Client Credentials Grant</MenuItem>
153+
<MenuItem value={AuthTypeEnum.OAUTH}>
154+
Oauth Client Credentials Grant
155+
</MenuItem>
148156
</Select>
149157
</FormControl>
150158
)}
151159

152160
{requiresAuth && authType === AuthTypeEnum.BASIC && (
153-
<Box sx={{ display: 'flex', gap: 2, mt: 2, }}>
161+
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
154162
<TextField
155163
size='small'
156164
variant='outlined'
157165
label='Username'
158166
placeholder='Enter Username'
159167
fullWidth
160-
onChange={(e) => setBasicAuthUsername(e.target.value)}
168+
onChange={(e) => {
169+
setBasicAuthUsername(e.target.value);
170+
}}
161171
/>
162172
<TextField
163173
size='small'
@@ -166,7 +176,9 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
166176
placeholder='Enter Password'
167177
type='password'
168178
fullWidth
169-
onChange={(e) => setBasicAuthPassword(e.target.value)}
179+
onChange={(e) => {
180+
setBasicAuthPassword(e.target.value);
181+
}}
170182
/>
171183
</Box>
172184
)}
@@ -179,36 +191,43 @@ export default function GbfsFeedSearchInput(): React.ReactElement {
179191
placeholder='Enter Bearer Token'
180192
sx={{ mt: 2 }}
181193
fullWidth
182-
onChange={(e) => setBearerAuthValue(e.target.value)}
183-
194+
onChange={(e) => {
195+
setBearerAuthValue(e.target.value);
196+
}}
184197
/>
185198
)}
186199

187200
{requiresAuth && authType === AuthTypeEnum.OAUTH && (
188-
<Box sx={{ display: 'flex', gap: 2, mt: 2, }}>
201+
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
189202
<TextField
190203
size='small'
191204
variant='outlined'
192205
placeholder='Client Id'
193206
label='Client Id'
194207
fullWidth
195-
onChange={(e) => setOauthClientId(e.target.value)}
208+
onChange={(e) => {
209+
setOauthClientId(e.target.value);
210+
}}
196211
/>
197212
<TextField
198213
size='small'
199214
variant='outlined'
200215
placeholder='Enter Client Secret'
201216
label='Client Secret'
202217
fullWidth
203-
onChange={(e) => setOauthClientSecret(e.target.value)}
218+
onChange={(e) => {
219+
setOauthClientSecret(e.target.value);
220+
}}
204221
/>
205222
<TextField
206223
size='small'
207224
variant='outlined'
208225
placeholder='Enter Token Url'
209226
label='Token Url'
210227
fullWidth
211-
onChange={(e) => setOauthTokenUrl(e.target.value)}
228+
onChange={(e) => {
229+
setOauthTokenUrl(e.target.value);
230+
}}
212231
/>
213232
</Box>
214233
)}

web-app/src/app/screens/GbfsValidator/ValidationReport.tsx

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Link, Typography, useTheme } from '@mui/material';
1+
import { Box, Typography, useTheme } from '@mui/material';
22
import sampleReponse from './sampleResponse.json';
33
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
44
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
@@ -24,9 +24,7 @@ export interface FileError {
2424
instancePath: string;
2525
schemaPath: string;
2626
message: string;
27-
params: {
28-
[key: string]: any;
29-
};
27+
params: Record<string, unknown>;
3028
}
3129

3230
export default function ValidationReport(): React.ReactElement {
@@ -41,8 +39,7 @@ export default function ValidationReport(): React.ReactElement {
4139
alignItems: 'center',
4240
mb: 2,
4341
}}
44-
>
45-
</Box>
42+
></Box>
4643

4744
<Box
4845
sx={{
@@ -63,16 +60,19 @@ export default function ValidationReport(): React.ReactElement {
6360
width: '300px',
6461
}}
6562
>
66-
<Typography variant='h5' sx={{ fontWeight: 700, p: 2, mb: 2}}>
63+
<Typography variant='h5' sx={{ fontWeight: 700, p: 2, mb: 2 }}>
6764
GBFS Feed Files Summary
6865
</Typography>
6966
<Typography variant='body1' sx={{ fontWeight: 700, ml: 2 }}>
7067
Validator Version: {validationResult.summary.validatorVersion}
7168
</Typography>
72-
<Typography variant='body1' sx={{ fontWeight: 700, ml: 2, color: theme.palette.error.main }}>
69+
<Typography
70+
variant='body1'
71+
sx={{ fontWeight: 700, ml: 2, color: theme.palette.error.main }}
72+
>
7373
Invalid GBFS Feed
7474
</Typography>
75-
<Typography variant='h6' sx={{ mb: 1, ml: 2 }}>
75+
<Typography variant='h6' sx={{ mb: 1, ml: 2 }}>
7676
Total Errors: <b>3</b>
7777
</Typography>
7878

@@ -85,11 +85,17 @@ export default function ValidationReport(): React.ReactElement {
8585
justifyContent: 'space-between',
8686
alignItems: 'center',
8787
p: 2,
88-
pb: 1
88+
pb: 1,
8989
}}
9090
key={file.name}
9191
>
92-
<Typography component={'a'} href='' sx={{color: 'black', textDecoration: 'none'}}>{file.name}</Typography>
92+
<Typography
93+
component={'a'}
94+
href=''
95+
sx={{ color: 'black', textDecoration: 'none' }}
96+
>
97+
{file.name}
98+
</Typography>
9399
{hasErrors ? (
94100
<ErrorOutlineIcon
95101
fontSize='small'
@@ -121,8 +127,8 @@ export default function ValidationReport(): React.ReactElement {
121127
key={file.name}
122128
sx={{
123129
backgroundColor: hasErrors
124-
? ''//theme.palette.error.light
125-
: '#80c883',//theme.palette.success.light,
130+
? '' // theme.palette.error.light
131+
: '#80c883', // theme.palette.success.light,
126132
position: 'relative',
127133
p: 2,
128134
}}
@@ -136,7 +142,14 @@ export default function ValidationReport(): React.ReactElement {
136142
>
137143
<Typography
138144
variant='h5'
139-
sx={{ fontWeight: 700, mb: 0, ml: 2, color: hasErrors ? theme.palette.error.dark : theme.palette.success.dark }}
145+
sx={{
146+
fontWeight: 700,
147+
mb: 0,
148+
ml: 2,
149+
color: hasErrors
150+
? theme.palette.error.dark
151+
: theme.palette.success.dark,
152+
}}
140153
>
141154
{file.name}.json
142155
</Typography>
@@ -157,7 +170,7 @@ export default function ValidationReport(): React.ReactElement {
157170
<>
158171
<Typography
159172
variant='h6'
160-
sx={{ m:1, ml: 2, color: theme.palette.error.dark }}
173+
sx={{ m: 1, ml: 2, color: theme.palette.error.dark }}
161174
>
162175
Errors:
163176
</Typography>
@@ -169,29 +182,23 @@ export default function ValidationReport(): React.ReactElement {
169182
</Typography>
170183
</Box>
171184
<Box sx={{ ml: 2 }}>
172-
<Typography
173-
variant='body1'
174-
sx={{ mb: 1 }}
175-
>
176-
<b style={{marginRight: '16px'}}>Message:</b> {error.message}
185+
<Typography variant='body1' sx={{ mb: 1 }}>
186+
<b style={{ marginRight: '16px' }}>Message:</b>{' '}
187+
{error.message}
177188
</Typography>
178-
<Typography
179-
variant='body1'
180-
sx={{ mb: 1 }}
181-
>
182-
<b style={{marginRight: '16px'}}>Instance Path:</b> {error.instancePath}
189+
<Typography variant='body1' sx={{ mb: 1 }}>
190+
<b style={{ marginRight: '16px' }}>
191+
Instance Path:
192+
</b>{' '}
193+
{error.instancePath}
183194
</Typography>
184-
<Typography
185-
variant='body1'
186-
sx={{ mb: 1 }}
187-
>
188-
<b style={{marginRight: '16px'}}>Schema Path:</b> {error.schemaPath}
195+
<Typography variant='body1' sx={{ mb: 1 }}>
196+
<b style={{ marginRight: '16px' }}>Schema Path:</b>{' '}
197+
{error.schemaPath}
189198
</Typography>
190-
<Typography
191-
variant='body1'
192-
sx={{ mb: 1 }}
193-
>
194-
<b style={{marginRight: '16px'}}>Params:</b> {JSON.stringify(error.params)}
199+
<Typography variant='body1' sx={{ mb: 1 }}>
200+
<b style={{ marginRight: '16px' }}>Params:</b>{' '}
201+
{JSON.stringify(error.params)}
195202
</Typography>
196203
</Box>
197204
</Box>

0 commit comments

Comments
 (0)