Skip to content

Commit 3503e12

Browse files
committed
chore: formatted all the project with the current coding rules
1 parent afb77d2 commit 3503e12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1958
-1842
lines changed

src/app/components/CloseButton.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import img_close from "../../assets/img/close.svg";
22

33
interface Props {
4-
onClick: () => void
4+
onClick: () => void;
55
}
66

7-
const CloseButton = ({onClick}: Props) =>
8-
<div
9-
className="close__button"
10-
onClick={onClick}
11-
>
12-
<img src={img_close} />
13-
</div>
7+
const CloseButton = ({ onClick }: Props) => (
8+
<div className="close__button" onClick={onClick}>
9+
<img src={img_close} />
10+
</div>
11+
);
1412

1513
export default CloseButton;

src/app/components/Editor.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const checkWarnings = async (values: PublicCode) => {
9595
};
9696

9797
const resolver: Resolver<PublicCode | PublicCodeWithDeprecatedFields> = async (
98-
values
98+
values,
9999
) => {
100100
console.log(values);
101101

@@ -164,7 +164,7 @@ export default function Editor() {
164164
useITCountrySpecific();
165165
const getNestedValue = (
166166
obj: PublicCodeWithDeprecatedFields,
167-
path: string
167+
path: string,
168168
) => {
169169
return path.split(".").reduce((acc, key) => (acc as never)?.[key], obj);
170170
};
@@ -223,15 +223,15 @@ export default function Editor() {
223223
const { countryExtensionVersion } = it;
224224
const isCountryExtensionVersionDefined = Boolean(countryExtensionVersion);
225225
const isDifferentFromSpecificDefinedValue = Boolean(
226-
IT_COUNTRY_EXTENSION_VERSION !== countryExtensionVersion
226+
IT_COUNTRY_EXTENSION_VERSION !== countryExtensionVersion,
227227
);
228228

229229
const countryExtensionVersionVisible =
230230
isCountryExtensionVersionDefined && isDifferentFromSpecificDefinedValue;
231231

232232
setShowCountryExtensionVersion(countryExtensionVersionVisible);
233233
},
234-
[]
234+
[],
235235
);
236236

237237
useFormPersist("form-values", {
@@ -243,7 +243,7 @@ export default function Editor() {
243243
checkPubliccodeYmlVersion(pc);
244244
checkItCountryExtensionVersion(pc);
245245
},
246-
[setLanguages]
246+
[setLanguages],
247247
),
248248
storage: window?.localStorage, // default window.sessionStorage
249249
exclude: [],
@@ -266,7 +266,7 @@ export default function Editor() {
266266
setValue("maintenance.contacts", undefined);
267267
}
268268
},
269-
[setValue]
269+
[setValue],
270270
);
271271

272272
useEffect(() => {
@@ -290,13 +290,13 @@ export default function Editor() {
290290
{
291291
dismissable: true,
292292
state: "success",
293-
}
293+
},
294294
);
295295
}
296296
},
297297
(e: FieldErrors<PublicCode>) => {
298298
const genericErrors = Object.entries(e).filter(([key]) =>
299-
key.startsWith("GenericError")
299+
key.startsWith("GenericError"),
300300
);
301301

302302
const body = genericErrors.length ? (
@@ -318,7 +318,7 @@ export default function Editor() {
318318
state: "error",
319319
});
320320
console.error("Errors:", e);
321-
}
321+
},
322322
);
323323

324324
const resetFormHandler = () => {
@@ -332,7 +332,7 @@ export default function Editor() {
332332
};
333333

334334
const setFormDataAfterImport = async (
335-
fetchData: () => Promise<PublicCode | null>
335+
fetchData: () => Promise<PublicCode | null>,
336336
) => {
337337
try {
338338
const publicCode = await fetchData().then((publicCode) => {
@@ -361,7 +361,10 @@ export default function Editor() {
361361

362362
const res = await checkWarnings(publicCode);
363363
setWarnings(
364-
Array.from(res.warnings).map(([key, { message }]) => ({ key, message }))
364+
Array.from(res.warnings).map(([key, { message }]) => ({
365+
key,
366+
message,
367+
})),
365368
);
366369
} catch (error: unknown) {
367370
notify("Import error", (error as Error).message, {
@@ -484,7 +487,7 @@ export default function Editor() {
484487
</div>
485488
<div>
486489
{isDeprecatedFieldVisible(
487-
`description.${lang}.genericName` as never
490+
`description.${lang}.genericName` as never,
488491
) && (
489492
<span>
490493
<EditorDescriptionInput<"genericName">

src/app/components/EditorAwards.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function EditorAwards({ lang }: Props): JSX.Element {
5555

5656
useEffect(() => {
5757
const errorsRecord = flattenObject(
58-
errors as Record<string, { type: string; message: string }>
58+
errors as Record<string, { type: string; message: string }>,
5959
);
6060
const formFieldKeys = Object.keys(errorsRecord);
6161
const isFirstError =
@@ -91,10 +91,10 @@ export default function EditorAwards({ lang }: Props): JSX.Element {
9191
{awards.map((feat) => (
9292
<Chip simple key={feat} className="d-flex align-items-center">
9393
<ChipLabel>{feat}</ChipLabel>
94-
<Button
95-
color="link"
96-
icon
97-
onClick={() => remove(feat)}
94+
<Button
95+
color="link"
96+
icon
97+
onClick={() => remove(feat)}
9898
size="xs"
9999
className="ms-1 p-0"
100100
aria-label={`Remove ${feat}`}

src/app/components/EditorBoolean.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Props<T> = {
1616
};
1717

1818
export default function EditorBoolean<
19-
T extends FieldPathByValue<RequiredDeep<PublicCode>, boolean>
19+
T extends FieldPathByValue<RequiredDeep<PublicCode>, boolean>,
2020
>({ fieldName, required }: Props<T>): JSX.Element {
2121
const { control } = useFormContext<PublicCode>();
2222
const {

src/app/components/EditorContacts.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ export default function EditorContacts(): JSX.Element {
8383
const { ref, ...reg } = register(
8484
`${fieldName}.${index}.${subfield}`,
8585
{
86-
setValueAs: value => setValueAsUndefinedFields.has(subfield) && value === "" ? undefined : value
87-
}
86+
setValueAs: (value) =>
87+
setValueAsUndefinedFields.has(subfield) &&
88+
value === ""
89+
? undefined
90+
: value,
91+
},
8892
);
8993

9094
return (
@@ -98,7 +102,7 @@ export default function EditorContacts(): JSX.Element {
98102
}
99103
validationText={get(
100104
errors,
101-
`${fieldName}.${index}.${subfield}.message`
105+
`${fieldName}.${index}.${subfield}.message`,
102106
)}
103107
/>
104108
</td>

src/app/components/EditorContractors.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ export default function EditorContractors(): JSX.Element {
6363
const { ref, ...reg } = register(
6464
`${fieldName}.${index}.${subfield}`,
6565
{
66-
setValueAs: (value: string | Date) => setValueAsUndefinedFields.has(subfield) && value === "" ? undefined : value
67-
}
66+
setValueAs: (value: string | Date) =>
67+
setValueAsUndefinedFields.has(subfield) &&
68+
value === ""
69+
? undefined
70+
: value,
71+
},
6872
);
6973

7074
return (
@@ -79,7 +83,7 @@ export default function EditorContractors(): JSX.Element {
7983
}
8084
validationText={get(
8185
errors,
82-
`${fieldName}.${index}.${subfield}.message`
86+
`${fieldName}.${index}.${subfield}.message`,
8387
)}
8488
/>
8589
</td>

src/app/components/EditorDate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Props<T> = {
1616
};
1717

1818
export default function EditorDate<
19-
T extends FieldPathByValue<RequiredDeep<PublicCode>, string>
19+
T extends FieldPathByValue<RequiredDeep<PublicCode>, string>,
2020
>({ fieldName, required }: Props<T>) {
2121
const { control } = useFormContext<PublicCode>();
2222
const {

src/app/components/EditorDescriptionInput.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Props<T> = {
2727
};
2828

2929
export default function EditorInput<
30-
T extends FieldPathByValue<RequiredDeep<Description>, string>
30+
T extends FieldPathByValue<RequiredDeep<Description>, string>,
3131
>({ fieldName, lang, required, textarea, deprecated }: Props<T>) {
3232
const { control } = useFormContext<PublicCode>();
3333
const {
@@ -50,7 +50,7 @@ export default function EditorInput<
5050

5151
useEffect(() => {
5252
const tooltipTriggerList = document.querySelectorAll(
53-
'[data-bs-toggle="tooltip"]'
53+
'[data-bs-toggle="tooltip"]',
5454
);
5555
tooltipTriggerList.forEach((tooltipTriggerEl) => {
5656
new Tooltip(tooltipTriggerEl);
@@ -62,8 +62,9 @@ export default function EditorInput<
6262
<div>
6363
<div className="position-relative mb-2">
6464
<label className="description-label active">
65-
{`${label}${extraLangInfo}${required ? " *" : ""}${deprecated ? ` - ${t(`editor.form.deprecatedField`)}` : ""
66-
}`}
65+
{`${label}${extraLangInfo}${required ? " *" : ""}${
66+
deprecated ? ` - ${t(`editor.form.deprecatedField`)}` : ""
67+
}`}
6768
</label>
6869
<Button
6970
type="button"
@@ -90,7 +91,7 @@ export default function EditorInput<
9091
valid={get(errors, `description.${lang}.${fieldName}`) && false}
9192
validationText={get(
9293
errors,
93-
`description.${lang}.${fieldName}.message`
94+
`description.${lang}.${fieldName}.message`,
9495
)}
9596
rows={textarea ? 3 : undefined}
9697
/>

src/app/components/EditorFeatures.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function EditorFeatures({ lang }: Props): JSX.Element {
5454
const buttonRef = useRef<HTMLButtonElement>(null);
5555
useEffect(() => {
5656
const errorsRecord = flattenObject(
57-
errors as Record<string, { type: string; message: string }>
57+
errors as Record<string, { type: string; message: string }>,
5858
);
5959
const formFieldKeys = Object.keys(errorsRecord);
6060
const isFirstError =
@@ -90,10 +90,10 @@ export default function EditorFeatures({ lang }: Props): JSX.Element {
9090
{features.map((feat) => (
9191
<Chip simple key={feat} className="d-flex align-items-center">
9292
<ChipLabel>{feat}</ChipLabel>
93-
<Button
94-
color="link"
95-
icon
96-
onClick={() => remove(feat)}
93+
<Button
94+
color="link"
95+
icon
96+
onClick={() => remove(feat)}
9797
size="xs"
9898
className="ms-1 p-0"
9999
aria-label={`Remove ${feat}`}
@@ -110,9 +110,9 @@ export default function EditorFeatures({ lang }: Props): JSX.Element {
110110
onChange={({ target }) => setCurrent(target.value)}
111111
innerRef={inputRef}
112112
onKeyDown={(e) => {
113-
if (e.key === 'Enter') {
113+
if (e.key === "Enter") {
114114
e.preventDefault();
115-
if (current.trim() !== '') {
115+
if (current.trim() !== "") {
116116
add();
117117
}
118118
}

src/app/components/EditorInput.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Props<T> = {
2828
type PublicCodeData = PublicCode | PublicCodeWithDeprecatedFields;
2929

3030
export default function EditorInput<
31-
T extends FieldPathByValue<RequiredDeep<PublicCodeData>, string>
31+
T extends FieldPathByValue<RequiredDeep<PublicCodeData>, string>,
3232
>({ fieldName, required, textarea, deprecated }: Props<T>) {
3333
const { control } = useFormContext<PublicCodeData>();
3434
const {
@@ -50,8 +50,9 @@ export default function EditorInput<
5050
<div>
5151
<div className="position-relative">
5252
<label className="description-label active">
53-
{`${label}${required ? " *" : ""}${deprecated ? ` - ${t(`editor.form.deprecatedField`)}` : ""
54-
}`}
53+
{`${label}${required ? " *" : ""}${
54+
deprecated ? ` - ${t(`editor.form.deprecatedField`)}` : ""
55+
}`}
5556
</label>
5657
<Button
5758
type="button"

0 commit comments

Comments
 (0)