Skip to content

Commit 7961aad

Browse files
committed
fix(src): Fix basic linting errors
Signed-off-by: Helio Chissini de Castro <[email protected]>
1 parent 19a675f commit 7961aad

File tree

16 files changed

+395
-172
lines changed

16 files changed

+395
-172
lines changed

biome.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
},
88
"files": {
99
"ignoreUnknown": false,
10-
"includes": ["src/**", "Dockerfile", "tsconfig.json", "package.json"]
10+
"includes": [
11+
"src/**",
12+
"Dockerfile",
13+
"tsconfig.json",
14+
"package.json"
15+
]
1116
},
1217
"formatter": {
1318
"enabled": true,
@@ -79,7 +84,7 @@
7984
"noDuplicateObjectKeys": "error",
8085
"noDuplicateParameters": "error",
8186
"noEmptyBlockStatements": "error",
82-
"noExplicitAny": "error",
87+
"noExplicitAny": "warn",
8388
"noExtraNonNullAssertion": "error",
8489
"noFallthroughSwitchClause": "error",
8590
"noFunctionAssign": "error",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@
6666
},
6767
"lint-staged": {
6868
"**/*.{js,jsx,ts,tsx}": [
69-
"eslint"
69+
"biome check --reporter=summary"
7070
],
7171
"**/*.{css,scss,md,html,json}": [
72-
"prettier --write"
72+
"biome format"
7373
]
7474
},
7575
"commitlint": {

src/app/[locale]/admin/oauthclient/components/AddClientDialog.tsx

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
// License-Filename: LICENSE
1111

1212
'use client'
13-
import { HttpStatus, OAuthClient } from '@/object-types'
14-
import MessageService from '@/services/message.service'
15-
import CommonUtils from '@/utils/common.utils'
16-
import { SW360_API_URL } from '@/utils/env'
1713
import { getSession, signOut, useSession } from 'next-auth/react'
1814
import { useTranslations } from 'next-intl'
1915
import { ReactNode, useEffect, useState } from 'react'
2016
import { Button, Col, Form, Modal, Row } from 'react-bootstrap'
17+
import { HttpStatus, OAuthClient } from '@/object-types'
18+
import MessageService from '@/services/message.service'
19+
import CommonUtils from '@/utils/common.utils'
20+
import { SW360_API_URL } from '@/utils/env'
2121

2222
interface Props {
2323
show: boolean
@@ -67,10 +67,15 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
6767
if (status === 'unauthenticated') {
6868
signOut()
6969
}
70-
}, [status])
70+
}, [
71+
status,
72+
])
7173

7274
const updateField = <K extends keyof FormState>(field: K, value: FormState[K]) => {
73-
setFormState((prev) => ({ ...prev, [field]: value }))
75+
setFormState((prev) => ({
76+
...prev,
77+
[field]: value,
78+
}))
7479
}
7580

7681
useEffect(() => {
@@ -88,7 +93,9 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
8893
} else {
8994
setFormState(defaultState)
9095
}
91-
}, [show])
96+
}, [
97+
show,
98+
])
9299

93100
const convertTokenValidity = (value: string, fromUnit: 'Days' | 'Seconds', toUnit: 'Days' | 'Seconds') => {
94101
const numValue = Number(value)
@@ -120,12 +127,17 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
120127
description: formState.description,
121128
access_token_validity: calculateValidity(formState.accessTokenValidity, formState.accessTokenUnit),
122129
refresh_token_validity: calculateValidity(formState.refreshTokenValidity, formState.refreshTokenUnit),
123-
authorities: [formState.authorities],
124-
scope: [formState.readAccess ? 'READ' : '', formState.writeAccess ? 'WRITE' : ''].filter(Boolean),
130+
authorities: [
131+
formState.authorities,
132+
],
133+
scope: [
134+
formState.readAccess ? 'READ' : '',
135+
formState.writeAccess ? 'WRITE' : '',
136+
].filter(Boolean),
125137
}
126138

127139
const sendOAuthClientRequest = async (data: object, token: string): Promise<Response> => {
128-
return fetch(`${SW360_API_URL}/authorization/client-management`, {
140+
return await fetch(`${SW360_API_URL}/authorization/client-management`, {
129141
method: 'POST',
130142
headers: {
131143
Accept: 'application/*',
@@ -196,11 +208,17 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
196208
<Modal.Body>
197209
<Form>
198210
<Form.Group className='mb-3'>
199-
<Form.Label style={{ fontWeight: 'bold' }}>
211+
<Form.Label
212+
style={{
213+
fontWeight: 'bold',
214+
}}
215+
>
200216
{t('Description')}
201217
<span
202218
className='text-red'
203-
style={{ color: 'red' }}
219+
style={{
220+
color: 'red',
221+
}}
204222
>
205223
*
206224
</span>
@@ -217,11 +235,17 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
217235
<Row>
218236
<Col md={6}>
219237
<Form.Group className='mb-3'>
220-
<Form.Label style={{ fontWeight: 'bold' }}>
238+
<Form.Label
239+
style={{
240+
fontWeight: 'bold',
241+
}}
242+
>
221243
{t('Authorities')}
222244
<span
223245
className='text-red'
224-
style={{ color: 'red' }}
246+
style={{
247+
color: 'red',
248+
}}
225249
>
226250
*
227251
</span>
@@ -237,11 +261,17 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
237261
</Col>
238262
<Col md={6}>
239263
<Form.Group className='mb-3'>
240-
<Form.Label style={{ fontWeight: 'bold' }}>
264+
<Form.Label
265+
style={{
266+
fontWeight: 'bold',
267+
}}
268+
>
241269
{t('Scope')}
242270
<span
243271
className='text-red'
244-
style={{ color: 'red' }}
272+
style={{
273+
color: 'red',
274+
}}
245275
>
246276
*
247277
</span>
@@ -269,11 +299,17 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
269299
<Row>
270300
<Col md={6}>
271301
<Form.Group className='mb-3'>
272-
<Form.Label style={{ fontWeight: 'bold' }}>
302+
<Form.Label
303+
style={{
304+
fontWeight: 'bold',
305+
}}
306+
>
273307
{t('Access Token Validity')}
274308
<span
275309
className='text-red'
276-
style={{ color: 'red' }}
310+
style={{
311+
color: 'red',
312+
}}
277313
>
278314
*
279315
</span>
@@ -306,11 +342,17 @@ const AddClientDialog = ({ show, setShow, client }: Props): ReactNode => {
306342
</Col>
307343
<Col md={6}>
308344
<Form.Group className='mb-3'>
309-
<Form.Label style={{ fontWeight: 'bold' }}>
345+
<Form.Label
346+
style={{
347+
fontWeight: 'bold',
348+
}}
349+
>
310350
{t('Refresh Token Validity')}
311351
<span
312352
className='text-red'
313-
style={{ color: 'red' }}
353+
style={{
354+
color: 'red',
355+
}}
314356
>
315357
*
316358
</span>

src/app/[locale]/admin/oauthclient/components/DeleteClientDialog.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
// License-Filename: LICENSE
1111

1212
'use client'
13-
import { HttpStatus } from '@/object-types'
14-
import MessageService from '@/services/message.service'
15-
import { CommonUtils } from '@/utils'
16-
import { SW360_API_URL } from '@/utils/env'
1713
import { getSession, signOut, useSession } from 'next-auth/react'
1814
import { useTranslations } from 'next-intl'
15+
import { type JSX, useEffect } from 'react'
1916
import { Button, Form, Modal } from 'react-bootstrap'
2017
import { AiOutlineQuestionCircle } from 'react-icons/ai'
21-
22-
import { useEffect, type JSX } from 'react'
18+
import { HttpStatus } from '@/object-types'
19+
import MessageService from '@/services/message.service'
20+
import { CommonUtils } from '@/utils'
21+
import { SW360_API_URL } from '@/utils/env'
2322

2423
interface Props {
2524
clientId: string
@@ -35,10 +34,12 @@ function DeleteClientDialog({ clientId, show, setShow }: Props): JSX.Element {
3534
if (status === 'unauthenticated') {
3635
signOut()
3736
}
38-
}, [status])
37+
}, [
38+
status,
39+
])
3940

4041
const sendOAuthClientRequest = async (clientId: string, token: string): Promise<Response> => {
41-
return fetch(`${SW360_API_URL}/authorization/client-management/${clientId}`, {
42+
return await fetch(`${SW360_API_URL}/authorization/client-management/${clientId}`, {
4243
method: 'DELETE',
4344
headers: {
4445
Accept: 'application/*',
@@ -86,10 +87,16 @@ function DeleteClientDialog({ clientId, show, setShow }: Props): JSX.Element {
8687
>
8788
<Modal.Header
8889
closeButton
89-
style={{ color: 'red' }}
90+
style={{
91+
color: 'red',
92+
}}
9093
>
9194
<Modal.Title>
92-
<AiOutlineQuestionCircle style={{ marginBottom: '5px' }} />
95+
<AiOutlineQuestionCircle
96+
style={{
97+
marginBottom: '5px',
98+
}}
99+
/>
93100
{t('Delete Client')} ?
94101
</Modal.Title>
95102
</Modal.Header>

src/app/[locale]/admin/oauthclient/components/OAuthClientsList.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
'use client'
1313

14-
import { HttpStatus, OAuthClient } from '@/object-types'
15-
import MessageService from '@/services/message.service'
16-
import CommonUtils from '@/utils/common.utils'
17-
import { SW360_API_URL } from '@/utils/env'
1814
import { getSession, signOut, useSession } from 'next-auth/react'
1915
import { useTranslations } from 'next-intl'
2016
import { PageButtonHeader } from 'next-sw360'
2117
import React, { ReactNode, useEffect, useState } from 'react'
18+
import { HttpStatus, OAuthClient } from '@/object-types'
19+
import MessageService from '@/services/message.service'
20+
import CommonUtils from '@/utils/common.utils'
21+
import { SW360_API_URL } from '@/utils/env'
2222
import AddClientDialog from './AddClientDialog'
2323
import DeleteClientDialog from './DeleteClientDialog'
2424
import OAuthClientTable from './OAuthClientTable'
@@ -38,7 +38,9 @@ function OAuthClientsList(): ReactNode {
3838
if (status === 'unauthenticated') {
3939
signOut()
4040
}
41-
}, [status])
41+
}, [
42+
status,
43+
])
4244

4345
const addClient = () => {
4446
setSelectedClient(null)
@@ -71,7 +73,7 @@ function OAuthClientsList(): ReactNode {
7173
}
7274

7375
const sendOAuthClientRequest = async (token: string): Promise<Response> => {
74-
return fetch(`${SW360_API_URL}/authorization/client-management`, {
76+
return await fetch(`${SW360_API_URL}/authorization/client-management`, {
7577
method: 'GET',
7678
headers: {
7779
Accept: 'application/*',
@@ -113,7 +115,9 @@ function OAuthClientsList(): ReactNode {
113115

114116
useEffect(() => {
115117
fetchClientsData()
116-
}, [refreshTrigger])
118+
}, [
119+
refreshTrigger,
120+
])
117121

118122
return (
119123
<div className='container page-content'>

0 commit comments

Comments
 (0)