Skip to content

Commit

Permalink
fix: changes Array<T> to T[] + Eslint rule for it (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Charles Héon <[email protected]>
  • Loading branch information
ChuckLeon and Charles Héon authored Aug 15, 2024
1 parent 0a5bbc5 commit 625c5c2
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = {
"react-hooks/exhaustive-deps": WARNING,
"react-hooks/rules-of-hooks": ERROR,
eqeqeq: ERROR,
"@typescript-eslint/array-type": [WARNING, { default: "array-simple" }],
// "sort-keys": WARNING,
},
settings: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useTranslation } from "react-i18next";
import { ValidationError } from "yup";

interface IFormHelper {
fieldNames: Array<string> | string;
formErrors?: Array<ValidationError>;
fieldNames: string[] | string;
formErrors?: ValidationError[];
helperText?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "@mui/material";

interface ITable extends TableProps {
columnTitles: Array<string>;
columnTitles: string[];
}

export default function Table({ children, columnTitles, ...props }: ITable) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/tableRow/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import style from "@styles/style.module.scss";

interface ITableRow extends TableRowProps {
columns: Array<string>;
columns: string[];
}

const StyledMuiTableRow = styled(MuiTableRow)({
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/containers/cookieConsent/CookieConsent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default function CookieConsent() {
const [cookieModalOpen, setCookieModalOpen] = useState<boolean>(false);
const [cookieBannerOpen, setCookieBannerOpen] = useState<boolean>(false);
const [cookiePreferences, setCookiePreferences] =
useState<Array<string>>(ALL_COOKIE_TYPES);
useState<string[]>(ALL_COOKIE_TYPES);

const handleAccept = useCallback((preferences: Array<string>) => {
const handleAccept = useCallback((preferences: string[]) => {
setCookieBannerOpen(false);
setCookieModalOpen(false);
const cookieConsentPreferences: ICookiePreferences = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ICookieSection from "@containers/cookieConsent/interfaces/ICookieSection";

const cookieConsentConfig: Array<ICookieSection> = [
const cookieConsentConfig: ICookieSection[] = [
{
id: "necessary",
title: "cookie_modal__necessary_title",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ interface ICookieModal {
handleAcceptAll: () => void;
handleAcceptSelection: () => void;
closeModal: () => void;
cookieTypes: Array<ICookieSection>;
cookiePreferences: Array<string>;
setCookiePreferences: Dispatch<SetStateAction<Array<string>>>;
cookieTypes: ICookieSection[];
cookiePreferences: string[];
setCookiePreferences: Dispatch<SetStateAction<string[]>>;
}

export default function CookieModal({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default interface ICookiePreferences {
consentDate: number;
preferences: Array<string>;
preferences: string[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ICookieInfo from "@containers/cookieConsent/interfaces/ICookieInfo";
export default interface ICookieSection {
id: string;
title: string;
description: Array<string>;
description: string[];
required?: boolean;
cookies?: Array<ICookieInfo>;
cookies?: ICookieInfo[];
}
2 changes: 1 addition & 1 deletion frontend/src/app/forms/auth/loginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function LoginForm({ setIsLoading }: ILoginForm) {
password: "",
});
const [loginFormValidated, setLoginFormValidated] = useState<boolean>(false);
const [formErrors, setFormErrors] = useState<Array<ValidationError>>([]);
const [formErrors, setFormErrors] = useState<ValidationError[]>([]);

const onSubmit = useCallback(
(event: FormEvent<HTMLFormElement>) => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/routes/findRoute.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import routes from "@routes/routes";

const findRoute = (path: string, locale: string): string => {
let segmentValues: Array<string> = [];
let segmentNames: Array<string> = [];
let segmentValues: string[] = [];
let segmentNames: string[] = [];

const route = routes.find((route) => {
return Object.values(route.paths).some((pattern) => {
Expand Down

0 comments on commit 625c5c2

Please sign in to comment.