Skip to content

Commit acffff5

Browse files
committed
chore: linting BuildContext
1 parent 8fa28e5 commit acffff5

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/components/ciConfig/BuildContext.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import React, { useEffect, useState } from 'react'
1+
// Disabling for ReactSelect
2+
/* eslint-disable jsx-a11y/label-has-associated-control */
3+
import React, { FunctionComponent, useEffect, useState } from 'react'
24
import ReactSelect from 'react-select'
35
import { CustomInput, OptionType, TippyCustomized, TippyTheme } from '@devtron-labs/devtron-fe-common-lib'
46
import { checkoutPathOption, renderOptionIcon, repositoryControls, repositoryOption } from './CIBuildpackBuildOptions'
@@ -9,7 +11,7 @@ import { ReactComponent as QuestionFilled } from '../../assets/icons/ic-help.svg
911
import { ReactComponent as Question } from '../../assets/icons/ic-help-outline.svg'
1012
import { RootBuildContext } from './ciConfigConstant'
1113

12-
function getBuildContextAdditionalContent() {
14+
const getBuildContextAdditionalContent = () => {
1315
return (
1416
<div className="p-12 fs-13">
1517
To build all files from the root, use (.) as the build context, or set build context by referring a
@@ -22,7 +24,7 @@ function getBuildContextAdditionalContent() {
2224
)
2325
}
2426

25-
function InfoCard() {
27+
const InfoCard: FunctionComponent = () => {
2628
return (
2729
<div className="flex row ml-0">
2830
<TippyCustomized
@@ -46,7 +48,7 @@ function InfoCard() {
4648
)
4749
}
4850

49-
export default function BuildContext({
51+
const BuildContext: FunctionComponent<BuildContextProps> = ({
5052
readOnly,
5153
isDefaultBuildContext,
5254
configOverrideView,
@@ -63,7 +65,7 @@ export default function BuildContext({
6365
setCurrentCIBuildConfig,
6466
currentBuildContextGitMaterial,
6567
readOnlyBuildContextPath,
66-
}: BuildContextProps) {
68+
}) => {
6769
const [isCollapsed, setIsCollapsed] = useState<boolean>(!isDefaultBuildContext)
6870

6971
const useRootBuildContextFlag = currentCIBuildConfig?.useRootBuildContext
@@ -75,14 +77,14 @@ export default function BuildContext({
7577
const [checkoutPathOptions, setCheckoutPathOptions] = useState<OptionType[]>(checkoutPathArray)
7678

7779
useEffect(() => {
78-
const checkoutPathArray = [{ label: RootBuildContext, value: RootBuildContext }]
80+
const _checkoutPathArray = [{ label: RootBuildContext, value: RootBuildContext }]
7981
if (selectedBuildContextGitMaterial?.checkoutPath !== RootBuildContext) {
80-
checkoutPathArray.push({
82+
_checkoutPathArray.push({
8183
label: selectedBuildContextGitMaterial?.checkoutPath,
8284
value: selectedBuildContextGitMaterial?.checkoutPath,
8385
})
8486
}
85-
setCheckoutPathOptions(checkoutPathArray)
87+
setCheckoutPathOptions(_checkoutPathArray)
8688
}, [selectedBuildContextGitMaterial])
8789

8890
const toggleCollapse = () => {
@@ -91,13 +93,14 @@ export default function BuildContext({
9193

9294
const getSelectedBuildContextGitMaterial = () => selectedBuildContextGitMaterial ?? currentMaterial
9395

94-
const handleBuildContextPathChange = (selectedBuildContextGitMaterial): void => {
95-
setSelectedBuildContextGitMaterial(selectedBuildContextGitMaterial)
96+
const handleBuildContextPathChange = (_selectedBuildContextGitMaterial): void => {
97+
setSelectedBuildContextGitMaterial(_selectedBuildContextGitMaterial)
9698
// Don't know how and why we are directly setting state.
97-
formState.repository.value = selectedBuildContextGitMaterial.name
99+
// eslint-disable-next-line no-param-reassign
100+
formState.repository.value = _selectedBuildContextGitMaterial.name
98101
setCurrentCIBuildConfig({
99102
...currentCIBuildConfig,
100-
buildContextGitMaterialId: selectedBuildContextGitMaterial.id,
103+
buildContextGitMaterialId: _selectedBuildContextGitMaterial.id,
101104
})
102105
}
103106

@@ -109,9 +112,9 @@ export default function BuildContext({
109112
})
110113
}
111114

112-
const getCheckoutPathValue = (useRootBuildContextFlag: boolean): OptionType => {
115+
const getCheckoutPathValue = (_useRootBuildContextFlag: boolean): OptionType => {
113116
const path = getSelectedBuildContextGitMaterial()?.checkoutPath
114-
const val = useRootBuildContextFlag ? RootBuildContext : path
117+
const val = _useRootBuildContextFlag ? RootBuildContext : path
115118

116119
return { label: val, value: val }
117120
}
@@ -125,7 +128,7 @@ export default function BuildContext({
125128
return (
126129
<div className="form-row__docker">
127130
<div className={`form__field ${configOverrideView ? 'mb-0-imp' : ''}`}>
128-
<label className="form__label">Repository containing build context</label>
131+
<span className="form__label">Repository containing build context</span>
129132

130133
<div className="flex left">
131134
{currentBuildContextGitMaterial?.url && renderOptionIcon(currentBuildContextGitMaterial.url)}
@@ -134,13 +137,11 @@ export default function BuildContext({
134137
</span>
135138
</div>
136139

137-
{repositoryError && <label className="form__error">{repositoryError}</label>}
140+
{repositoryError && <span className="form__error">{repositoryError}</span>}
138141
</div>
139142

140143
<div className={`form__field ${configOverrideView ? 'mb-0-imp' : ''}`}>
141-
<label htmlFor="" className="form__label">
142-
Build Context (Relative)
143-
</label>
144+
<span className="form__label">Build Context (Relative)</span>
144145

145146
<span className="fs-14 fw-4 lh-20 cn-9">{readOnlyBuildContextPath}</span>
146147
</div>
@@ -159,7 +160,7 @@ export default function BuildContext({
159160
<Dropdown
160161
className="icon-dim-26 rotate"
161162
data-testid="set-build-context-button"
162-
style={{ ['--rotateBy' as any]: isCollapsed ? '360deg' : '270deg' }}
163+
style={{ ['--rotateBy' as string]: isCollapsed ? '360deg' : '270deg' }}
163164
/>
164165
Set Build context
165166
</button>
@@ -175,7 +176,6 @@ export default function BuildContext({
175176
<ReactSelect
176177
className="m-0"
177178
classNamePrefix="build-config__select-repository-containing-build-context"
178-
tabIndex={3}
179179
isMulti={false}
180180
isClearable={false}
181181
options={sourceConfig.material}
@@ -210,7 +210,6 @@ export default function BuildContext({
210210
<ReactSelect
211211
className="m-0 br-0"
212212
classNamePrefix="build-config__select-checkout-path-for-build-context"
213-
tabIndex={4}
214213
isMulti={false}
215214
isClearable={false}
216215
isSearchable={false}
@@ -227,7 +226,6 @@ export default function BuildContext({
227226
/>
228227

229228
<CustomInput
230-
tabIndex={4}
231229
type="text"
232230
rootClassName="file-name"
233231
data-testid="build-context-path-text-box"
@@ -244,3 +242,5 @@ export default function BuildContext({
244242
</>
245243
)
246244
}
245+
246+
export default BuildContext

0 commit comments

Comments
 (0)