diff --git a/.eslintrc.js b/.eslintrc.js index 200ef39d54..180c147048 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,6 +35,7 @@ module.exports = { "react/prop-types": "off", // Prevent fragments from being added that have only a single child. "react/jsx-no-useless-fragment": "error", + "prefer-arrow-callback": "error", "prettier/prettier": [ "error", { diff --git a/cypress/integration/client_scopes_test.spec.ts b/cypress/integration/client_scopes_test.spec.ts index 38094f1ef8..82a8b514b5 100644 --- a/cypress/integration/client_scopes_test.spec.ts +++ b/cypress/integration/client_scopes_test.spec.ts @@ -15,15 +15,15 @@ const listingPage = new ListingPage(); const createClientScopePage = new CreateClientScopePage(); const modalUtils = new ModalUtils(); -describe("Client Scopes test", function () { - describe("Client Scope creation", function () { - beforeEach(function () { +describe("Client Scopes test", () => { + describe("Client Scope creation", () => { + beforeEach(() => { keycloakBefore(); loginPage.logIn(); sidebarPage.goToClientScopes(); }); - it("should fail creating client scope", function () { + it("should fail creating client scope", () => { listingPage.goToCreateItem(); createClientScopePage.save().checkClientNameRequiredMessage(); diff --git a/cypress/integration/clients_test.spec.ts b/cypress/integration/clients_test.spec.ts index 53b007c644..7355205d9c 100644 --- a/cypress/integration/clients_test.spec.ts +++ b/cypress/integration/clients_test.spec.ts @@ -19,15 +19,15 @@ const listingPage = new ListingPage(); const createClientPage = new CreateClientPage(); const modalUtils = new ModalUtils(); -describe("Clients test", function () { - describe("Client creation", function () { - beforeEach(function () { +describe("Clients test", () => { + describe("Client creation", () => { + beforeEach(() => { keycloakBefore(); loginPage.logIn(); sidebarPage.goToClients(); }); - it("should fail creating client", function () { + it("should fail creating client", () => { listingPage.goToCreateItem(); createClientPage.continue().checkClientIdRequiredMessage(); @@ -46,7 +46,7 @@ describe("Clients test", function () { ); }); - it("Client CRUD test", function () { + it("Client CRUD test", () => { itemId += "_" + (Math.random() + 1).toString(36).substring(7); // Create diff --git a/cypress/integration/identity_providers.spec.ts b/cypress/integration/identity_providers.spec.ts index 1de2eda88d..d4e1278ca4 100644 --- a/cypress/integration/identity_providers.spec.ts +++ b/cypress/integration/identity_providers.spec.ts @@ -34,7 +34,7 @@ describe("Identity provider test", () => { describe("Identity provider creation", () => { const identityProviderName = "github"; - beforeEach(function () { + beforeEach(() => { keycloakBefore(); loginPage.logIn(); sidebarPage.goToIdentityProviders(); diff --git a/cypress/integration/login_test.spec.ts b/cypress/integration/login_test.spec.ts index bf0ab24d1d..eef192d9ff 100644 --- a/cypress/integration/login_test.spec.ts +++ b/cypress/integration/login_test.spec.ts @@ -8,18 +8,18 @@ const password = "admin"; const loginPage = new LoginPage(); const masthead = new Masthead(); -describe("Logging In", function () { - beforeEach(function () { +describe("Logging In", () => { + beforeEach(() => { keycloakBefore(); }); - it("displays errors on wrong credentials", function () { + it("displays errors on wrong credentials", () => { loginPage.logIn("wrong", "user{enter}"); loginPage.checkErrorMessage("Invalid username or password.").isLogInPage(); }); - it("logs in", function () { + it("logs in", () => { loginPage.logIn(username, password); masthead.isAdminConsole(); diff --git a/cypress/integration/realm_roles_test.spec.ts b/cypress/integration/realm_roles_test.spec.ts index f6fba46d4d..a0d81dd3af 100644 --- a/cypress/integration/realm_roles_test.spec.ts +++ b/cypress/integration/realm_roles_test.spec.ts @@ -16,15 +16,15 @@ const listingPage = new ListingPage(); const createRealmRolePage = new CreateRealmRolePage(); const associatedRolesPage = new AssociatedRolesPage(); -describe("Realm roles test", function () { - describe("Realm roles creation", function () { - beforeEach(function () { +describe("Realm roles test", () => { + describe("Realm roles creation", () => { + beforeEach(() => { keycloakBefore(); loginPage.logIn(); sidebarPage.goToRealmRoles(); }); - it("should fail creating realm role", function () { + it("should fail creating realm role", () => { listingPage.goToCreateItem(); createRealmRolePage.save().checkRealmRoleNameRequiredMessage(); @@ -37,7 +37,7 @@ describe("Realm roles test", function () { ); }); - it("Realm role CRUD test", function () { + it("Realm role CRUD test", () => { itemId += "_" + (Math.random() + 1).toString(36).substring(7); // Create @@ -63,7 +63,7 @@ describe("Realm roles test", function () { listingPage.itemExist(itemId, false); }); - it("Associated roles test", function () { + it("Associated roles test", () => { itemId += "_" + (Math.random() + 1).toString(36).substring(7); // Create diff --git a/cypress/integration/realm_settings_test.spec.ts b/cypress/integration/realm_settings_test.spec.ts index 11b3a1fb43..1fda1fb593 100644 --- a/cypress/integration/realm_settings_test.spec.ts +++ b/cypress/integration/realm_settings_test.spec.ts @@ -108,7 +108,7 @@ describe("Realm settings tests", () => { return this; }; - it("Go to general tab", function () { + it("Go to general tab", () => { sidebarPage.goToRealmSettings(); realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.save(realmSettingsPage.generalSaveBtn); @@ -446,27 +446,27 @@ describe("Realm settings tests", () => { cy.findByTestId("rs-profiles-clientPolicies-tab").click(); }); - it("Go to client policies profiles tab", function () { + it("Go to client policies profiles tab", () => { realmSettingsPage.shouldDisplayProfilesTab(); }); - it("Check new client form is displaying", function () { + it("Check new client form is displaying", () => { realmSettingsPage.shouldDisplayNewClientProfileForm(); }); - it("Complete new client form and cancel", function () { + it("Complete new client form and cancel", () => { realmSettingsPage.shouldCompleteAndCancelCreateNewClientProfile(); }); - it("Complete new client form and submit", function () { + it("Complete new client form and submit", () => { realmSettingsPage.shouldCompleteAndCreateNewClientProfile(); }); - it("Check cancelling the client profile deletion", function () { + it("Check cancelling the client profile deletion", () => { realmSettingsPage.shouldDisplayDeleteClientProfileDialog(); }); - it("Check deleting the client profile", function () { + it("Check deleting the client profile", () => { realmSettingsPage.shouldDeleteClientProfileDialog(); }); }); diff --git a/cypress/integration/sessions_test.spec.ts b/cypress/integration/sessions_test.spec.ts index 2a0df1b606..63b0d6b386 100644 --- a/cypress/integration/sessions_test.spec.ts +++ b/cypress/integration/sessions_test.spec.ts @@ -7,9 +7,9 @@ const loginPage = new LoginPage(); const sidebarPage = new SidebarPage(); const sessionsPage = new SessionsPage(); -describe("Sessions test", function () { - describe("Session type dropdown", function () { - beforeEach(function () { +describe("Sessions test", () => { + describe("Session type dropdown", () => { + beforeEach(() => { keycloakBefore(); loginPage.logIn(); sidebarPage.goToSessions(); diff --git a/src/authentication/components/diagram/ConditionalNode.tsx b/src/authentication/components/diagram/ConditionalNode.tsx index d96a12af59..c11c18c186 100644 --- a/src/authentication/components/diagram/ConditionalNode.tsx +++ b/src/authentication/components/diagram/ConditionalNode.tsx @@ -6,10 +6,7 @@ type ConditionalNodeProps = { selected: boolean; }; -export const ConditionalNode = memo(function TheNode({ - data, - selected, -}: ConditionalNodeProps) { +const ConditionalNodeInner = ({ data, selected }: ConditionalNodeProps) => { return ( <> @@ -23,4 +20,6 @@ export const ConditionalNode = memo(function TheNode({ ); -}); +}; + +export const ConditionalNode = memo(ConditionalNodeInner); diff --git a/src/authentication/components/diagram/SubFlowNode.tsx b/src/authentication/components/diagram/SubFlowNode.tsx index 361456fc74..948a2afbbc 100644 --- a/src/authentication/components/diagram/SubFlowNode.tsx +++ b/src/authentication/components/diagram/SubFlowNode.tsx @@ -10,11 +10,11 @@ type SubFlowNodeProps = NodeProps & { prefix: string; }; -export const SubFlowNode = memo(function TheNode({ +const SubFlowNodeInner = ({ data: { label }, prefix, selected, -}: SubFlowNodeProps) { +}: SubFlowNodeProps) => { return ( <> @@ -30,7 +30,9 @@ export const SubFlowNode = memo(function TheNode({ ); -}); +}; + +export const SubFlowNode = memo(SubFlowNodeInner); export const StartSubFlowNode = ({ ...props }: NodeProps) => (