diff --git a/.gitignore b/.gitignore index d5d7377f94ee..0d2f39d5e998 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,6 @@ unleash-server.tar.gz # Visual Studio Code jsconfig.json typings -.vscode .nyc_output # We use yarn.lock diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 50fa9364be56..000000000000 --- a/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -CHANGELOG.md -website/docs diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000000..462a5c057c7f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.defaultFormatter": "biomejs.biome" +} diff --git a/biome.json b/biome.json index 2cf0a2ba6e48..ec7484c86fac 100644 --- a/biome.json +++ b/biome.json @@ -41,8 +41,8 @@ "website/translated_docs", "website", "setupJest.js", - "frontend", "dist", + "build", "src/migrations/*.js", "src/test/examples/*.json", "website/**/*.js", @@ -67,16 +67,13 @@ "website/translated_docs", "website", "setupJest.js", - "frontend", "dist", + "build", "src/migrations/*.js", "src/migrations/*.json", "src/test/examples/*.json", "website/**/*.js", - "coverage", - ".eslintrc", - ".eslintignore", - "package.json" + "coverage" ], "indentSize": 4 }, diff --git a/frontend/.prettierignore b/frontend/.prettierignore deleted file mode 100644 index 3a8fb9cf677d..000000000000 --- a/frontend/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -.github/* -CHANGELOG.md diff --git a/frontend/.prettierrc b/frontend/.prettierrc deleted file mode 100644 index 552578130e1c..000000000000 --- a/frontend/.prettierrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "singleQuote": true, - "bracketSpacing": true, - "bracketSameLine": false, - "arrowParens": "avoid", - "printWidth": 80 -} diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index 88468d02b148..2ff0fa05eab4 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -15,7 +15,7 @@ export default defineConfig({ vitePreprocessor({ configFile: path.resolve(__dirname, './vite.config.ts'), mode: 'development', - }) + }), ); on('task', { log(message) { diff --git a/frontend/cypress.d.ts b/frontend/cypress.d.ts index d12adb035f82..82be5b655888 100644 --- a/frontend/cypress.d.ts +++ b/frontend/cypress.d.ts @@ -1,5 +1,5 @@ /// declare namespace Cypress { - interface Chainable {} + type Chainable = {}; } diff --git a/frontend/cypress/global.d.ts b/frontend/cypress/global.d.ts index aacc3afe18e9..92009e49312a 100644 --- a/frontend/cypress/global.d.ts +++ b/frontend/cypress/global.d.ts @@ -26,25 +26,25 @@ declare namespace Cypress { createProject_UI( projectName: string, - defaultStickiness: string + defaultStickiness: string, ): Chainable; createFeature_UI( name: string, shouldWait?: boolean, - project?: string + project?: string, ): Chainable; // VARIANTS addVariantsToFeature_UI( featureToggleName: string, variants: Array, - projectName?: string + projectName?: string, ); deleteVariant_UI( featureToggleName: string, variant: string, - projectName?: string + projectName?: string, ): Chainable; // SEGMENTS @@ -54,16 +54,16 @@ declare namespace Cypress { // STRATEGY addUserIdStrategyToFeature_UI( featureName: string, - projectName?: string + projectName?: string, ): Chainable; addFlexibleRolloutStrategyToFeature_UI( - options: AddFlexibleRolloutStrategyOptions + options: AddFlexibleRolloutStrategyOptions, ): Chainable; updateFlexibleRolloutStrategy_UI(featureToggleName: string); deleteFeatureStrategy_UI( featureName: string, shouldWait?: boolean, - projectName?: string + projectName?: string, ): Chainable; // API @@ -72,22 +72,22 @@ declare namespace Cypress { addUserToProject_API( id: number, role: number, - projectName?: string + projectName?: string, ): Chainable; createProject_API( name: string, - options?: Partial + options?: Partial, ): Chainable; deleteProject_API(name: string): Chainable; createFeature_API( name: string, projectName?: string, - options?: Partial + options?: Partial, ): Chainable; deleteFeature_API(name: string): Chainable; createEnvironment_API( environment: IEnvironment, - options?: Partial + options?: Partial, ): Chainable; } } diff --git a/frontend/cypress/integration/demo/demo.spec.ts b/frontend/cypress/integration/demo/demo.spec.ts index 71f57a0938e0..f40fb4e2e35b 100644 --- a/frontend/cypress/integration/demo/demo.spec.ts +++ b/frontend/cypress/integration/demo/demo.spec.ts @@ -16,7 +16,7 @@ describe('demo', () => { name: 'dev', type: 'development', }, - optionsIgnore409 + optionsIgnore409, ); cy.createProject_API('demo-app', optionsIgnore409); cy.createFeature_API('demoApp.step1', 'demo-app', optionsIgnore409); @@ -32,10 +32,10 @@ describe('demo', () => { cy.get("[data-testid='CLOSE_SPLASH']").click(); } - cy.intercept('GET', `${baseUrl}/api/admin/ui-config`, req => { + cy.intercept('GET', `${baseUrl}/api/admin/ui-config`, (req) => { req.headers['cache-control'] = 'no-cache, no-store, must-revalidate'; - req.on('response', res => { + req.on('response', (res) => { if (res.body) { res.body.flags = { ...res.body.flags, @@ -93,7 +93,7 @@ describe('demo', () => { 'log', `Testing topic #${topic + 1} "${ currentTopic.title - }", step #${step + 1}...` + }", step #${step + 1}...`, ); if (!currentStep.optional) { diff --git a/frontend/cypress/integration/feature/feature.spec.ts b/frontend/cypress/integration/feature/feature.spec.ts index 855fb7af4f39..bfd6cec5e998 100644 --- a/frontend/cypress/integration/feature/feature.spec.ts +++ b/frontend/cypress/integration/feature/feature.spec.ts @@ -28,14 +28,14 @@ describe('feature', () => { it('gives an error if a toggle exists with the same name', () => { cy.createFeature_UI(featureToggleName, false); cy.get("[data-testid='INPUT_ERROR_TEXT']").contains( - 'A toggle with that name already exists' + 'A toggle with that name already exists', ); }); it('gives an error if a toggle name is url unsafe', () => { cy.createFeature_UI('featureToggleUnsafe####$#//', false); cy.get("[data-testid='INPUT_ERROR_TEXT']").contains( - `"name" must be URL friendly` + `"name" must be URL friendly`, ); }); @@ -44,7 +44,7 @@ describe('feature', () => { featureToggleName, }).then(() => { cy.updateFlexibleRolloutStrategy_UI(featureToggleName).then(() => - cy.deleteFeatureStrategy_UI(featureToggleName) + cy.deleteFeatureStrategy_UI(featureToggleName), ); }); }); @@ -71,7 +71,7 @@ describe('feature', () => { cy.intercept( 'PATCH', `/api/admin/projects/default/features/${featureToggleName}/environments/development/variants`, - req => { + (req) => { expect(req.body[0].op).to.equal('replace'); expect(req.body[0].path).to.equal('/1/weightType'); expect(req.body[0].value).to.equal('fix'); @@ -81,13 +81,13 @@ describe('feature', () => { expect(req.body[2].op).to.equal('replace'); expect(req.body[2].path).to.equal('/0/weight'); expect(req.body[2].value).to.equal(850); - } + }, ).as('variantUpdate'); cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click(); cy.get(`[data-testid=VARIANT_WEIGHT_${variant2}]`).should( 'have.text', - '15 %' + '15 %', ); }); diff --git a/frontend/cypress/integration/groups/groups.spec.ts b/frontend/cypress/integration/groups/groups.spec.ts index 2b4a2431dc71..672f74728039 100644 --- a/frontend/cypress/integration/groups/groups.spec.ts +++ b/frontend/cypress/integration/groups/groups.spec.ts @@ -15,13 +15,13 @@ describe('groups', () => { email: `unleash-e2e-user${i}-${randomId}@test.com`, sendEmail: false, rootRole: 3, - }).then(response => userIds.push(response.body.id)); + }).then((response) => userIds.push(response.body.id)); } }); after(() => { - userIds.forEach(id => - cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`) + userIds.forEach((id) => + cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`), ); }); @@ -55,7 +55,7 @@ describe('groups', () => { cy.get("[data-testid='UG_NAME_ID']").type(groupName); cy.get("[data-testid='INPUT_ERROR_TEXT'").contains( - 'A group with that name already exists.' + 'A group with that name already exists.', ); }); diff --git a/frontend/cypress/integration/import/import.spec.ts b/frontend/cypress/integration/import/import.spec.ts index f934c925bb12..03eb40ff9df9 100644 --- a/frontend/cypress/integration/import/import.spec.ts +++ b/frontend/cypress/integration/import/import.spec.ts @@ -15,13 +15,13 @@ describe('imports', () => { email: `unleash-e2e-user${i}-${randomFeatureName}@test.com`, sendEmail: false, rootRole: 3, - }).then(response => userIds.push(response.body.id)); + }).then((response) => userIds.push(response.body.id)); } }); after(() => { - userIds.forEach(id => - cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`) + userIds.forEach((id) => + cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`), ); }); @@ -118,13 +118,13 @@ describe('imports', () => { cy.wait(500); cy.get( - "[data-testid='feature-toggle-status'] input[type='checkbox']:checked" + "[data-testid='feature-toggle-status'] input[type='checkbox']:checked", ) .invoke('attr', 'aria-label') .should('eq', 'development'); cy.get( - '[data-testid="FEATURE_ENVIRONMENT_ACCORDION_development"]' + '[data-testid="FEATURE_ENVIRONMENT_ACCORDION_development"]', ).click(); cy.contains('50%'); }); diff --git a/frontend/cypress/integration/projects/access.spec.ts b/frontend/cypress/integration/projects/access.spec.ts index 68898e7ceb09..d3d3f53b40d3 100644 --- a/frontend/cypress/integration/projects/access.spec.ts +++ b/frontend/cypress/integration/projects/access.spec.ts @@ -31,13 +31,13 @@ describe('project-access', () => { rootRole: 3, }) .as(name) - .then(response => { + .then((response) => { const id = response.body.id; userIds.push(id); cy.request('POST', `${baseUrl}/api/admin/groups`, { name: `${i}-${groupAndProjectName}`, users: [{ user: { id: id } }], - }).then(response => { + }).then((response) => { const id = response.body.id; groupIds.push(id); }); @@ -50,26 +50,26 @@ describe('project-access', () => { }); after(() => { - userIds.forEach(id => - cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`) + userIds.forEach((id) => + cy.request('DELETE', `${baseUrl}/api/admin/user-admin/${id}`), ); - groupIds.forEach(id => - cy.request('DELETE', `${baseUrl}/api/admin/groups/${id}`) + groupIds.forEach((id) => + cy.request('DELETE', `${baseUrl}/api/admin/groups/${id}`), ); cy.request( 'DELETE', - `${baseUrl}/api/admin/projects/${groupAndProjectName}` + `${baseUrl}/api/admin/projects/${groupAndProjectName}`, ); }); beforeEach(() => { cy.login_UI(); - cy.intercept('GET', `${baseUrl}/api/admin/ui-config`, req => { + cy.intercept('GET', `${baseUrl}/api/admin/ui-config`, (req) => { req.headers['cache-control'] = 'no-cache, no-store, must-revalidate'; - req.on('response', res => { + req.on('response', (res) => { if (res.body) { res.body.flags = { ...res.body.flags, @@ -90,7 +90,7 @@ describe('project-access', () => { cy.intercept( 'POST', - `/api/admin/projects/${groupAndProjectName}/access` + `/api/admin/projects/${groupAndProjectName}/access`, ).as('assignAccess'); cy.get(`[data-testid='${PA_USERS_GROUPS_ID}']`).click(); @@ -109,7 +109,7 @@ describe('project-access', () => { cy.intercept( 'POST', - `/api/admin/projects/${groupAndProjectName}/access` + `/api/admin/projects/${groupAndProjectName}/access`, ).as('assignAccess'); cy.get(`[data-testid='${PA_USERS_GROUPS_ID}']`).click(); @@ -128,7 +128,7 @@ describe('project-access', () => { cy.intercept( 'PUT', - `/api/admin/projects/${groupAndProjectName}/groups/${groupIds[0]}/roles` + `/api/admin/projects/${groupAndProjectName}/groups/${groupIds[0]}/roles`, ).as('editAccess'); cy.get(`[data-testid='CancelIcon']`).last().click(); @@ -148,7 +148,7 @@ describe('project-access', () => { cy.intercept( 'PUT', - `/api/admin/projects/${groupAndProjectName}/groups/${groupIds[0]}/roles` + `/api/admin/projects/${groupAndProjectName}/groups/${groupIds[0]}/roles`, ).as('editAccess'); cy.get(`[data-testid='${PA_ROLE_ID}']`).click(); @@ -167,7 +167,7 @@ describe('project-access', () => { cy.intercept( 'DELETE', - `/api/admin/projects/${groupAndProjectName}/groups/${groupIds[0]}/roles` + `/api/admin/projects/${groupAndProjectName}/groups/${groupIds[0]}/roles`, ).as('removeAccess'); cy.contains("Yes, I'm sure").click(); diff --git a/frontend/cypress/integration/segments/segments.spec.ts b/frontend/cypress/integration/segments/segments.spec.ts index 4d7f0733d1f2..343a8e904e2d 100644 --- a/frontend/cypress/integration/segments/segments.spec.ts +++ b/frontend/cypress/integration/segments/segments.spec.ts @@ -27,7 +27,7 @@ describe('segments', () => { cy.get("[data-testid='SEGMENT_NAME_ID']").type(segmentName); cy.get("[data-testid='SEGMENT_NEXT_BTN_ID']").should('be.disabled'); cy.get("[data-testid='INPUT_ERROR_TEXT']").contains( - 'Segment name already exists' + 'Segment name already exists', ); }); diff --git a/frontend/cypress/support/API.ts b/frontend/cypress/support/API.ts index 15ef005513f6..d4784a746229 100644 --- a/frontend/cypress/support/API.ts +++ b/frontend/cypress/support/API.ts @@ -2,12 +2,12 @@ import Chainable = Cypress.Chainable; const baseUrl = Cypress.config().baseUrl; -const password = Cypress.env(`AUTH_PASSWORD`) + '_A'; +const password = `${Cypress.env(`AUTH_PASSWORD`)}_A`; const PROJECT_MEMBER = 5; export const createFeature_API = ( featureName: string, projectName?: string, - options?: Partial + options?: Partial, ): Chainable => { const project = projectName || 'default'; return cy.request({ @@ -36,7 +36,7 @@ export const deleteFeature_API = (name: string): Chainable => { export const createProject_API = ( project: string, - options?: Partial + options?: Partial, ): Chainable => { return cy.request({ url: `${baseUrl}/api/admin/projects`, @@ -71,10 +71,10 @@ export const createUser_API = (userName: string, role: number) => { rootRole: role, }) .as(name) - .then(response => { + .then((response) => { const id = response.body.id; updateUserPassword_API(id).then(() => { - addUserToProject_API(id, PROJECT_MEMBER).then(value => { + addUserToProject_API(id, PROJECT_MEMBER).then((value) => { userIds.push(id); userCredentials.push({ email, password }); }); @@ -89,13 +89,13 @@ export const updateUserPassword_API = (id: number, pass?: string): Chainable => `${baseUrl}/api/admin/user-admin/${id}/change-password`, { password: pass || password, - } + }, ); export const addUserToProject_API = ( id: number, role: number, - projectName?: string + projectName?: string, ): Chainable => { const project = projectName || 'default'; return cy.request( @@ -104,7 +104,7 @@ export const addUserToProject_API = ( { groups: [], users: [{ id }], - } + }, ); }; @@ -115,7 +115,7 @@ interface IEnvironment { export const createEnvironment_API = ( environment: IEnvironment, - options?: Partial + options?: Partial, ): Chainable => { return cy.request({ url: `${baseUrl}/api/admin/environments`, diff --git a/frontend/cypress/support/UI.ts b/frontend/cypress/support/UI.ts index 006bad07c6fc..dc1fc18504df 100644 --- a/frontend/cypress/support/UI.ts +++ b/frontend/cypress/support/UI.ts @@ -15,7 +15,7 @@ const disableActiveSplashScreens = () => { const disableFeatureStrategiesProdGuard = () => { localStorage.setItem( 'useFeatureStrategyProdGuardSettings:v2', - JSON.stringify({ hide: true }) + JSON.stringify({ hide: true }), ); }; @@ -26,7 +26,7 @@ export const runBefore = () => { export const login_UI = ( user = AUTH_USER, - password = AUTH_PASSWORD + password = AUTH_PASSWORD, ): Chainable => { return cy.session(user, () => { cy.visit('/'); @@ -51,14 +51,14 @@ export const login_UI = ( export const createFeature_UI = ( name: string, shouldWait?: boolean, - project?: string + project?: string, ): Chainable => { const projectName = project || 'default'; cy.get('[data-testid=NAVIGATE_TO_CREATE_FEATURE').click(); cy.intercept('POST', `/api/admin/projects/${projectName}/features`).as( - 'createFeature' + 'createFeature', ); cy.wait(300); @@ -72,7 +72,7 @@ export const createFeature_UI = ( export const createProject_UI = ( projectName: string, - defaultStickiness: string + defaultStickiness: string, ): Chainable => { cy.get('[data-testid=NAVIGATE_TO_CREATE_PROJECT').click(); @@ -111,7 +111,7 @@ export const deleteSegment_UI = (segmentName: string): Chainable => { }; export const addFlexibleRolloutStrategyToFeature_UI = ( - options: AddStrategyOptions + options: AddStrategyOptions, ): Chainable => { const { featureToggleName, project, environment, stickiness } = options; const projectName = project || 'default'; @@ -123,7 +123,7 @@ export const addFlexibleRolloutStrategyToFeature_UI = ( cy.intercept( 'POST', `/api/admin/projects/${projectName}/features/${featureToggleName}/environments/development/strategies`, - req => { + (req) => { expect(req.body.name).to.equal('flexibleRollout'); expect(req.body.parameters.groupId).to.equal(featureToggleName); expect(req.body.parameters.stickiness).to.equal(defaultStickiness); @@ -135,14 +135,14 @@ export const addFlexibleRolloutStrategyToFeature_UI = ( expect(req.body.constraints.length).to.equal(0); } - req.continue(res => { + req.continue((res) => { strategyId = res.body.id; }); - } + }, ).as('addStrategyToFeature'); cy.visit( - `/projects/${projectName}/features/${featureToggleName}/strategies/create?environmentId=${env}&strategyName=flexibleRollout` + `/projects/${projectName}/features/${featureToggleName}/strategies/create?environmentId=${env}&strategyName=flexibleRollout`, ); cy.wait(500); // Takes a bit to load the screen - this will wait until it finds it or fail @@ -157,11 +157,11 @@ export const addFlexibleRolloutStrategyToFeature_UI = ( export const updateFlexibleRolloutStrategy_UI = ( featureToggleName: string, - projectName?: string + projectName?: string, ) => { const project = projectName || 'default'; cy.visit( - `/projects/${project}/features/${featureToggleName}/strategies/edit?environmentId=development&strategyId=${strategyId}` + `/projects/${project}/features/${featureToggleName}/strategies/edit?environmentId=development&strategyId=${strategyId}`, ); cy.wait(500); @@ -182,7 +182,7 @@ export const updateFlexibleRolloutStrategy_UI = ( cy.intercept( 'PUT', `/api/admin/projects/${project}/features/${featureToggleName}/environments/*/strategies/${strategyId}`, - req => { + (req) => { expect(req.body.parameters.groupId).to.equal('new-group-id'); expect(req.body.parameters.stickiness).to.equal('sessionId'); expect(req.body.parameters.rollout).to.equal('50'); @@ -193,10 +193,10 @@ export const updateFlexibleRolloutStrategy_UI = ( expect(req.body.constraints.length).to.equal(0); } - req.continue(res => { + req.continue((res) => { expect(res.statusCode).to.equal(200); }); - } + }, ).as('updateStrategy'); cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`).first().click(); @@ -206,18 +206,18 @@ export const updateFlexibleRolloutStrategy_UI = ( export const deleteFeatureStrategy_UI = ( featureToggleName: string, shouldWait?: boolean, - projectName?: string + projectName?: string, ): Chainable => { const project = projectName || 'default'; cy.intercept( 'DELETE', `/api/admin/projects/${project}/features/${featureToggleName}/environments/*/strategies/${strategyId}`, - req => { - req.continue(res => { + (req) => { + req.continue((res) => { expect(res.statusCode).to.equal(200); }); - } + }, ).as('deleteUserStrategy'); cy.visit(`/projects/${project}/features/${featureToggleName}`); cy.get('[data-testid=FEATURE_ENVIRONMENT_ACCORDION_development]').click(); @@ -230,11 +230,11 @@ export const deleteFeatureStrategy_UI = ( export const addUserIdStrategyToFeature_UI = ( featureToggleName: string, - projectName: string + projectName: string, ): Chainable => { const project = projectName || 'default'; cy.visit( - `/projects/${project}/features/${featureToggleName}/strategies/create?environmentId=development&strategyName=userWithId` + `/projects/${project}/features/${featureToggleName}/strategies/create?environmentId=development&strategyName=userWithId`, ); if (ENTERPRISE) { @@ -255,7 +255,7 @@ export const addUserIdStrategyToFeature_UI = ( cy.intercept( 'POST', `/api/admin/projects/default/features/${featureToggleName}/environments/*/strategies`, - req => { + (req) => { expect(req.body.name).to.equal('userWithId'); expect(req.body.parameters.userIds.length).to.equal(11); @@ -266,10 +266,10 @@ export const addUserIdStrategyToFeature_UI = ( expect(req.body.constraints.length).to.equal(0); } - req.continue(res => { + req.continue((res) => { strategyId = res.body.id; }); - } + }, ).as('addStrategyToFeature'); cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`).first().click(); @@ -279,7 +279,7 @@ export const addUserIdStrategyToFeature_UI = ( export const addVariantsToFeature_UI = ( featureToggleName: string, variants: Array, - projectName: string + projectName: string, ) => { const project = projectName || 'default'; cy.visit(`/projects/${project}/features/${featureToggleName}/variants`); @@ -287,16 +287,16 @@ export const addVariantsToFeature_UI = ( cy.intercept( 'PATCH', `/api/admin/projects/${project}/features/${featureToggleName}/environments/development/variants`, - req => { + (req) => { variants.forEach((variant, index) => { expect(req.body[index].op).to.equal('add'); expect(req.body[index].path).to.equal(`/${index}`); expect(req.body[index].value.name).to.equal(variant); expect(req.body[index].value.weight).to.equal( - 1000 / variants.length + 1000 / variants.length, ); }); - } + }, ).as('variantCreation'); cy.get('[data-testid=ADD_VARIANT_BUTTON]').first().click(); @@ -314,7 +314,7 @@ export const addVariantsToFeature_UI = ( export const deleteVariant_UI = ( featureToggleName: string, variant: string, - projectName?: string + projectName?: string, ): Chainable => { const project = projectName || 'default'; cy.visit(`/projects/${project}/features/${featureToggleName}/variants`); @@ -325,13 +325,13 @@ export const deleteVariant_UI = ( cy.intercept( 'PATCH', `/api/admin/projects/${project}/features/${featureToggleName}/environments/development/variants`, - req => { + (req) => { expect(req.body[0].op).to.equal('remove'); expect(req.body[0].path).to.equal('/1'); expect(req.body[1].op).to.equal('replace'); expect(req.body[1].path).to.equal('/0/weight'); expect(req.body[1].value).to.equal(1000); - } + }, ).as('delete'); cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click(); diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index a726f5092621..5f3e37f5b28c 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -47,14 +47,14 @@ Cypress.Commands.add('deleteVariant_UI', deleteVariant_UI); Cypress.Commands.add('addVariantsToFeature_UI', addVariantsToFeature_UI); Cypress.Commands.add( 'addUserIdStrategyToFeature_UI', - addUserIdStrategyToFeature_UI + addUserIdStrategyToFeature_UI, ); Cypress.Commands.add( 'addFlexibleRolloutStrategyToFeature_UI', - addFlexibleRolloutStrategyToFeature_UI + addFlexibleRolloutStrategyToFeature_UI, ); Cypress.Commands.add( 'updateFlexibleRolloutStrategy_UI', - updateFlexibleRolloutStrategy_UI + updateFlexibleRolloutStrategy_UI, ); Cypress.Commands.add('createEnvironment_API', createEnvironment_API); diff --git a/frontend/cypress/support/e2e.ts b/frontend/cypress/support/e2e.ts index f80f74f8e1f7..598ab5f0d7fe 100644 --- a/frontend/cypress/support/e2e.ts +++ b/frontend/cypress/support/e2e.ts @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import './commands'; // Alternatively you can use CommonJS syntax: -// require('./commands') \ No newline at end of file +// require('./commands') diff --git a/frontend/index.js b/frontend/index.js index 1eff7e695207..806b9296e7c3 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -5,5 +5,5 @@ const { version } = module.exports; module.exports = { publicFolder: path.join(__dirname, 'build'), - version + version, }; diff --git a/frontend/package.json b/frontend/package.json index 8c33c0fa77ef..05c060243f2a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -2,10 +2,7 @@ "name": "unleash-frontend-local", "version": "0.0.0", "private": true, - "files": [ - "index.js", - "build" - ], + "files": ["index.js", "build"], "engines": { "node": ">=18" }, @@ -21,10 +18,10 @@ "test": "tsc && NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest run", "test:snapshot": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn test -u", "test:watch": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" vitest watch", - "lint": "eslint --fix ./src", - "lint:check": "eslint ./src", - "fmt": "prettier src --write --loglevel warn", - "fmt:check": "prettier src --check", + "lint": "biome lint src --apply", + "lint:check": "biome lint src", + "fmt": "biome format src --write", + "fmt:check": "biome format src", "ts:check": "tsc", "e2e": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", "e2e:heroku": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn run cypress open --config baseUrl='https://unleash.herokuapp.com' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", @@ -33,6 +30,7 @@ "gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api" }, "devDependencies": { + "@biomejs/biome": "^1.2.2", "@codemirror/lang-json": "6.0.1", "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", @@ -75,8 +73,6 @@ "debounce": "1.2.1", "deep-diff": "1.0.2", "dequal": "2.0.3", - "eslint": "8.50.0", - "eslint-config-react-app": "7.0.1", "fast-json-patch": "3.1.1", "http-proxy-middleware": "2.0.6", "immer": "9.0.21", @@ -88,7 +84,6 @@ "msw": "0.49.3", "pkginfo": "0.4.1", "plausible-tracker": "0.3.8", - "prettier": "2.8.1", "prop-types": "15.8.1", "react": "17.0.2", "react-chartjs-2": "4.3.1", @@ -136,34 +131,12 @@ } }, "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], + "production": [">0.2%", "not dead", "not op_mini all"], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ], - "parserOptions": { - "warnOnUnsupportedTypeScriptVersion": false - }, - "rules": { - "no-restricted-globals": "off", - "no-useless-computed-key": "off", - "import/no-anonymous-default-export": "off", - "react-hooks/exhaustive-deps": "off" - }, - "ignorePatterns": [ - "cypress" - ] - }, "dependencies": {} } diff --git a/frontend/src/component/App.tsx b/frontend/src/component/App.tsx index 65a50202c218..ab799a9467c4 100644 --- a/frontend/src/component/App.tsx +++ b/frontend/src/component/App.tsx @@ -1,7 +1,7 @@ import { Suspense, useEffect } from 'react'; import { Route, Routes } from 'react-router-dom'; import { ErrorBoundary } from 'react-error-boundary'; -import { Error } from 'component/layout/Error/Error'; +import { Error as LayoutError } from 'component/layout/Error/Error'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { FeedbackNPS } from 'component/feedback/FeedbackNPS/FeedbackNPS'; import { LayoutPicker } from 'component/layout/LayoutPicker/LayoutPicker'; @@ -37,7 +37,7 @@ export const App = () => { const { isOss, uiConfig } = useUiConfig(); const availableRoutes = isOss() - ? routes.filter(route => !route.enterprise) + ? routes.filter((route) => !route.enterprise) : routes; useEffect(() => { @@ -47,9 +47,9 @@ export const App = () => { }, [authDetails, user]); return ( - + - + }> { <> } /> - {availableRoutes.map(route => ( - - ( + - - } - /> - ))} + > + + + } + /> + ), + )} } /> } /> - + diff --git a/frontend/src/component/admin/Admin.tsx b/frontend/src/component/admin/Admin.tsx index 50be47aa0b31..2a7cdc8eec00 100644 --- a/frontend/src/component/admin/Admin.tsx +++ b/frontend/src/component/admin/Admin.tsx @@ -25,26 +25,26 @@ export const Admin = () => { } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> } /> - } /> - } /> - } /> + } /> + } /> + } /> ); diff --git a/frontend/src/component/admin/AdminIndex.tsx b/frontend/src/component/admin/AdminIndex.tsx index 8ed728b61dbd..46d49b5818ec 100644 --- a/frontend/src/component/admin/AdminIndex.tsx +++ b/frontend/src/component/admin/AdminIndex.tsx @@ -10,35 +10,42 @@ import { useAdminRoutes } from './useAdminRoutes'; export const AdminIndex: VFC = () => { const adminRoutes = useAdminRoutes(); - const routeGroups = adminRoutes.reduce((acc, route) => { - const group = route.group || 'other'; + const routeGroups = adminRoutes.reduce( + (acc, route) => { + const group = route.group || 'other'; - const index = acc.findIndex(item => item.name === group); - if (index === -1) { - acc.push({ - name: group, - description: adminGroups[group] || 'Other', - items: [route], - }); + const index = acc.findIndex((item) => item.name === group); + if (index === -1) { + acc.push({ + name: group, + description: adminGroups[group] || 'Other', + items: [route], + }); - return acc; - } + return acc; + } - acc[index].items.push(route); + acc[index].items.push(route); - return acc; - }, [] as Array<{ name: string; description: string; items: INavigationMenuItem[] }>); + return acc; + }, + [] as Array<{ + name: string; + description: string; + items: INavigationMenuItem[]; + }>, + ); return ( - }> - {routeGroups.map(group => ( + }> + {routeGroups.map((group) => ( ({ marginBottom: theme.spacing(2) })} + sx={(theme) => ({ marginBottom: theme.spacing(2) })} > - {group.description} + {group.description}
    - {group.items.map(route => ( + {group.items.map((route) => (
  • {route.title} diff --git a/frontend/src/component/admin/AdminRedirect.tsx b/frontend/src/component/admin/AdminRedirect.tsx index 9ceaa4bdde18..71b406d7a55c 100644 --- a/frontend/src/component/admin/AdminRedirect.tsx +++ b/frontend/src/component/admin/AdminRedirect.tsx @@ -1,3 +1,3 @@ import { Navigate } from 'react-router-dom'; -export const AdminRedirect = () => ; +export const AdminRedirect = () => ; diff --git a/frontend/src/component/admin/apiToken/ApiTokenDocs/ApiTokenDocs.tsx b/frontend/src/component/admin/apiToken/ApiTokenDocs/ApiTokenDocs.tsx index 8ba756a7c9a8..a6b94e2550d1 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenDocs/ApiTokenDocs.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenDocs/ApiTokenDocs.tsx @@ -5,13 +5,13 @@ export const ApiTokenDocs = () => { const { uiConfig } = useUiConfig(); return ( - +

    Read the{' '} SDK overview {' '} diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx index 567e4f71b025..21c2ccb7e7a2 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ApiTokenForm.tsx @@ -26,9 +26,9 @@ const ApiTokenForm: React.FC = ({ + Please be aware of our{' '} - + fair use policy . diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/EnvironmentSelector/EnvironmentSelector.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/EnvironmentSelector/EnvironmentSelector.tsx index f77a6048e168..c0186e20ea89 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/EnvironmentSelector/EnvironmentSelector.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/EnvironmentSelector/EnvironmentSelector.tsx @@ -21,10 +21,10 @@ export const EnvironmentSelector = ({ const selectableEnvs = type === TokenType.ADMIN ? [{ key: '*', label: 'ALL' }] - : environments.map(environment => ({ + : environments.map((environment) => ({ key: environment.name, label: `${environment.name.concat( - !environment.enabled ? ' - deprecated' : '' + !environment.enabled ? ' - deprecated' : '', )}`, title: environment.name, disabled: false, @@ -40,9 +40,9 @@ export const EnvironmentSelector = ({ options={selectableEnvs} value={environment} onChange={setEnvironment} - label="Environment" - id="api_key_environment" - name="environment" + label='Environment' + id='api_key_environment' + name='environment' IconComponent={KeyboardArrowDownOutlined} fullWidth /> diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/ProjectSelector.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/ProjectSelector.tsx index 18162609fd4f..4838325ba042 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/ProjectSelector.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/ProjectSelector.tsx @@ -23,7 +23,7 @@ export const ProjectSelector = ({ const projectId = useOptionalPathParam('projectId'); const { projects: availableProjects } = useProjects(); - const selectableProjects = availableProjects.map(project => ({ + const selectableProjects = availableProjects.map((project) => ({ value: project.id, label: project.name, })); diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectAllButton/SelectAllButton.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectAllButton/SelectAllButton.tsx index 7e7b4ee8188e..755a2457bff4 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectAllButton/SelectAllButton.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectAllButton/SelectAllButton.tsx @@ -17,7 +17,7 @@ export const SelectAllButton: FC = ({ }) => { return ( - + {isAllSelected ? 'Deselect all' : 'Select all'} diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.test.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.test.tsx index f013194bb550..2210259a5f3d 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.test.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.test.tsx @@ -36,7 +36,7 @@ describe('SelectProjectInput', () => { render(); const checkbox = screen.getByLabelText( - /all current and future projects/i + /all current and future projects/i, ); expect(checkbox).toBeChecked(); @@ -52,7 +52,7 @@ describe('SelectProjectInput', () => { await user.click(screen.getByTestId('select-all-projects')); expect( - screen.getByLabelText(/all current and future projects/i) + screen.getByLabelText(/all current and future projects/i), ).not.toBeChecked(); expect(screen.getByLabelText('Projects')).toBeEnabled(); @@ -60,7 +60,7 @@ describe('SelectProjectInput', () => { await user.click(screen.getByTestId('select-all-projects')); expect( - screen.getByLabelText(/all current and future projects/i) + screen.getByLabelText(/all current and future projects/i), ).toBeChecked(); expect(screen.getByLabelText('Projects')).toBeDisabled(); @@ -68,11 +68,11 @@ describe('SelectProjectInput', () => { it('renders with autocomplete enabled if default value is not a wildcard', () => { render( - + , ); const checkbox = screen.getByLabelText( - /all current and future projects/i + /all current and future projects/i, ); expect(checkbox).not.toBeChecked(); @@ -117,7 +117,7 @@ describe('SelectProjectInput', () => { { label: 'Project1', value: 'project1' }, { label: 'Project2', value: 'project2' }, ]} - /> + />, ); await user.click(screen.getByLabelText('Projects')); @@ -140,7 +140,7 @@ describe('SelectProjectInput', () => { { label: 'Charlie', value: 'charlie' }, { label: 'Alpaca', value: 'alpaca' }, ]} - /> + />, ); const input = await screen.findByLabelText('Projects'); await user.type(input, 'alp'); diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.tsx index 62c10564fa93..8c48b76248ae 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/ProjectSelector/SelectProjectInput/SelectProjectInput.tsx @@ -48,10 +48,10 @@ export const SelectProjectInput: VFC = ({ onFocus, }) => { const [projects, setProjects] = useState( - typeof defaultValue === 'string' ? [defaultValue] : defaultValue + typeof defaultValue === 'string' ? [defaultValue] : defaultValue, ); const [isWildcardSelected, selectWildcard] = useState( - typeof defaultValue === 'string' || defaultValue.includes(ALL_PROJECTS) + typeof defaultValue === 'string' || defaultValue.includes(ALL_PROJECTS), ); const isAllSelected = projects.length > 0 && @@ -60,7 +60,7 @@ export const SelectProjectInput: VFC = ({ const onAllProjectsChange = ( e: ChangeEvent, - checked: boolean + checked: boolean, ) => { if (checked) { selectWildcard(true); @@ -82,12 +82,12 @@ export const SelectProjectInput: VFC = ({ const renderOption = ( props: object, option: IAutocompleteBoxOption, - { selected }: AutocompleteRenderOptionState + { selected }: AutocompleteRenderOptionState, ) => (

  • } - checkedIcon={} + icon={} + checkedIcon={} checked={selected} /> {option.label} @@ -114,11 +114,11 @@ export const SelectProjectInput: VFC = ({ {...params} error={Boolean(error)} helperText={error} - variant="outlined" - label="Projects" - placeholder="Select one or more projects" + variant='outlined' + label='Projects' + placeholder='Select one or more projects' onFocus={onFocus} - data-testid="select-input" + data-testid='select-input' /> ); @@ -127,14 +127,14 @@ export const SelectProjectInput: VFC = ({ } - label="ALL current and future projects" + label='ALL current and future projects' /> = ({ value={ isWildcardSelected || disabled ? options - : options.filter(option => - projects.includes(option.value) + : options.filter((option) => + projects.includes(option.value), ) } onChange={(_, input) => { diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/TokenInfo/TokenInfo.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/TokenInfo/TokenInfo.tsx index 86fbd6546eb1..0625f7dcf5c2 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/TokenInfo/TokenInfo.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/TokenInfo/TokenInfo.tsx @@ -22,9 +22,9 @@ export const TokenInfo = ({ setUsername(e.target.value)} - label="Token name" + name='username' + onChange={(e) => setUsername(e.target.value)} + label='Token name' error={errors.username !== undefined} errorText={errors.username} onFocus={() => clearErrors('username')} diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/TokenTypeSelector/TokenTypeSelector.tsx b/frontend/src/component/admin/apiToken/ApiTokenForm/TokenTypeSelector/TokenTypeSelector.tsx index 27553d19aa09..192b2208315e 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/TokenTypeSelector/TokenTypeSelector.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/TokenTypeSelector/TokenTypeSelector.tsx @@ -29,13 +29,13 @@ export const TokenTypeSelector = ({ return ( - + What do you want to connect? setType(value as TokenType)} > @@ -59,8 +59,8 @@ export const TokenTypeSelector = ({ {label} {title} @@ -68,7 +68,7 @@ export const TokenTypeSelector = ({ } /> - ) + ), )} diff --git a/frontend/src/component/admin/apiToken/ApiTokenForm/useApiTokenForm.ts b/frontend/src/component/admin/apiToken/ApiTokenForm/useApiTokenForm.ts index 71422f61a30a..7295120c1db9 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenForm/useApiTokenForm.ts +++ b/frontend/src/component/admin/apiToken/ApiTokenForm/useApiTokenForm.ts @@ -16,12 +16,12 @@ export type ApiTokenFormErrorType = 'username' | 'projects'; export const useApiTokenForm = (project?: string) => { const { environments } = useEnvironments(); const { uiConfig } = useUiConfig(); - const initialEnvironment = environments?.find(e => e.enabled)?.name; + const initialEnvironment = environments?.find((e) => e.enabled)?.name; const hasCreateTokenPermission = useHasRootAccess(CREATE_CLIENT_API_TOKEN); const hasCreateProjectTokenPermission = useHasRootAccess( CREATE_PROJECT_API_TOKEN, - project + project, ); const apiTokenTypes: SelectOption[] = [ @@ -38,7 +38,7 @@ export const useApiTokenForm = (project?: string) => { const hasCreateFrontendAccess = useHasRootAccess(CREATE_FRONTEND_API_TOKEN); const hasCreateFrontendTokenAccess = useHasRootAccess( CREATE_PROJECT_API_TOKEN, - project + project, ); if (!project) { apiTokenTypes.push({ @@ -58,7 +58,7 @@ export const useApiTokenForm = (project?: string) => { }); } - const firstAccessibleType = apiTokenTypes.find(t => t.enabled)?.key; + const firstAccessibleType = apiTokenTypes.find((t) => t.enabled)?.key; const [username, setUsername] = useState(''); const [type, setType] = useState(firstAccessibleType || TokenType.CLIENT); @@ -99,10 +99,10 @@ export const useApiTokenForm = (project?: string) => { const isValid = () => { const newErrors: Partial> = {}; if (!username) { - newErrors['username'] = 'Username is required'; + newErrors.username = 'Username is required'; } if (projects.length === 0) { - newErrors['projects'] = 'At least one project is required'; + newErrors.projects = 'At least one project is required'; } setErrors(newErrors); diff --git a/frontend/src/component/admin/apiToken/ApiTokenPage/ApiTokenPage.tsx b/frontend/src/component/admin/apiToken/ApiTokenPage/ApiTokenPage.tsx index 94cd56b66fee..537da13f5aad 100644 --- a/frontend/src/component/admin/apiToken/ApiTokenPage/ApiTokenPage.tsx +++ b/frontend/src/component/admin/apiToken/ApiTokenPage/ApiTokenPage.tsx @@ -34,7 +34,7 @@ export const ApiTokenPage = () => { setGlobalFilter, setHiddenColumns, columns, - } = useApiTokenTable(tokens, props => { + } = useApiTokenTable(tokens, (props) => { const READ_PERMISSION = props.row.original.type === 'client' ? READ_CLIENT_API_TOKEN @@ -91,7 +91,7 @@ export const ApiTokenPage = () => { CREATE_CLIENT_API_TOKEN, ADMIN, ]} - path="/admin/api/create-token" + path='/admin/api/create-token' /> } diff --git a/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx b/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx index 333c7f6f0e13..8974757b13b1 100644 --- a/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx +++ b/frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx @@ -25,21 +25,21 @@ export const ConfirmToken = ({ open={open} setOpen={setOpen} onClick={closeConfirm} - primaryButtonText="Close" - title="New token created" + primaryButtonText='Close' + title='New token created' > - + Your new token has been created successfully. + By default, all {TokenType.FRONTEND} tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the{' '} - + CORS origins configuration page . diff --git a/frontend/src/component/admin/apiToken/ConfirmToken/UserToken/UserToken.tsx b/frontend/src/component/admin/apiToken/ConfirmToken/UserToken/UserToken.tsx index 4a048cf84df4..edc4f66e9074 100644 --- a/frontend/src/component/admin/apiToken/ConfirmToken/UserToken/UserToken.tsx +++ b/frontend/src/component/admin/apiToken/ConfirmToken/UserToken/UserToken.tsx @@ -25,7 +25,7 @@ export const UserToken = ({ token }: IUserTokenProps) => { return ( ({ + sx={(theme) => ({ backgroundColor: theme.palette.background.elevation2, padding: theme.spacing(4), borderRadius: `${theme.shape.borderRadius}px`, @@ -37,8 +37,8 @@ export const UserToken = ({ token }: IUserTokenProps) => { })} > {token} - - + + diff --git a/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx b/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx index 37b11cb92798..236d6a0ca21a 100644 --- a/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx +++ b/frontend/src/component/admin/apiToken/CreateApiToken/CreateApiToken.tsx @@ -66,8 +66,8 @@ export const CreateApiToken = ({ modal = false }: ICreateApiTokenProps) => { const payload = getApiTokenPayload(); await createToken(payload) - .then(res => res.json()) - .then(api => { + .then((res) => res.json()) + .then((api) => { scrollToTop(); setToken(api.secret); setShowConfirm(true); @@ -84,9 +84,7 @@ export const CreateApiToken = ({ modal = false }: ICreateApiTokenProps) => { }; const formatApiCode = () => { - return `curl --location --request POST '${ - uiConfig.unleashUrl - }/${PATH}' \\ + return `curl --location --request POST '${uiConfig.unleashUrl}/${PATH}' \\ --header 'Authorization: INSERT_API_KEY' \\ --header 'Content-Type: application/json' \\ --data-raw '${JSON.stringify(getApiTokenPayload(), undefined, 2)}'`; @@ -102,17 +100,17 @@ export const CreateApiToken = ({ modal = false }: ICreateApiTokenProps) => { title={pageTitle} modal={modal} description="Unleash SDKs use API tokens to authenticate to the Unleash API. Client SDKs need a token with 'client privileges', which allows them to fetch feature toggle configurations and post usage metrics." - documentationLink="https://docs.getunleash.io/reference/api-tokens-and-client-keys" - documentationLinkLabel="API tokens documentation" + documentationLink='https://docs.getunleash.io/reference/api-tokens-and-client-keys' + documentationLinkLabel='API tokens documentation' formatApiCode={formatApiCode} > { it('should prioritize new "projects" array over deprecated "project"', async () => { render( + />, ); const links = await screen.findAllByRole('link'); @@ -21,7 +21,7 @@ describe('ProjectsList', () => { }); it('should render correctly with single "project"', async () => { - render(); + render(); const links = await screen.findAllByRole('link'); expect(links).toHaveLength(1); diff --git a/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx b/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx index 16351698e5b9..40abec227076 100644 --- a/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx +++ b/frontend/src/component/admin/apiToken/ProjectsList/ProjectsList.tsx @@ -23,7 +23,7 @@ export const ProjectsList: VFC = ({ project, }) => { const { searchQuery } = useSearchHighlightContext(); - let fields: string[] = + const fields: string[] = projects && Array.isArray(projects) ? projects : project diff --git a/frontend/src/component/admin/auth/AuthSettings.tsx b/frontend/src/component/admin/auth/AuthSettings.tsx index 2f14b9e50195..7cc9f247bc9f 100644 --- a/frontend/src/component/admin/auth/AuthSettings.tsx +++ b/frontend/src/component/admin/auth/AuthSettings.tsx @@ -34,7 +34,7 @@ export const AuthSettings = () => { component: , }, ].filter( - item => uiConfig.flags?.googleAuthEnabled || item.label !== 'Google' + (item) => uiConfig.flags?.googleAuthEnabled || item.label !== 'Google', ); const [activeTab, setActiveTab] = useState(0); @@ -52,8 +52,8 @@ export const AuthSettings = () => { onChange={(_, tabId) => { setActiveTab(tabId); }} - indicatorColor="primary" - textColor="primary" + indicatorColor='primary' + textColor='primary' > {tabs.map((tab, index) => ( { > } + show={} /> + You are running Unleash in demo mode. You have to use the Enterprise edition in order configure Single Sign-on. @@ -90,7 +90,7 @@ export const AuthSettings = () => { + You have decided to use custom authentication type. You have to use the Enterprise edition in order configure Single Sign-on from the user @@ -101,7 +101,7 @@ export const AuthSettings = () => { + Your Unleash instance is managed by the Unleash team. @@ -113,6 +113,7 @@ export const AuthSettings = () => {
    {tabs.map((tab, index) => ( key={index} value={activeTab} index={index} diff --git a/frontend/src/component/admin/auth/AutoCreateForm/AutoCreateForm.tsx b/frontend/src/component/admin/auth/AutoCreateForm/AutoCreateForm.tsx index bc89340ad64e..a8c9f12cd71a 100644 --- a/frontend/src/component/admin/auth/AutoCreateForm/AutoCreateForm.tsx +++ b/frontend/src/component/admin/auth/AutoCreateForm/AutoCreateForm.tsx @@ -51,12 +51,12 @@ export const AutoCreateForm = ({ control={ } - label="Auto-create users" + label='Auto-create users' /> @@ -70,22 +70,22 @@ export const AutoCreateForm = ({ - + Default Role @@ -101,16 +101,16 @@ export const AutoCreateForm = ({ diff --git a/frontend/src/component/admin/auth/GoogleAuth/GoogleAuth.tsx b/frontend/src/component/admin/auth/GoogleAuth/GoogleAuth.tsx index d871b6f2effe..931392ec88cc 100644 --- a/frontend/src/component/admin/auth/GoogleAuth/GoogleAuth.tsx +++ b/frontend/src/component/admin/auth/GoogleAuth/GoogleAuth.tsx @@ -69,17 +69,17 @@ export const GoogleAuth = () => { return ( <> - + This integration is deprecated and will be removed in next major version. Please use OpenID Connect to enable Google SSO. - + Read the{' '} documentation {' '} @@ -103,7 +103,7 @@ export const GoogleAuth = () => { } @@ -122,13 +122,13 @@ export const GoogleAuth = () => { @@ -144,13 +144,13 @@ export const GoogleAuth = () => { @@ -172,13 +172,13 @@ export const GoogleAuth = () => { @@ -193,7 +193,7 @@ export const GoogleAuth = () => { @@ -209,24 +209,24 @@ export const GoogleAuth = () => { @@ -304,13 +302,13 @@ export const IntegrationForm: VFC = ({ )} />
    @@ -377,9 +375,9 @@ export const IntegrationForm: VFC = ({ options={selectableProjects} selectedItems={formValues.projects || []} onChange={setProjects} - entityName="project" - description="Selecting project(s) will filter events, so that your integration only receives events related to those specific projects." - note="If no projects are selected, the integration will receive events from all projects." + entityName='project' + description='Selecting project(s) will filter events, so that your integration only receives events related to those specific projects.' + note='If no projects are selected, the integration will receive events from all projects.' />
    @@ -387,9 +385,9 @@ export const IntegrationForm: VFC = ({ options={selectableEnvironments} selectedItems={formValues.environments || []} onChange={setEnvironments} - entityName="environment" - description="Selecting environment(s) will filter events, so that your integration only receives events related to those specific environments. Global events that are not specific to an environment will still be received." - note="If no environments are selected, the integration will receive events from all environments." + entityName='environment' + description='Selecting environment(s) will filter events, so that your integration only receives events related to those specific environments. Global events that are not specific to an environment will still be received.' + note='If no environments are selected, the integration will receive events from all environments.' />
    diff --git a/frontend/src/component/integrations/IntegrationForm/IntegrationInstall/IntegrationInstall.tsx b/frontend/src/component/integrations/IntegrationForm/IntegrationInstall/IntegrationInstall.tsx index 3912a85b4605..47039e84c07f 100644 --- a/frontend/src/component/integrations/IntegrationForm/IntegrationInstall/IntegrationInstall.tsx +++ b/frontend/src/component/integrations/IntegrationForm/IntegrationInstall/IntegrationInstall.tsx @@ -28,11 +28,11 @@ export const IntegrationInstall = ({
    + )} /> @@ -54,7 +54,7 @@ test('should fetch initial form data from local storage', async () => { expect(screen.getByText('Unleash playground')).toBeInTheDocument(); expect(screen.getByText('["projectA","projectB"]')).toBeInTheDocument(); expect( - screen.getByText('["development","production"]') + screen.getByText('["development","production"]'), ).toBeInTheDocument(); expect(screen.getByText('{"userId":"1"}')).toBeInTheDocument(); }); @@ -88,7 +88,7 @@ test('should display error on submit', async () => { details: [{ message: 'some error about too many items' }], }, 'post', - 400 + 400, ); render(testEvaluateComponent); diff --git a/frontend/src/component/playground/Playground/AdvancedPlayground.tsx b/frontend/src/component/playground/Playground/AdvancedPlayground.tsx index e6649c68c667..6bb35573655d 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlayground.tsx +++ b/frontend/src/component/playground/Playground/AdvancedPlayground.tsx @@ -37,7 +37,7 @@ export const AdvancedPlayground: VFC<{ } = { projects: [], environments: [] }; const { value, setValue } = createLocalStorage( 'AdvancedPlayground:v1', - defaultSettings + defaultSettings, ); const { environments: availableEnvironments } = useEnvironments(); @@ -46,7 +46,7 @@ export const AdvancedPlayground: VFC<{ const [configurationError, setConfigurationError] = useState(); const [environments, setEnvironments] = useState( - value.environments + value.environments, ); const [projects, setProjects] = useState(value.projects); const [context, setContext] = useState(value.context); @@ -81,7 +81,7 @@ export const AdvancedPlayground: VFC<{ await evaluatePlaygroundContext( environments || [], projects || '*', - context + context, ); } }; @@ -91,7 +91,7 @@ export const AdvancedPlayground: VFC<{ setToastData({ type: 'error', title: `Failed to parse URL parameters: ${formatUnknownError( - error + error, )}`, }); } @@ -108,7 +108,7 @@ export const AdvancedPlayground: VFC<{ }; const resolveProjectsFromUrl = (): string[] | null => { let projectsArray: string[] | null = null; - let projectsFromUrl = searchParams.get('projects'); + const projectsFromUrl = searchParams.get('projects'); if (projectsFromUrl) { projectsArray = projectsFromUrl.split(','); setProjects(projectsArray); @@ -128,7 +128,7 @@ export const AdvancedPlayground: VFC<{ environments: string[] | string, projects: string[] | string, context: string | undefined, - action?: () => void + action?: () => void, ) => { try { setConfigurationError(undefined); @@ -153,7 +153,7 @@ export const AdvancedPlayground: VFC<{ setToastData({ type: 'error', title: `Error parsing context: ${formatUnknownError( - error + error, )}`, }); } else { @@ -165,7 +165,7 @@ export const AdvancedPlayground: VFC<{ } }; - const onSubmit: FormEventHandler = async event => { + const onSubmit: FormEventHandler = async (event) => { event.preventDefault(); setHasFormBeenSubmitted(true); @@ -210,7 +210,7 @@ export const AdvancedPlayground: VFC<{ } /> } @@ -255,7 +255,7 @@ export const AdvancedPlayground: VFC<{ ({ + sx={(theme) => ({ width: resultsWidth, transition: 'width 0.4s ease', padding: theme.spacing(4, 4), @@ -264,7 +264,7 @@ export const AdvancedPlayground: VFC<{ + {configurationError} } @@ -289,8 +289,7 @@ export const AdvancedPlayground: VFC<{ /> } /> diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentCell.tsx b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentCell.tsx index 605f4eed8672..cb08adfb952b 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentCell.tsx +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentCell.tsx @@ -16,7 +16,7 @@ import { PlaygroundEnvironmentTable } from '../../PlaygroundEnvironmentTable/Pla const StyledContainer = styled( 'div', - {} + {}, )(({ theme }) => ({ flexGrow: 0, ...flexRow, @@ -47,8 +47,10 @@ export const AdvancedPlaygroundEnvironmentCell = ({ const open = Boolean(anchor); - const enabled = (value || []).filter(evaluation => evaluation.isEnabled); - const disabled = (value || []).filter(evaluation => !evaluation.isEnabled); + const enabled = (value || []).filter((evaluation) => evaluation.isEnabled); + const disabled = (value || []).filter( + (evaluation) => !evaluation.isEnabled, + ); return ( @@ -95,7 +97,7 @@ export const AdvancedPlaygroundEnvironmentCell = ({ horizontal: -320, }} > - + {value[0].environment} diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentDiffCell.tsx b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentDiffCell.tsx index d650abfc5a72..32ffd4e006a6 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentDiffCell.tsx +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundEnvironmentCell/AdvancedPlaygroundEnvironmentDiffCell.tsx @@ -6,7 +6,7 @@ import { PlaygroundEnvironmentDiffTable } from '../../PlaygroundEnvironmentTable const StyledContainer = styled( 'div', - {} + {}, )(({ theme }) => ({ flexGrow: 0, ...flexRow, @@ -64,7 +64,7 @@ export const AdvancedPlaygroundEnvironmentDiffCell = ({ horizontal: -320, }} > - + Environments diff diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx index 42e76372d386..90ca2b564d10 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx @@ -103,7 +103,7 @@ test('should render advanced playground table', async () => { }, }} /> - + , ); expect(screen.getByText('Infinite')).toBeInTheDocument(); diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.tsx b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.tsx index 9aafa8d5370d..0772a120f59a 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.tsx +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.tsx @@ -35,7 +35,7 @@ import { countCombinations } from './combinationCounter'; const defaultSort: SortingRule = { id: 'name' }; const { value, setValue } = createLocalStorage( 'AdvancedPlaygroundResultsTable:v1', - defaultSort + defaultSort, ); interface IAdvancedPlaygroundResultsTableProps { @@ -62,7 +62,7 @@ export const AdvancedPlaygroundResultsTable = ({ const [searchParams, setSearchParams] = useSearchParams(); const ref = useLoading(loading); const [searchValue, setSearchValue] = useState( - searchParams.get('search') || '' + searchParams.get('search') || '', ); const theme = useTheme(); const isSmallScreen = useMediaQuery(theme.breakpoints.down('md')); @@ -186,7 +186,7 @@ export const AdvancedPlaygroundResultsTable = ({ }, useGlobalFilter, useFlexLayout, - useSortBy + useSortBy, ); useConditionallyHiddenColumns( @@ -197,7 +197,7 @@ export const AdvancedPlaygroundResultsTable = ({ }, ], setHiddenColumns, - COLUMNS + COLUMNS, ); useEffect(() => { @@ -235,7 +235,7 @@ export const AdvancedPlaygroundResultsTable = ({ mb: 3, }} > - + {features !== undefined && !loading ? `Results (${ rows.length < data.length diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.test.ts b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.test.ts index 5214acad7f4a..86f653a9827b 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.test.ts +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.test.ts @@ -7,7 +7,7 @@ import { import cartesian from 'cartesian'; const generateFeature = ( - context: Record + context: Record, ): AdvancedPlaygroundEnvironmentFeatureSchema => ({ isEnabled: false, isEnabledInCurrentEnvironment: true, @@ -56,7 +56,7 @@ const generateFeature = ( const generateInput = ( featureCount: number, environments: string[], - contextValues: { [key: string]: string[] } + contextValues: { [key: string]: string[] }, ): AdvancedPlaygroundFeatureSchema[] => { const cartesianContext = cartesian(contextValues); @@ -64,10 +64,10 @@ const generateInput = ( name: `feature-${i}`, projectId: 'default', environments: Object.fromEntries( - environments.map(env => [ + environments.map((env) => [ env, cartesianContext.map(generateFeature), - ]) + ]), ), })); }; @@ -76,13 +76,13 @@ it('counts the correct number of combinations', () => { const assertCount = ( numberOfFeatures: number, envs: string[], - context: { [k: string]: string[] } + context: { [k: string]: string[] }, ) => { const totalCombinations = numberOfFeatures * envs.length * Object.values(context) - .map(contextValues => contextValues.length) + .map((contextValues) => contextValues.length) .reduce((total, n) => total + n); const input = generateInput(numberOfFeatures, envs, context); expect(countCombinations(input)).toEqual(totalCombinations); diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.ts b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.ts index 6608f7d20ba4..70b2412cba4d 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.ts +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/combinationCounter.ts @@ -1,12 +1,13 @@ import { AdvancedPlaygroundFeatureSchema } from 'openapi'; export const countCombinations = ( - features: AdvancedPlaygroundFeatureSchema[] + features: AdvancedPlaygroundFeatureSchema[], ) => features.reduce( (total, feature) => total + - Object.values(feature.environments).flatMap(env => Object.keys(env)) - .length, - 0 + Object.values(feature.environments).flatMap((env) => + Object.keys(env), + ).length, + 0, ); diff --git a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx index 48f1726eac1a..7e90c4de88da 100644 --- a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.test.tsx @@ -54,7 +54,7 @@ test('should render environment diff table', async () => { ], }} /> - + , ); expect(screen.getByText('web')).toBeInTheDocument(); diff --git a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.tsx b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.tsx index bd53c46fb648..1b85b42200cc 100644 --- a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentDiffTable.tsx @@ -30,25 +30,25 @@ export const PlaygroundEnvironmentDiffTable = ({ () => firstEnvFeatures.map((item, index) => ({ ...Object.fromEntries( - environments.map(env => [env, features[env][index]]) + environments.map((env) => [env, features[env][index]]), ), })), - [JSON.stringify(features)] + [JSON.stringify(features)], ); type RowType = typeof data[0]; const contextFieldsHeaders = Object.keys(firstContext).map( - contextField => ({ + (contextField) => ({ Header: capitalizeFirst(contextField), accessor: ( - row: Record }> - ) => row[environments[0]]['context'][contextField], + row: Record }>, + ) => row[environments[0]].context[contextField], minWidth: 160, Cell: HighlightCell, - }) + }), ); - const environmentHeaders = environments.map(environment => ({ + const environmentHeaders = environments.map((environment) => ({ Header: environment, accessor: (row: RowType) => row[environment]?.isEnabled @@ -91,7 +91,7 @@ export const PlaygroundEnvironmentDiffTable = ({ }, useGlobalFilter, useFlexLayout, - useSortBy + useSortBy, ); const parentRef = useRef(null); diff --git a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx index 3b6c9a1ac701..22e0c992d339 100644 --- a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.test.tsx @@ -35,7 +35,7 @@ test('should render environment table', async () => { }, ]} /> - + , ); expect(screen.getByText('web')).toBeInTheDocument(); diff --git a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.tsx b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.tsx index b508ad17a465..da75b9e02c85 100644 --- a/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundEnvironmentTable/PlaygroundEnvironmentTable.tsx @@ -31,13 +31,13 @@ export const PlaygroundEnvironmentTable = ({ const isExtraSmallScreen = useMediaQuery(theme.breakpoints.down('sm')); const dynamicHeaders = Object.keys(features[0].context).map( - contextField => ({ + (contextField) => ({ Header: capitalizeFirst(contextField), accessor: (row: { context: Record }) => - row['context'][contextField], + row.context[contextField], minWidth: 160, Cell: HighlightCell, - }) + }), ); const COLUMNS = useMemo(() => { @@ -111,7 +111,7 @@ export const PlaygroundEnvironmentTable = ({ }, useGlobalFilter, useFlexLayout, - useSortBy + useSortBy, ); useConditionallyHiddenColumns( @@ -122,7 +122,7 @@ export const PlaygroundEnvironmentTable = ({ }, ], setHiddenColumns, - COLUMNS + COLUMNS, ); const parentRef = useRef(null); diff --git a/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundCodeFieldset/PlaygroundCodeFieldset.tsx b/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundCodeFieldset/PlaygroundCodeFieldset.tsx index dc42aba0233a..78f6a784ba36 100644 --- a/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundCodeFieldset/PlaygroundCodeFieldset.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundCodeFieldset/PlaygroundCodeFieldset.tsx @@ -64,7 +64,7 @@ export const PlaygroundCodeFieldset: VFC = ({ setFieldExist( contextValue[contextField] !== undefined || contextValue?.properties?.[contextField] !== - undefined + undefined, ); } catch (error: unknown) { return setError(formatUnknownError(error)); @@ -72,7 +72,7 @@ export const PlaygroundCodeFieldset: VFC = ({ return setError(undefined); }, 250), - [setError, contextField, setFieldExist] + [setError, contextField, setFieldExist], ); useEffect(() => { @@ -90,12 +90,12 @@ export const PlaygroundCodeFieldset: VFC = ({ [contextField]: contextValue, }), null, - 2 - ) + 2, + ), ); const foundContext = contextData.find( - context => context.name === contextField + (context) => context.name === contextField, ); if ( @@ -115,7 +115,7 @@ export const PlaygroundCodeFieldset: VFC = ({ const changeContextValue = ( e: FormEvent, - newValue: string | (string | string[])[] | null + newValue: string | (string | string[])[] | null, ) => { if (!isStringOrStringArray(newValue)) return; @@ -137,7 +137,7 @@ export const PlaygroundCodeFieldset: VFC = ({ // Split comma separated strings to array for fields with legal values const foundField = contextData.find( - contextData => contextData.name === contextField + (contextData) => contextData.name === contextField, ); const hasLegalValues = (foundField?.legalValues || []).length > 1; if (contextValue.includes(',') && hasLegalValues) { @@ -158,13 +158,13 @@ export const PlaygroundCodeFieldset: VFC = ({ return ( { + onChange={(e) => { const parsedDate = parseValidDate(e.target.value); const dateString = parsedDate?.toISOString(); dateString && setContextValue(dateString); @@ -177,29 +177,25 @@ export const PlaygroundCodeFieldset: VFC = ({ ); } const foundField = contextData.find( - contextData => contextData.name === contextField + (contextData) => contextData.name === contextField, ); - if ( - foundField && - foundField.legalValues && - foundField.legalValues.length > 0 - ) { + if (foundField?.legalValues && foundField.legalValues.length > 0) { const options = foundField.legalValues.map(({ value }) => value); return ( ( - + )} disableCloseOnSelect={false} /> @@ -208,13 +204,13 @@ export const PlaygroundCodeFieldset: VFC = ({ return ( setContextValue(event.target.value || '')} + onChange={(event) => setContextValue(event.target.value || '')} /> ); }; @@ -233,7 +229,7 @@ export const PlaygroundCodeFieldset: VFC = ({ @@ -243,20 +239,20 @@ export const PlaygroundCodeFieldset: VFC = ({ - + Context field { }, }} > - {possibleLocales.map(locale => { + {possibleLocales.map((locale) => { return ( securing Unleash on GitHub @@ -57,13 +57,13 @@ const SimpleAuth: VFC = ({ authDetails, redirect }) => { value={email} onChange={handleChange} inputProps={{ 'data-testid': 'email-input-field' }} - size="small" - variant="outlined" - label="Email" - name="email" - id="email" + size='small' + variant='outlined' + label='Email' + name='email' + id='email' required - type="email" + type='email' data-testid={LOGIN_EMAIL_ID} autoFocus /> @@ -71,9 +71,9 @@ const SimpleAuth: VFC = ({ authDetails, redirect }) => {
    @@ -48,7 +48,7 @@ const InvalidToken: VFC = () => { + Provided invite link is invalid or expired. Please request a new URL in order to create your account. @@ -56,17 +56,17 @@ const InvalidToken: VFC = () => { } elseShow={ <> - + Your token has either been used to reset your password, or it has expired. Please request a new reset password URL in order to reset your password.