Update ESLint dependencies to latest version (#31831)

Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Jon Koops 2024-08-06 14:02:18 +02:00 committed by GitHub
parent 6847af0068
commit 38f185dff1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 899 additions and 536 deletions

View file

@ -1,9 +1,11 @@
// @ts-check // @ts-check
import { fixupPluginRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc"; import { FlatCompat } from "@eslint/eslintrc";
import eslint from "@eslint/js"; import eslint from "@eslint/js";
import mochaPlugin from "eslint-plugin-mocha"; import mochaPlugin from "eslint-plugin-mocha";
import playwright from "eslint-plugin-playwright"; import playwright from "eslint-plugin-playwright";
import prettierRecommended from "eslint-plugin-prettier/recommended"; import prettierRecommended from "eslint-plugin-prettier/recommended";
import reactHooks from "eslint-plugin-react-hooks";
import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js"; import reactJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
import reactRecommended from "eslint-plugin-react/configs/recommended.js"; import reactRecommended from "eslint-plugin-react/configs/recommended.js";
import tseslint from "typescript-eslint"; import tseslint from "typescript-eslint";
@ -28,10 +30,12 @@ export default tseslint.config(
...tseslint.configs.stylisticTypeChecked, ...tseslint.configs.stylisticTypeChecked,
reactRecommended, reactRecommended,
reactJsxRuntime, reactJsxRuntime,
...compat.extends("plugin:react-hooks/recommended"),
prettierRecommended, prettierRecommended,
...compat.plugins("lodash"), ...compat.plugins("lodash"),
{ {
plugins: {
"react-hooks": fixupPluginRules(reactHooks),
},
languageOptions: { languageOptions: {
parserOptions: { parserOptions: {
project: "./tsconfig.eslint.json", project: "./tsconfig.eslint.json",
@ -44,6 +48,7 @@ export default tseslint.config(
}, },
}, },
rules: { rules: {
...reactHooks.configs.recommended.rules,
// ## Rules overwriting config, disabled for now, but will have to be evaluated. ## // ## Rules overwriting config, disabled for now, but will have to be evaluated. ##
"no-undef": "off", "no-undef": "off",
"no-unused-private-class-members": "off", "no-unused-private-class-members": "off",
@ -72,6 +77,7 @@ export default tseslint.config(
"@typescript-eslint/no-unnecessary-condition": "off", "@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/no-unnecessary-type-arguments": "off", "@typescript-eslint/no-unnecessary-type-arguments": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off", "@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unnecessary-type-parameters": "off",
"@typescript-eslint/no-unsafe-argument": "off", "@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off", "@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off", "@typescript-eslint/no-unsafe-call": "off",
@ -154,4 +160,16 @@ export default tseslint.config(
...playwright.configs["flat/recommended"], ...playwright.configs["flat/recommended"],
files: ["js/apps/account-ui/test/**"], files: ["js/apps/account-ui/test/**"],
}, },
{
files: ["js/libs/keycloak-admin-client/test/**"],
rules: {
"@typescript-eslint/no-unused-expressions": "off",
},
},
{
files: ["js/libs/keycloak-admin-client/src/**"],
rules: {
"@typescript-eslint/no-empty-object-type": "off",
},
},
); );

View file

@ -27,13 +27,7 @@ export const fetchResources = async (
{ searchParams: shared ? requestParams : undefined, signal }, { searchParams: shared ? requestParams : undefined, signal },
); );
let links: Links; const links = parseLinks(response);
try {
links = parseLinks(response);
} catch (error) {
links = {};
}
return { return {
data: checkResponse(await response.json()), data: checkResponse(await response.json()),

View file

@ -7,15 +7,15 @@ export function parseLinks(response: Response): Links {
const linkHeader = response.headers.get("link"); const linkHeader = response.headers.get("link");
if (!linkHeader) { if (!linkHeader) {
throw new Error("Attempted to parse links, but no header was found."); return {};
} }
const links = linkHeader.split(/,\s*</); const links = linkHeader.split(/,\s*</);
return links.reduce<Links>((acc: Links, link: string) => { return links.reduce<Links>((acc: Links, link: string) => {
const matcher = link.match(/<?([^>]*)>(.*)/); const matcher = /<?([^>]*)>(.*)/.exec(link);
if (!matcher) return {}; if (!matcher) return {};
const linkUrl = matcher[1]; const linkUrl = matcher[1];
const rel = matcher[2].match(/\s*(.+)\s*=\s*"?([^"]+)"?/); const rel = /\s*(.+)\s*=\s*"?([^"]+)"?/.exec(matcher[2]);
if (rel) { if (rel) {
const link: Record<string, string> = {}; const link: Record<string, string> = {};
for (const [key, value] of new URL(linkUrl).searchParams.entries()) { for (const [key, value] of new URL(linkUrl).searchParams.entries()) {

View file

@ -66,7 +66,7 @@ export const token = (keycloak: Keycloak) =>
async function getAccessToken() { async function getAccessToken() {
try { try {
await keycloak.updateToken(5); await keycloak.updateToken(5);
} catch (error) { } catch {
await keycloak.login(); await keycloak.login();
} }

View file

@ -475,7 +475,7 @@ describe.skip("Events tests", () => {
}); });
it("Check a11y violations on admin events tab", () => { it("Check a11y violations on admin events tab", () => {
eventsPage.goToAdminEventsTab; eventsPage.goToAdminEventsTab();
cy.checkA11y(); cy.checkA11y();
}); });

View file

@ -42,14 +42,23 @@ export default class AdminEventsSettingsTab extends PageObject {
waitForConfig: false, waitForConfig: false,
}, },
) { ) {
waitForRealm && cy.intercept("/admin/realms/*").as("saveRealm"); if (waitForRealm) {
waitForConfig && cy.intercept("/admin/realms/*").as("saveRealm");
}
if (waitForConfig) {
cy.intercept("/admin/realms/*/events/config").as("saveConfig"); cy.intercept("/admin/realms/*/events/config").as("saveConfig");
}
cy.get(this.#saveBtn).click(); cy.get(this.#saveBtn).click();
waitForRealm && cy.wait("@saveRealm"); if (waitForRealm) {
waitForConfig && cy.wait("@saveConfig"); cy.wait("@saveRealm");
}
if (waitForConfig) {
cy.wait("@saveConfig");
}
return this; return this;
} }

View file

@ -30,7 +30,7 @@ export async function initAdminClient(
async getAccessToken() { async getAccessToken() {
try { try {
await keycloak.updateToken(5); await keycloak.updateToken(5);
} catch (error) { } catch {
keycloak.login(); keycloak.login();
} }

View file

@ -56,9 +56,9 @@ export const AddMapperDialog = (props: AddMapperDialogProps) => {
const allRows = useMemo( const allRows = useMemo(
() => () =>
localeSort(builtInMappers, mapByKey("name")).map((mapper) => { localeSort(builtInMappers, mapByKey("name")).map((mapper) => {
const mapperType = protocolMappers.filter( const mapperType = protocolMappers.find(
(type) => type.id === mapper.protocolMapper, (type) => type.id === mapper.protocolMapper,
)[0]; )!;
return { return {
item: mapper, item: mapper,
id: mapper.name!, id: mapper.name!,

View file

@ -49,7 +49,7 @@ export default function MappingDetails() {
const { realm } = useRealm(); const { realm } = useRealm();
const serverInfo = useServerInfo(); const serverInfo = useServerInfo();
const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/; const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/;
const isUpdating = !!mapperId.match(isGuid); const isUpdating = !!isGuid.exec(mapperId);
const isOnClientScope = !!useMatch(MapperRoute.path); const isOnClientScope = !!useMatch(MapperRoute.path);
const toDetails = () => const toDetails = () =>
@ -154,19 +154,23 @@ export default function MappingDetails() {
try { try {
const mapping = { ...config, ...convertFormValuesToObject(formMapping) }; const mapping = { ...config, ...convertFormValuesToObject(formMapping) };
if (isUpdating) { if (isUpdating) {
isOnClientScope if (isOnClientScope) {
? await adminClient.clientScopes.updateProtocolMapper( await adminClient.clientScopes.updateProtocolMapper(
{ id, mapperId },
{ id: mapperId, ...mapping },
)
: await adminClient.clients.updateProtocolMapper(
{ id, mapperId }, { id, mapperId },
{ id: mapperId, ...mapping }, { id: mapperId, ...mapping },
); );
} else { } else {
isOnClientScope await adminClient.clients.updateProtocolMapper(
? await adminClient.clientScopes.addProtocolMapper({ id }, mapping) { id, mapperId },
: await adminClient.clients.addProtocolMapper({ id }, mapping); { id: mapperId, ...mapping },
);
}
} else {
if (isOnClientScope) {
await adminClient.clientScopes.addProtocolMapper({ id }, mapping);
} else {
await adminClient.clients.addProtocolMapper({ id }, mapping);
}
} }
addAlert(t(`mapping${key}Success`), AlertVariant.success); addAlert(t(`mapping${key}Success`), AlertVariant.success);
} catch (error) { } catch (error) {

View file

@ -25,7 +25,7 @@ const DateTime = ({ name }: { name: string }) => {
return value; return value;
} }
const parts = value.match(DATE_TIME_FORMAT); const parts = DATE_TIME_FORMAT.exec(value);
const parsedDate = [ const parsedDate = [
date.getFullYear(), date.getFullYear(),
padDateSegment(date.getMonth() + 1), padDateSegment(date.getMonth() + 1),
@ -42,7 +42,7 @@ const DateTime = ({ name }: { name: string }) => {
hour?: number | null, hour?: number | null,
minute?: number | null, minute?: number | null,
): string => { ): string => {
const parts = value.match(DATE_TIME_FORMAT); const parts = DATE_TIME_FORMAT.exec(value);
if (minute !== undefined && minute !== null) { if (minute !== undefined && minute !== null) {
return `${parts ? parts[1] : ""} ${hour}:${ return `${parts ? parts[1] : ""} ${hour}:${
minute < 10 ? `0${minute}` : minute minute < 10 ? `0${minute}` : minute

View file

@ -32,7 +32,7 @@ export const InitialAccessTokenList = () => {
const loader = async () => { const loader = async () => {
try { try {
return await adminClient.realms.getClientsInitialAccess({ realm }); return await adminClient.realms.getClientsInitialAccess({ realm });
} catch (error) { } catch {
return []; return [];
} }
}; };

View file

@ -59,7 +59,7 @@ export const CopyToClipboardButton = ({
try { try {
await navigator.clipboard.writeText(text); await navigator.clipboard.writeText(text);
setCopyState(CopyState.Copied); setCopyState(CopyState.Copied);
} catch (error) { } catch {
setCopyState(CopyState.Error); setCopyState(CopyState.Error);
} }
}; };

View file

@ -185,9 +185,9 @@ export const EvaluateScopes = ({ clientId, protocol }: EvaluateScopesProps) => {
({ mapperList, effectiveRoles }) => { ({ mapperList, effectiveRoles }) => {
setEffectiveRoles(effectiveRoles); setEffectiveRoles(effectiveRoles);
mapperList.map((mapper) => { mapperList.map((mapper) => {
mapper.type = mapperTypes.filter( mapper.type = mapperTypes.find(
(type) => type.id === mapper.protocolMapper, (type) => type.id === mapper.protocolMapper,
)[0]; )!;
}); });
setProtocolMappers(mapperList); setProtocolMappers(mapperList);

View file

@ -119,7 +119,7 @@ export const changeScope = async (
const castAdminClient = (adminClient: KeycloakAdminClient) => const castAdminClient = (adminClient: KeycloakAdminClient) =>
adminClient.clientScopes as unknown as { adminClient.clientScopes as unknown as {
[index: string]: Function; [index: string]: (params: { id: string }) => Promise<void>;
}; };
export const removeScope = async ( export const removeScope = async (

View file

@ -23,28 +23,25 @@ export type ComponentProps = Omit<ConfigPropertyRepresentation, "type"> & {
stringify?: boolean; stringify?: boolean;
}; };
const ComponentTypes = [ type ComponentType =
"String", | "String"
"Text", | "Text"
"boolean", | "boolean"
"List", | "List"
"Role", | "Role"
"Script", | "Script"
"Map", | "Map"
"Group", | "Group"
"MultivaluedList", | "MultivaluedList"
"ClientList", | "ClientList"
"UserProfileAttributeList", | "UserProfileAttributeList"
"MultivaluedString", | "MultivaluedString"
"File", | "File"
"Password", | "Password"
"Url", | "Url";
] as const;
export type Components = (typeof ComponentTypes)[number];
export const COMPONENTS: { export const COMPONENTS: {
[index in Components]: FunctionComponent<ComponentProps>; [index in ComponentType]: FunctionComponent<ComponentProps>;
} = { } = {
String: StringComponent, String: StringComponent,
Text: TextComponent, Text: TextComponent,
@ -63,5 +60,5 @@ export const COMPONENTS: {
Url: UrlComponent, Url: UrlComponent,
} as const; } as const;
export const isValidComponentType = (value: string): value is Components => export const isValidComponentType = (value: string): value is ComponentType =>
value in COMPONENTS; value in COMPONENTS;

View file

@ -13,7 +13,7 @@ export const JsonFileUpload = ({ onChange, ...props }: JsonFileUploadProps) => {
const handleChange = (value: string) => { const handleChange = (value: string) => {
try { try {
onChange(JSON.parse(value)); onChange(JSON.parse(value));
} catch (error) { } catch {
onChange({}); onChange({});
console.warn("Invalid json, ignoring value using {}"); console.warn("Invalid json, ignoring value using {}");
} }

View file

@ -114,11 +114,14 @@ export function UserDataTableAttributeSearchForm({
]); ]);
reset(); reset();
} else { } else {
errors.name?.message && if (errors.name?.message) {
addAlert(errors.name.message, AlertVariant.danger); addAlert(errors.name.message, AlertVariant.danger);
errors.value?.message && }
if (errors.value?.message) {
addAlert(errors.value.message, AlertVariant.danger); addAlert(errors.value.message, AlertVariant.danger);
} }
}
}; };
const clearActiveFilters = () => { const clearActiveFilters = () => {

View file

@ -191,7 +191,13 @@ export const UserSelect = ({
const option = v?.toString(); const option = v?.toString();
if (variant !== "typeaheadMulti") { if (variant !== "typeaheadMulti") {
const removed = field.value.includes(option); const removed = field.value.includes(option);
removed ? field.onChange([]) : field.onChange([option]);
if (removed) {
field.onChange([]);
} else {
field.onChange([option]);
}
setInputValue( setInputValue(
removed removed
? "" ? ""

View file

@ -199,7 +199,13 @@ export const IdentityProviderSelect = ({
const option = v?.toString(); const option = v?.toString();
if (variant !== "typeaheadMulti") { if (variant !== "typeaheadMulti") {
const removed = field.value.includes(option); const removed = field.value.includes(option);
removed ? field.onChange([]) : field.onChange([option]);
if (removed) {
field.onChange([]);
} else {
field.onChange([option]);
}
setInputValue(removed ? "" : option || ""); setInputValue(removed ? "" : option || "");
setOpen(false); setOpen(false);
} else { } else {

View file

@ -11,7 +11,7 @@ import { DynamicComponents } from "../components/dynamic/DynamicComponents";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { useFetch } from "../utils/useFetch"; import { useFetch } from "../utils/useFetch";
import { useParams } from "../utils/useParams"; import { useParams } from "../utils/useParams";
import { PAGE_PROVIDER, TAB_PROVIDER } from "./PageList"; import { type PAGE_PROVIDER, TAB_PROVIDER } from "./PageList";
import { toPage } from "./routes"; import { toPage } from "./routes";
type PageHandlerProps = { type PageHandlerProps = {

View file

@ -295,7 +295,7 @@ export default function NewAttributeSettings() {
}, },
translation.value, translation.value,
); );
} catch (error) { } catch {
console.error(`Error saving translation for ${translation.locale}`); console.error(`Error saving translation for ${translation.locale}`);
} }
}, },

View file

@ -78,8 +78,8 @@ export const PoliciesTab = () => {
const allClientPolicies = globalPolicies?.concat(policies ?? []); const allClientPolicies = globalPolicies?.concat(policies ?? []);
setPolicies(allClientPolicies), setPolicies(allClientPolicies);
setTablePolicies(allClientPolicies || []), setTablePolicies(allClientPolicies || []);
setCode(prettyPrintJSON(allClientPolicies)); setCode(prettyPrintJSON(allClientPolicies));
}, },
[key], [key],

View file

@ -210,12 +210,12 @@ export const RealmSettingsTabs = () => {
if (response) { if (response) {
setTableData([response]); setTableData([response]);
} }
} catch (error) { } catch {
return []; return [];
} }
}), }),
); );
} catch (error) { } catch {
return []; return [];
} }
}; };

View file

@ -148,7 +148,7 @@ export const EffectiveMessageBundles = ({
const sortedMessages = localeSort([...filteredMessages], mapByKey("key")); const sortedMessages = localeSort([...filteredMessages], mapByKey("key"));
return sortedMessages; return sortedMessages;
} catch (error) { } catch {
return []; return [];
} }
}; };

View file

@ -137,7 +137,7 @@ export const RealmOverrides = ({
} }
return Object.entries(result).slice(first, first + max); return Object.entries(result).slice(first, first + max);
} catch (error) { } catch {
return []; return [];
} }
}; };
@ -245,7 +245,7 @@ export const RealmOverrides = ({
string, string,
string string
> >
)[key], )[key];
await adminClient.realms.deleteRealmLocalizationTexts({ await adminClient.realms.deleteRealmLocalizationTexts({
realm: currentRealm!, realm: currentRealm!,
selectedLocale: selectMenuLocale, selectedLocale: selectMenuLocale,
@ -322,7 +322,7 @@ export const RealmOverrides = ({
addAlert(t("updateTranslationSuccess"), AlertVariant.success); addAlert(t("updateTranslationSuccess"), AlertVariant.success);
setTableRows(newRows); setTableRows(newRows);
} catch (error) { } catch {
addAlert(t("updateTranslationError"), AlertVariant.danger); addAlert(t("updateTranslationError"), AlertVariant.danger);
} }
@ -598,8 +598,11 @@ export const RealmOverrides = ({
setSelectedRowKeys([ setSelectedRowKeys([
(row.cells?.[0] as IRowCell).props.value, (row.cells?.[0] as IRowCell).props.value,
]); ]);
translations.length === 1 &&
if (translations.length === 1) {
setAreAllRowsSelected(true); setAreAllRowsSelected(true);
}
toggleDeleteDialog(); toggleDeleteDialog();
setKebabOpen(false); setKebabOpen(false);
}, },

View file

@ -101,7 +101,7 @@ export const AttributesGroupTab = ({
}); });
setTableData([updatedData]); setTableData([updatedData]);
} }
} catch (error) { } catch {
console.error(`Error removing translations for ${locale}`); console.error(`Error removing translations for ${locale}`);
} }
}), }),

View file

@ -92,7 +92,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
}); });
setTableData([updatedData]); setTableData([updatedData]);
} }
} catch (error) { } catch {
console.error(`Error removing translations for ${locale}`); console.error(`Error removing translations for ${locale}`);
} }
}), }),

View file

@ -168,7 +168,12 @@ export const UserForm = ({
}} }}
canBrowse={isManager} canBrowse={isManager}
onConfirm={(groups) => { onConfirm={(groups) => {
user?.id ? addGroups(groups || []) : addChips(groups || []); if (user?.id) {
addGroups(groups || []);
} else {
addChips(groups || []);
}
setOpen(false); setOpen(false);
}} }}
onClose={() => setOpen(false)} onClose={() => setOpen(false)}

View file

@ -175,7 +175,7 @@ export const localeToDisplayName = (locale: string, displayLocale: string) => {
// Once the existing locales have been moved, this code can be removed. // Once the existing locales have been moved, this code can be removed.
locale === "zh-CN" ? "zh-HANS" : locale === "zh-TW" ? "zh-HANT" : locale, locale === "zh-CN" ? "zh-HANS" : locale === "zh-TW" ? "zh-HANT" : locale,
); );
} catch (error) { } catch {
return locale; return locale;
} }
}; };

View file

@ -6,7 +6,7 @@ export type ReplaceString<
Input extends string, Input extends string,
Search extends string, Search extends string,
Replacement extends string, Replacement extends string,
Options extends ReplaceStringOptions = {}, Options extends ReplaceStringOptions = object,
> = Input extends `${infer Head}${Search}${infer Tail}` > = Input extends `${infer Head}${Search}${infer Tail}`
? Options["skipFirst"] extends true ? Options["skipFirst"] extends true
? `${Head}${Search}${ReplaceString<Tail, Search, Replacement>}` ? `${Head}${Search}${ReplaceString<Tail, Search, Replacement>}`

View file

@ -281,10 +281,10 @@ export class Agent {
value === "application/octet-stream", value === "application/octet-stream",
) )
) { ) {
return res.arrayBuffer(); return await res.arrayBuffer();
} }
return parseResponse(res); return await parseResponse(res);
} catch (err) { } catch (err) {
if ( if (
err instanceof NetworkError && err instanceof NetworkError &&

View file

@ -40,10 +40,9 @@ export async function parseResponse(response: Response): Promise<any> {
try { try {
return JSON.parse(data); return JSON.parse(data);
// eslint-disable-next-line no-empty } catch {
} catch (error) {}
return data; return data;
}
} }
function getErrorMessage(data: unknown): string { function getErrorMessage(data: unknown): string {

View file

@ -451,7 +451,7 @@ describe("Authentication management", () => {
id: config.id!, id: config.id!,
}); });
fail("should not find deleted config"); fail("should not find deleted config");
} catch (error) { } catch {
// ignore // ignore
} }
}); });

View file

@ -35,7 +35,7 @@ describe("Client Scopes", () => {
await kcAdminClient.clientScopes.delDefaultClientScope({ await kcAdminClient.clientScopes.delDefaultClientScope({
id: currentClientScope.id!, id: currentClientScope.id!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
@ -44,7 +44,7 @@ describe("Client Scopes", () => {
await kcAdminClient.clientScopes.delDefaultOptionalClientScope({ await kcAdminClient.clientScopes.delDefaultOptionalClientScope({
id: currentClientScope.id!, id: currentClientScope.id!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
@ -53,7 +53,7 @@ describe("Client Scopes", () => {
await kcAdminClient.clientScopes.delByName({ await kcAdminClient.clientScopes.delByName({
name: currentClientScopeName, name: currentClientScopeName,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });
@ -69,7 +69,7 @@ describe("Client Scopes", () => {
await kcAdminClient.clientScopes.delByName({ await kcAdminClient.clientScopes.delByName({
name: currentClientScopeName, name: currentClientScopeName,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
@ -90,7 +90,7 @@ describe("Client Scopes", () => {
await kcAdminClient.clientScopes.delByName({ await kcAdminClient.clientScopes.delByName({
name: currentClientScopeName, name: currentClientScopeName,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
@ -273,7 +273,7 @@ describe("Client Scopes", () => {
id: id!, id: id!,
mapperId: mapperId!, mapperId: mapperId!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });
@ -581,7 +581,7 @@ describe("Client Scopes", () => {
await kcAdminClient.roles.delByName({ await kcAdminClient.roles.delByName({
name: dummyRoleName, name: dummyRoleName,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });

View file

@ -293,7 +293,7 @@ describe("Clients", () => {
clientScopeId: clientScopeId!, clientScopeId: clientScopeId!,
id: id!, id: id!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
@ -302,7 +302,7 @@ describe("Clients", () => {
await kcAdminClient.clientScopes.delByName({ await kcAdminClient.clientScopes.delByName({
name: dummyClientScope.name!, name: dummyClientScope.name!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });
@ -387,7 +387,7 @@ describe("Clients", () => {
clientScopeId: clientScopeId!, clientScopeId: clientScopeId!,
id: id!, id: id!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
@ -396,7 +396,7 @@ describe("Clients", () => {
await kcAdminClient.clientScopes.delByName({ await kcAdminClient.clientScopes.delByName({
name: dummyClientScope.name!, name: dummyClientScope.name!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });
@ -480,7 +480,7 @@ describe("Clients", () => {
id: clientUniqueId!, id: clientUniqueId!,
mapperId: mapperId!, mapperId: mapperId!,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });
@ -649,7 +649,7 @@ describe("Clients", () => {
id: id!, id: id!,
roleName: dummyRoleName, roleName: dummyRoleName,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });
@ -804,7 +804,7 @@ describe("Clients", () => {
await kcAdminClient.roles.delByName({ await kcAdminClient.roles.delByName({
name: dummyRoleName, name: dummyRoleName,
}); });
} catch (e) { } catch {
// ignore // ignore
} }
}); });

View file

@ -342,7 +342,7 @@ describe("Users", () => {
id: currentUser.id!, id: currentUser.id!,
groupId: newGroup.id, groupId: newGroup.id,
}); });
} catch (e) { } catch {
fail("Didn't expect an error when deleting a valid group id"); fail("Didn't expect an error when deleting a valid group id");
} }

View file

@ -44,7 +44,7 @@ export function getInjectedEnvironment<T>(): T {
try { try {
return JSON.parse(contents); return JSON.parse(contents);
} catch (error) { } catch {
throw new Error("Unable to parse environment variables as JSON."); throw new Error("Unable to parse environment variables as JSON.");
} }
} }

View file

@ -6,7 +6,7 @@ import { UserProfileFieldProps } from "./UserProfileFields";
const localeToDisplayName = (locale: string) => { const localeToDisplayName = (locale: string) => {
try { try {
return new Intl.DisplayNames([locale], { type: "language" }).of(locale); return new Intl.DisplayNames([locale], { type: "language" }).of(locale);
} catch (error) { } catch {
return locale; return locale;
} }
}; };

View file

@ -25,26 +25,23 @@ export type Options = {
options?: string[]; options?: string[];
}; };
const INPUT_TYPES = [ export type InputType =
"text", | "text"
"textarea", | "textarea"
"select", | "select"
"select-radiobuttons", | "select-radiobuttons"
"multiselect", | "multiselect"
"multiselect-checkboxes", | "multiselect-checkboxes"
"html5-email", | "html5-email"
"html5-tel", | "html5-tel"
"html5-url", | "html5-url"
"html5-number", | "html5-number"
"html5-range", | "html5-range"
"html5-datetime-local", | "html5-datetime-local"
"html5-date", | "html5-date"
"html5-month", | "html5-month"
"html5-time", | "html5-time"
"multi-input", | "multi-input";
] as const;
export type InputType = (typeof INPUT_TYPES)[number];
export type UserProfileFieldProps = { export type UserProfileFieldProps = {
t: TFunction; t: TFunction;

View file

@ -7,13 +7,14 @@
"prepare": "husky js/.husky" "prepare": "husky js/.husky"
}, },
"devDependencies": { "devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0", "@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0", "@eslint/js": "^9.8.0",
"@types/node": "^22.0.2", "@types/node": "^22.0.2",
"eslint": "^8.52.0", "eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^3.4.0", "eslint-plugin-cypress": "^3.4.0",
"eslint-plugin-lodash": "^7.4.0", "eslint-plugin-lodash": "^8.0.0",
"eslint-plugin-mocha": "^10.5.0", "eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-playwright": "^1.6.2", "eslint-plugin-playwright": "^1.6.2",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
@ -24,7 +25,7 @@
"prettier": "^3.3.3", "prettier": "^3.3.3",
"tslib": "^2.6.3", "tslib": "^2.6.3",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"typescript-eslint": "^7.18.0", "typescript-eslint": "^8.0.0",
"wireit": "^0.14.5" "wireit": "^0.14.5"
}, },
"pnpm": { "pnpm": {

File diff suppressed because it is too large Load diff