diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 757fd64caa..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "trailingComma": "es5" -} diff --git a/cypress/e2e/customTypes/01-duplicate.cy.js b/cypress/e2e/customTypes/01-duplicate.cy.js index e2dfa4c35b..0c3c788efa 100644 --- a/cypress/e2e/customTypes/01-duplicate.cy.js +++ b/cypress/e2e/customTypes/01-duplicate.cy.js @@ -19,7 +19,7 @@ describe.skip("Duplicate custom types", () => { cy.get("[type=submit]").should("be.disabled"); cy.get("[data-cy=ct-name-input-error]").contains( - "Custom type name is already taken." + "Custom type name is already taken.", ); }); @@ -34,7 +34,7 @@ describe.skip("Duplicate custom types", () => { cy.get("[type=submit]").should("be.disabled"); cy.get("[data-cy=ct-id-input-error]").contains( - `ID "${customTypeId}" exists already.` + `ID "${customTypeId}" exists already.`, ); }); }); diff --git a/cypress/e2e/slices/00-create.cy.js b/cypress/e2e/slices/00-create.cy.js index 4ad93c1394..2c4ae05ce0 100644 --- a/cypress/e2e/slices/00-create.cy.js +++ b/cypress/e2e/slices/00-create.cy.js @@ -45,25 +45,25 @@ describe("Create Slices", () => { cy.get("#simulator-button-tooltip").should("be.visible"); cy.get("#simulator-button-tooltip").should( "contain", - "Save your work in order to simulate" + "Save your work in order to simulate", ); cy.contains("button", "Update screenshot").should("have.attr", "disabled"); cy.contains("button", "Update screenshot").realHover(); cy.get("#update-screenshot-button-tooltip").should("be.visible"); cy.get("#update-screenshot-button-tooltip").should( "contain", - "Save your work in order to update the screenshot" + "Save your work in order to update the screenshot", ); cy.location("pathname", { timeout: 20000 }).should( "eq", - `/slices/${lib}/${sliceName}/bar` + `/slices/${lib}/${sliceName}/bar`, ); cy.get("button").contains("foo").click(); cy.contains("Default").click(); cy.location("pathname", { timeout: 20000 }).should( "eq", - `/slices/${lib}/${sliceName}/default` + `/slices/${lib}/${sliceName}/default`, ); cy.contains("Save").click(); @@ -71,7 +71,7 @@ describe("Create Slices", () => { cy.contains("button", "Simulate").should("not.have.attr", "disabled"); cy.contains("button", "Update screenshot").should( "not.have.attr", - "disabled" + "disabled", ); // simulator diff --git a/cypress/e2e/slices/01-duplicates.cy.js b/cypress/e2e/slices/01-duplicates.cy.js index 3e2862813c..39b105a1d9 100644 --- a/cypress/e2e/slices/01-duplicates.cy.js +++ b/cypress/e2e/slices/01-duplicates.cy.js @@ -19,7 +19,7 @@ describe("Duplicate Slices", () => { cy.get("input[data-cy=slice-name-input]").type(sliceName).blur(); cy.get("[type=submit]").should("be.disabled"); cy.get("[data-cy=slice-name-input-error]").contains( - "Slice name is already taken." + "Slice name is already taken.", ); }); }); diff --git a/cypress/e2e/slices/03-build-slices.cy.js b/cypress/e2e/slices/03-build-slices.cy.js index a9cb7cffc2..1f1e9f5e44 100644 --- a/cypress/e2e/slices/03-build-slices.cy.js +++ b/cypress/e2e/slices/03-build-slices.cy.js @@ -52,7 +52,7 @@ describe.skip("I am a new SM user (with Next) who wants to build a slice with di sliceBuilder.addNewWidgetField("SelectField", "Select"); sliceBuilder.addNewWidgetField( "ContentRelationshipField", - "Content Relationship" + "Content Relationship", ); sliceBuilder.openEditWidgetModal("SimpleTextField"); diff --git a/cypress/e2e/updates/changelog.cy.js b/cypress/e2e/updates/changelog.cy.js index c6ca895bce..f8b95cd3bb 100644 --- a/cypress/e2e/updates/changelog.cy.js +++ b/cypress/e2e/updates/changelog.cy.js @@ -29,7 +29,7 @@ describe.skip("changelog.warningBreakingChanges", () => { it("shows warning if the selected release note has a breaking changes title.", () => { mockChangelogCall( - "### Breaking Changes\n -this changes is breaking your slice machine" + "### Breaking Changes\n -this changes is breaking your slice machine", ); cy.visit("/changelog"); cy.waitUntil(() => cy.contains("All versions")); diff --git a/cypress/e2e/updates/simulator-tooltip.cy.js b/cypress/e2e/updates/simulator-tooltip.cy.js index 1f1a92f5b1..e564b48f8a 100644 --- a/cypress/e2e/updates/simulator-tooltip.cy.js +++ b/cypress/e2e/updates/simulator-tooltip.cy.js @@ -27,7 +27,7 @@ describe("simulator tooltip", () => { cy.getSliceMachineUserContext().should((data) => { expect(data.hasSeenSimulatorToolTip).equal( true, - "userContext.hasSeenSimulatorToolTip should set in local storage" + "userContext.hasSeenSimulatorToolTip should set in local storage", ); }); }); @@ -67,7 +67,7 @@ describe("simulator tooltip", () => { cy.getSliceMachineUserContext().should((data) => { expect(data.hasSeenSimulatorToolTip).equal( true, - "userContext.hasSeenSimulatorToolTip should set in local storage" + "userContext.hasSeenSimulatorToolTip should set in local storage", ); }); }); diff --git a/cypress/e2e/updates/video-tooltip.cy.js b/cypress/e2e/updates/video-tooltip.cy.js index 8d5758073f..21aa5bd213 100644 --- a/cypress/e2e/updates/video-tooltip.cy.js +++ b/cypress/e2e/updates/video-tooltip.cy.js @@ -14,7 +14,7 @@ describe.skip("video tooltip", () => { cy.getSliceMachineUserContext().then((data) => { expect(data.hasSeenTutorialsToolTip).equal( true, - "userContext.hasSeenTutorialsToolTip should set in local storage" + "userContext.hasSeenTutorialsToolTip should set in local storage", ); }); }); @@ -37,14 +37,14 @@ describe.skip("video tooltip", () => { .should( "have.attr", "href", - "https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH" + "https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH", ) .click(); cy.getSliceMachineUserContext().should((data) => { expect(data.hasSeenTutorialsToolTip).equal( true, - "userContext.hasSeenTutorialsToolTip should set in local storage" + "userContext.hasSeenTutorialsToolTip should set in local storage", ); }); }); @@ -68,7 +68,7 @@ describe.skip("video tooltip", () => { cy.getSliceMachineUserContext().should((data) => { expect(data.hasSeenTutorialsToolTip).equal( true, - "userContext.hasSeenTutorialsToolTip should set in local storage" + "userContext.hasSeenTutorialsToolTip should set in local storage", ); }); }); diff --git a/cypress/e2e/user-flows/scenario_008_edit_mock_from_simulator.cy.js b/cypress/e2e/user-flows/scenario_008_edit_mock_from_simulator.cy.js index 2ffa8867cd..753243b0d7 100644 --- a/cypress/e2e/user-flows/scenario_008_edit_mock_from_simulator.cy.js +++ b/cypress/e2e/user-flows/scenario_008_edit_mock_from_simulator.cy.js @@ -55,7 +55,7 @@ describe.skip("Scenario 008", () => { .invoke("attr", "aria-checked") .then((currentValue) => { cy.wrap(currentValue == "true" ? "false" : "true").as( - "newBooleanValue" + "newBooleanValue", ); }); @@ -82,7 +82,7 @@ describe.skip("Scenario 008", () => { cy.getInputByLabel("SimpleTextField").should( "contain", - "SimpleTextContent" + "SimpleTextContent", ); cy.getInputByLabel("RichTextField").should("contain", "RichTextContent"); cy.getInputByLabel("NumberField").should("have.value", "42"); diff --git a/cypress/e2e/user-flows/scenario_custom_screenshots.cy.js b/cypress/e2e/user-flows/scenario_custom_screenshots.cy.js index 38aef4b84f..cbdbf1068f 100644 --- a/cypress/e2e/user-flows/scenario_custom_screenshots.cy.js +++ b/cypress/e2e/user-flows/scenario_custom_screenshots.cy.js @@ -82,10 +82,10 @@ describe("I am an existing SM user and I want to upload screenshots on variation fileName: "file.txt", mimeType: "text/plain", }, - { action: "drag-drop" } + { action: "drag-drop" }, ); cy.contains("Only files of type png, jpg, jpeg are accepted.").should( - "be.visible" + "be.visible", ); screenshotModal.verifyImageIsEmpty().close(); diff --git a/cypress/e2e/user-flows/scenario_slice_association.cy.js b/cypress/e2e/user-flows/scenario_slice_association.cy.js index e4bdb84ece..3d2b54548d 100644 --- a/cypress/e2e/user-flows/scenario_slice_association.cy.js +++ b/cypress/e2e/user-flows/scenario_slice_association.cy.js @@ -49,25 +49,25 @@ describe.skip("I am an existing SM user (Next) and I want to associate a Slice t cy.addStaticFieldToSlice( "Key Text", "Static Key Text Field", - "static_key_text_id" + "static_key_text_id", ); cy.addStaticFieldToSlice( "Rich Text", "Static Rich Text Field", - "static_rich_text_id" + "static_rich_text_id", ); cy.addRepeatableFieldToSlice( "Rich Text", "Repeatable Rich Text Field", - "repeatable_rich_text_id" + "repeatable_rich_text_id", ); cy.addRepeatableFieldToSlice( "Key Text", "Repeatable Key Text Field", - "repeatable_key_text_id" + "repeatable_key_text_id", ); sliceBuilder.save(); @@ -115,7 +115,7 @@ describe.skip("I am an existing SM user (Next) and I want to associate a Slice t cy.get("#review-form"); cy.get("[data-cy=review-form-score-3]").click(); cy.get("[data-cy=review-form-comment]").type( - "Cypress test - testing the comment of the survey" + "Cypress test - testing the comment of the survey", ); cy.get("#review-form").submit(); diff --git a/cypress/e2e/user-flows/transactional-push.cy.js b/cypress/e2e/user-flows/transactional-push.cy.js index 8c5febea3c..f0cf62ef55 100644 --- a/cypress/e2e/user-flows/transactional-push.cy.js +++ b/cypress/e2e/user-flows/transactional-push.cy.js @@ -96,7 +96,7 @@ describe.skip("I am an existing SM user and I want to push local changes", () => changesPage.mockPushError(500).pushChanges(); cy.contains( - "Something went wrong when pushing your changes. Check your terminal logs." + "Something went wrong when pushing your changes. Check your terminal logs.", ); cy.clearProject(); diff --git a/cypress/helpers/customTypes.js b/cypress/helpers/customTypes.js index ed47bb7063..182ee7a4bc 100644 --- a/cypress/helpers/customTypes.js +++ b/cypress/helpers/customTypes.js @@ -25,7 +25,7 @@ export function createCustomType(id, name) { cy.location("pathname", { timeout: 15000 }).should( "eq", - `/custom-types/${id}` + `/custom-types/${id}`, ); cy.readFile(TYPES_FILE).should("contains", name); cy.readFile(CUSTOM_TYPE_MODEL(id)); diff --git a/cypress/helpers/filesystem.js b/cypress/helpers/filesystem.js index 4f72d66bca..d2fcbcf327 100644 --- a/cypress/helpers/filesystem.js +++ b/cypress/helpers/filesystem.js @@ -44,6 +44,6 @@ export function removeTypes() { */ export function modifyFile(filePath, updateContent) { cy.readFile(filePath).then((content) => - cy.writeFile(filePath, updateContent(content)) + cy.writeFile(filePath, updateContent(content)), ); } diff --git a/cypress/helpers/images.js b/cypress/helpers/images.js index 5fc02eb4ea..e324d6fdb1 100644 --- a/cypress/helpers/images.js +++ b/cypress/helpers/images.js @@ -13,7 +13,7 @@ export function isSameImageAs(subject, fixtureImage) { isCorrectDimensions( subject, fixtureImage.naturalWidth, - fixtureImage.naturalHeight + fixtureImage.naturalHeight, ); resolve(); }; diff --git a/cypress/helpers/localStorage.js b/cypress/helpers/localStorage.js index d936e1f3ce..18da12fc03 100644 --- a/cypress/helpers/localStorage.js +++ b/cypress/helpers/localStorage.js @@ -31,7 +31,7 @@ export function setSliceMachineUserContext({ lastSyncChange, hasSeenSimulatorToolTip, }), - }) + }), ); } diff --git a/cypress/helpers/slices.js b/cypress/helpers/slices.js index 4d0b12a745..c68da17d05 100644 --- a/cypress/helpers/slices.js +++ b/cypress/helpers/slices.js @@ -24,7 +24,7 @@ export function createSlice(lib, id, name) { cy.location("pathname", { timeout: 20000 }).should( "eq", - `/slices/${lib}/${name}/default` + `/slices/${lib}/${name}/default`, ); cy.readFile(TYPES_FILE).should("contains", name); } diff --git a/cypress/pages/RenameModal.js b/cypress/pages/RenameModal.js index a24c3e09e4..2c896778fe 100644 --- a/cypress/pages/RenameModal.js +++ b/cypress/pages/RenameModal.js @@ -26,7 +26,7 @@ class CustomTypeRenameModal extends RenameModal { constructor() { super( "[data-cy=rename-custom-type-modal]", - '[data-cy="custom-type-name-input"]' + '[data-cy="custom-type-name-input"]', ); } } diff --git a/cypress/pages/simulator/editorPage.js b/cypress/pages/simulator/editorPage.js index b262197bba..1bbb5fef76 100644 --- a/cypress/pages/simulator/editorPage.js +++ b/cypress/pages/simulator/editorPage.js @@ -49,7 +49,7 @@ class EditorPage { .then((currentValue) => { if (currentValue === value) { throw new Error( - `Cannot toggle "${inputLabel}" to same value (${value})` + `Cannot toggle "${inputLabel}" to same value (${value})`, ); } }); diff --git a/cypress/pages/slices/screenshotModal.js b/cypress/pages/slices/screenshotModal.js index 357e74ce8d..5c03eeefd5 100644 --- a/cypress/pages/slices/screenshotModal.js +++ b/cypress/pages/slices/screenshotModal.js @@ -16,7 +16,7 @@ class ScreenshotModal { uploadImage(imageFixturePath) { cy.get(`${this.root} input[type="file"]`).selectFile( `${fixturePath}${imageFixturePath}`, - { force: true } + { force: true }, ); return this; } diff --git a/cypress/pages/slices/sliceBuilder.js b/cypress/pages/slices/sliceBuilder.js index aeaafaff3f..c12ecbaa60 100644 --- a/cypress/pages/slices/sliceBuilder.js +++ b/cypress/pages/slices/sliceBuilder.js @@ -83,7 +83,7 @@ class SliceBuilder extends BaseBuilder { .callsFake((url) => { simUrl = url; console.log( - `window.open() won't be called as it currently generates a timeout in cypress. Calling cy.visit('${url}') instead.` + `window.open() won't be called as it currently generates a timeout in cypress. Calling cy.visit('${url}') instead.`, ); // win.open.wrappedMethod.call(win, url, "_self"); }); diff --git a/cypress/plugins/addAuth.ts b/cypress/plugins/addAuth.ts index bc40f9958c..3318e9d7c2 100644 --- a/cypress/plugins/addAuth.ts +++ b/cypress/plugins/addAuth.ts @@ -18,12 +18,12 @@ const main = async () => { headers: { "Content-Type": "application/json", }, - } + }, ); if (!res.headers.has("Set-Cookie")) { throw new Error( - "Could not authenticate to prismic. Please check the credentials." + "Could not authenticate to prismic. Please check the credentials.", ); } @@ -32,7 +32,7 @@ const main = async () => { JSON.stringify({ base: new URL(PRISMIC_URL).toString(), cookies: res.headers.get("Set-Cookie")?.split(", ").join("; ") || "", - }) + }), ); }; diff --git a/cypress/plugins/createRepo.ts b/cypress/plugins/createRepo.ts index 2ba0659b74..3f64403037 100644 --- a/cypress/plugins/createRepo.ts +++ b/cypress/plugins/createRepo.ts @@ -9,7 +9,7 @@ const [, , DOMAIN_NAME, PASSWORD, PRISMIC_URL] = process.argv; const main = async () => { const prismicAuthState = JSON.parse( - await fs.readFile(path.join(os.homedir(), ".prismic"), "utf8") + await fs.readFile(path.join(os.homedir(), ".prismic"), "utf8"), ); const prismicAuthStateCookies = cookie.parse(prismicAuthState.cookies); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 7376d2d850..7caf508225 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -8,7 +8,7 @@ import * as imageHelpers from "../helpers/images"; Object.keys(localStorageHelpers).forEach((localStorageHelper) => { Cypress.Commands.add( localStorageHelper, - localStorageHelpers[localStorageHelper] + localStorageHelpers[localStorageHelper], ); }); @@ -21,7 +21,7 @@ Object.keys(filesystemHelpers).forEach((filesystemHelper) => { Object.keys(customTypesHelpers).forEach((customTypesHelper) => { Cypress.Commands.add( customTypesHelper, - customTypesHelpers[customTypesHelper] + customTypesHelpers[customTypesHelper], ); }); @@ -35,7 +35,7 @@ Object.keys(imageHelpers).forEach((imageHelper) => { Cypress.Commands.add( imageHelper, { prevSubject: true }, - imageHelpers[imageHelper] + imageHelpers[imageHelper], ); }); diff --git a/cypress/support/index.d.ts b/cypress/support/index.d.ts index 1d979edac7..22913a61de 100644 --- a/cypress/support/index.d.ts +++ b/cypress/support/index.d.ts @@ -7,13 +7,13 @@ declare namespace Cypress { hasSendAReview?: boolean, viewedUpdates?: Record, hasSeenTutorialsToolTip?: boolean, - hasSeenSimulatorToolTip?: boolean + hasSeenSimulatorToolTip?: boolean, ): Chainable; getSliceMachineUSerContext(): Chainable< undefined | Record >; getInputByLabel( - label: string + label: string, ): Chainable>; } } diff --git a/packages/slice-machine/components/Button/index.tsx b/packages/slice-machine/components/Button/index.tsx index 4952f679b5..56fa80f2a1 100644 --- a/packages/slice-machine/components/Button/index.tsx +++ b/packages/slice-machine/components/Button/index.tsx @@ -48,7 +48,7 @@ export const Button = forwardRef( variant = "primary", ...rest }, - ref + ref, ) => ( ( )} - ) + ), ); diff --git a/packages/slice-machine/components/Changelog/index.tsx b/packages/slice-machine/components/Changelog/index.tsx index 7accbef669..ed6c491f8d 100644 --- a/packages/slice-machine/components/Changelog/index.tsx +++ b/packages/slice-machine/components/Changelog/index.tsx @@ -17,7 +17,7 @@ export default function Changelog() { changelog: getChangelog(store), packageManager: getPackageManager(store), isChangelogLoading: isLoading(store, LoadingKeysEnum.CHANGELOG), - }) + }), ); const latestVersion = changelog.sliceMachine.versions[0]; diff --git a/packages/slice-machine/components/Changelog/versionDetails/UpdateCommandBox.tsx b/packages/slice-machine/components/Changelog/versionDetails/UpdateCommandBox.tsx index 09d36754a7..f70c5cc48e 100644 --- a/packages/slice-machine/components/Changelog/versionDetails/UpdateCommandBox.tsx +++ b/packages/slice-machine/components/Changelog/versionDetails/UpdateCommandBox.tsx @@ -94,7 +94,7 @@ export const UpdateCommandBox: React.FC = ({ function getInstallCommand( packageManager: PackageManager, - packagesSpecs: string[] + packagesSpecs: string[], ): string { const packagesSpecsStr = packagesSpecs.join(" "); diff --git a/packages/slice-machine/components/ChangesItems/ChangesItems.tsx b/packages/slice-machine/components/ChangesItems/ChangesItems.tsx index 7d63fed7ba..477c69c2cb 100644 --- a/packages/slice-machine/components/ChangesItems/ChangesItems.tsx +++ b/packages/slice-machine/components/ChangesItems/ChangesItems.tsx @@ -33,7 +33,7 @@ export const ChangesItems: React.FC = ({ const { sliceFilterFn, defaultVariationSelector } = modalPayload; const screenshotChangesSlices = unSyncedSlices.filter( - (s) => modelsStatuses.slices[s.model.id] !== ModelStatus.Deleted + (s) => modelsStatuses.slices[s.model.id] !== ModelStatus.Deleted, ); return ( @@ -71,7 +71,7 @@ export const ChangesItems: React.FC = ({ (slice) => countMissingScreenshots(slice) > 0 && modelsStatuses.slices[slice.model.id] !== - ModelStatus.Deleted + ModelStatus.Deleted, ) && ( = ({ key={customType.remote.id} /> - ) + ), )} diff --git a/packages/slice-machine/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx b/packages/slice-machine/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx index 70da99d98e..9e81cdbf29 100644 --- a/packages/slice-machine/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx +++ b/packages/slice-machine/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx @@ -21,7 +21,7 @@ export const HardDeleteDocumentsDrawer: React.FunctionComponent<{ useSelector((store: SliceMachineStoreType) => ({ isDeleteDocumentsDrawerOpen: isModalOpen( store, - ModalKeysEnum.HARD_DELETE_DOCUMENTS_DRAWER + ModalKeysEnum.HARD_DELETE_DOCUMENTS_DRAWER, ), remoteOnlyCustomTypes: selectAllCustomTypes(store).filter(isRemoteOnly), modalData: store.pushChanges, @@ -39,7 +39,7 @@ export const HardDeleteDocumentsDrawer: React.FunctionComponent<{ const associatedDocumentsCards = modalData.details.customTypes.map( (customTypeDetail) => { const customType = remoteOnlyCustomTypes.find( - (customType) => getModelId(customType) === customTypeDetail.id + (customType) => getModelId(customType) === customTypeDetail.id, ); if (customType === undefined) return null; @@ -52,7 +52,7 @@ export const HardDeleteDocumentsDrawer: React.FunctionComponent<{ numberOfDocuments={customTypeDetail.numberOfDocuments} /> ); - } + }, ); return ( diff --git a/packages/slice-machine/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx b/packages/slice-machine/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx index d831efa1b7..b44924bc4d 100644 --- a/packages/slice-machine/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx +++ b/packages/slice-machine/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx @@ -20,7 +20,7 @@ export const ReferencesErrorDrawer: React.FunctionComponent<{ isOpen: isModalOpen(store, ModalKeysEnum.REFERENCES_MISSING_DRAWER), localCustomTypes: selectAllCustomTypes(store).filter(hasLocal), modalData: store.pushChanges, - }) + }), ); const { closeModals, openToaster } = useSliceMachineActions(); @@ -36,7 +36,7 @@ export const ReferencesErrorDrawer: React.FunctionComponent<{ const associatedDocumentsCards = modalData.details.customTypes.map( (customTypeDetail) => { const customType = localCustomTypes.find( - (customType) => getModelId(customType) === customTypeDetail.id + (customType) => getModelId(customType) === customTypeDetail.id, ); if (customType === undefined) return null; @@ -47,7 +47,7 @@ export const ReferencesErrorDrawer: React.FunctionComponent<{ name={customType.local.label ?? customType.local.id} /> ); - } + }, ); return ( diff --git a/packages/slice-machine/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx b/packages/slice-machine/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx index 1a6ba4ce19..b2e022826c 100644 --- a/packages/slice-machine/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx +++ b/packages/slice-machine/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx @@ -50,7 +50,7 @@ export const SoftDeleteDocumentsDrawer: React.FunctionComponent<{ useSelector((store: SliceMachineStoreType) => ({ isDeleteDocumentsDrawerOpen: isModalOpen( store, - ModalKeysEnum.SOFT_DELETE_DOCUMENTS_DRAWER + ModalKeysEnum.SOFT_DELETE_DOCUMENTS_DRAWER, ), remoteOnlyCustomTypes: selectAllCustomTypes(store).filter(isRemoteOnly), modalData: store.pushChanges, @@ -68,7 +68,7 @@ export const SoftDeleteDocumentsDrawer: React.FunctionComponent<{ const associatedDocumentsCards = modalData.details.customTypes.map( (customTypeDetail) => { const customType = remoteOnlyCustomTypes.find( - (customType) => getModelId(customType) === customTypeDetail.id + (customType) => getModelId(customType) === customTypeDetail.id, ); if (customType === undefined) return null; @@ -81,7 +81,7 @@ export const SoftDeleteDocumentsDrawer: React.FunctionComponent<{ numberOfDocuments={customTypeDetail.numberOfDocuments} /> ); - } + }, ); return ( diff --git a/packages/slice-machine/components/DeleteSliceModal/index.tsx b/packages/slice-machine/components/DeleteSliceModal/index.tsx index 4e0e2230b3..52511e5e80 100644 --- a/packages/slice-machine/components/DeleteSliceModal/index.tsx +++ b/packages/slice-machine/components/DeleteSliceModal/index.tsx @@ -24,7 +24,7 @@ export const DeleteSliceModal: React.FunctionComponent< (store: SliceMachineStoreType) => ({ isSliceModalOpen: isModalOpen(store, ModalKeysEnum.DELETE_SLICE), isDeletingSlice: isLoading(store, LoadingKeysEnum.DELETE_SLICE), - }) + }), ); const { closeModals, deleteSlice } = useSliceMachineActions(); diff --git a/packages/slice-machine/components/FormFields/CheckboxControl.jsx b/packages/slice-machine/components/FormFields/CheckboxControl.jsx index dda951b406..adbebf4376 100644 --- a/packages/slice-machine/components/FormFields/CheckboxControl.jsx +++ b/packages/slice-machine/components/FormFields/CheckboxControl.jsx @@ -27,7 +27,7 @@ const CheckboxControl = ({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment const [isChecked, setCheck] = useState( // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/strict-boolean-expressions - defaultValue || field.defaultValue || false + defaultValue || field.defaultValue || false, ); useEffect(() => { diff --git a/packages/slice-machine/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx b/packages/slice-machine/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx index 681ea61000..2a24db6528 100644 --- a/packages/slice-machine/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +++ b/packages/slice-machine/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx @@ -49,7 +49,7 @@ export const CreateCustomTypeModal: React.FC = ({ customTypeLabels: selectAllCustomTypeLabels(store), isCreateCustomTypeModalOpen: isModalOpen( store, - ModalKeysEnum.CREATE_CUSTOM_TYPE + ModalKeysEnum.CREATE_CUSTOM_TYPE, ), isCreatingCustomType: isLoading(store, LoadingKeysEnum.CREATE_CUSTOM_TYPE), })); @@ -77,8 +77,8 @@ export const CreateCustomTypeModal: React.FC = ({ values: FormValues, setValues: ( values: SetStateAction, - shouldValidate?: boolean - ) => void + shouldValidate?: boolean, + ) => void, ) => { if (isIdFieldPristine) { setValues({ @@ -96,8 +96,8 @@ export const CreateCustomTypeModal: React.FC = ({ setFieldValue: ( field: string, value: string, - shouldValidate?: boolean - ) => Promise + shouldValidate?: boolean, + ) => Promise, ) => { void setFieldValue("id", e.target.value); setIsIdFieldPristine(false); diff --git a/packages/slice-machine/components/Forms/CreateSliceModal/CreateSliceModal.tsx b/packages/slice-machine/components/Forms/CreateSliceModal/CreateSliceModal.tsx index dc6f56a44e..89d6301952 100644 --- a/packages/slice-machine/components/Forms/CreateSliceModal/CreateSliceModal.tsx +++ b/packages/slice-machine/components/Forms/CreateSliceModal/CreateSliceModal.tsx @@ -17,7 +17,7 @@ type CreateSliceModalProps = { onClose: () => void; onSuccess: ( newSlice: SharedSlice, - libraryName: string + libraryName: string, ) => Promise | void; localLibraries: readonly LibraryUI[]; remoteSlices: ReadonlyArray; diff --git a/packages/slice-machine/components/Forms/RenameSliceModal/RenameSliceModal.tsx b/packages/slice-machine/components/Forms/RenameSliceModal/RenameSliceModal.tsx index 29396b02f0..f9639c52fa 100644 --- a/packages/slice-machine/components/Forms/RenameSliceModal/RenameSliceModal.tsx +++ b/packages/slice-machine/components/Forms/RenameSliceModal/RenameSliceModal.tsx @@ -27,7 +27,7 @@ export const RenameSliceModal: React.FC = ({ isRenameSliceModalOpen: isModalOpen(store, ModalKeysEnum.RENAME_SLICE), localLibs: getLibraries(store), remoteLibs: getRemoteSlices(store), - }) + }), ); const handleOnSubmit = (values: SliceModalValues) => { diff --git a/packages/slice-machine/components/Forms/formsValidator.ts b/packages/slice-machine/components/Forms/formsValidator.ts index 93f5199c42..9fcf654c49 100644 --- a/packages/slice-machine/components/Forms/formsValidator.ts +++ b/packages/slice-machine/components/Forms/formsValidator.ts @@ -14,7 +14,7 @@ type SliceModalValuesValidity = export function validateSliceModalValues( { sliceName }: SliceModalValues, localLibs: ReadonlyArray, - remoteLibs: ReadonlyArray + remoteLibs: ReadonlyArray, ): SliceModalValuesValidity { if (!sliceName) { return { sliceName: "Cannot be empty" }; @@ -37,7 +37,7 @@ export function validateSliceModalValues( } const localNames = localLibs.flatMap((lib) => - lib.components.map((slice) => slice.model.name) + lib.components.map((slice) => slice.model.name), ); const remoteNames = remoteLibs.map((slice) => slice.name); const usedNames = [...localNames, ...remoteNames]; diff --git a/packages/slice-machine/components/Grid/index.tsx b/packages/slice-machine/components/Grid/index.tsx index 37aa45f74f..d37624130f 100644 --- a/packages/slice-machine/components/Grid/index.tsx +++ b/packages/slice-machine/components/Grid/index.tsx @@ -34,7 +34,7 @@ function Grid({ {renderElem(elem, i)} - ) : null + ) : null, )} ); diff --git a/packages/slice-machine/components/Li/index.tsx b/packages/slice-machine/components/Li/index.tsx index e56dd3cce6..e2b60ca0ef 100644 --- a/packages/slice-machine/components/Li/index.tsx +++ b/packages/slice-machine/components/Li/index.tsx @@ -10,7 +10,7 @@ interface LiProps { const Li = forwardRef( ( { children, Component = Flex, sx = {}, ...rest }: LiProps, - ref: React.ForwardedRef + ref: React.ForwardedRef, ) => ( {children} - ) + ), ); export default Li; diff --git a/packages/slice-machine/components/ListItem/index.tsx b/packages/slice-machine/components/ListItem/index.tsx index 2b45126a7a..ec0dd18bd8 100644 --- a/packages/slice-machine/components/ListItem/index.tsx +++ b/packages/slice-machine/components/ListItem/index.tsx @@ -25,7 +25,7 @@ interface ListItemProps { enterEditMode: ( itemInfo: [string, F], modelFieldName: string | undefined, - index: number + index: number, ) => void; modelFieldName?: string; renderFieldAccessor?: (key: string) => string; @@ -123,7 +123,7 @@ function ListItem({ enterEditMode( [key, item.value], modelFieldName, - index + index, ) } /> diff --git a/packages/slice-machine/components/ListItem/utils.js b/packages/slice-machine/components/ListItem/utils.js index 6e10342a2f..3356dd4a33 100644 --- a/packages/slice-machine/components/ListItem/utils.js +++ b/packages/slice-machine/components/ListItem/utils.js @@ -35,7 +35,7 @@ export const getDraggedDomPosition = (event) => { clientWidth, clientY, clientX: parseFloat( - window.getComputedStyle(draggedDOM.parentNode).paddingLeft + window.getComputedStyle(draggedDOM.parentNode).paddingLeft, ), }; }; diff --git a/packages/slice-machine/components/LoginModal/index.tsx b/packages/slice-machine/components/LoginModal/index.tsx index 095003656a..088f5a213b 100644 --- a/packages/slice-machine/components/LoginModal/index.tsx +++ b/packages/slice-machine/components/LoginModal/index.tsx @@ -40,7 +40,7 @@ const LoginModal: React.FunctionComponent = () => { isOpen: isModalOpen(store, ModalKeysEnum.LOGIN), isLoginLoading: isLoading(store, LoadingKeysEnum.LOGIN), env: getEnvironment(store), - }) + }), ); const { closeModals, startLoadingLogin, stopLoadingLogin, openToaster } = @@ -66,7 +66,7 @@ const LoginModal: React.FunctionComponent = () => { Boolean(status.shortId) && Boolean(status.intercomHash), 3000, - 60 + 60, ); openToaster("Logged in", ToasterType.SUCCESS); diff --git a/packages/slice-machine/components/ModalFormCard/index.tsx b/packages/slice-machine/components/ModalFormCard/index.tsx index e6b2b69ceb..bd91f6f63c 100644 --- a/packages/slice-machine/components/ModalFormCard/index.tsx +++ b/packages/slice-machine/components/ModalFormCard/index.tsx @@ -24,12 +24,12 @@ type ModalCardProps = { field: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any, - shouldValidate?: boolean | undefined + shouldValidate?: boolean | undefined, ) => Promise>; values: T; setValues: ( values: SetStateAction, - shouldValidate?: boolean | undefined + shouldValidate?: boolean | undefined, ) => void; }) => JSX.Element; close: () => void; diff --git a/packages/slice-machine/components/Navigation/VideoItem.tsx b/packages/slice-machine/components/Navigation/VideoItem.tsx index e7cc035796..2453610bf9 100644 --- a/packages/slice-machine/components/Navigation/VideoItem.tsx +++ b/packages/slice-machine/components/Navigation/VideoItem.tsx @@ -59,7 +59,7 @@ export const VideoItem = forwardRef( ); - } + }, ); type MaybeVideoTooltipWrapperProps = VideoItemProps & { @@ -131,7 +131,7 @@ const OldVideoItem: FC = ({ } ref.current = node; }, - [hasSeenTutorialsToolTip] + [hasSeenTutorialsToolTip], ); return ( diff --git a/packages/slice-machine/components/Navigation/index.test.tsx b/packages/slice-machine/components/Navigation/index.test.tsx index 67b6f31a5a..92b93ddfa4 100644 --- a/packages/slice-machine/components/Navigation/index.test.tsx +++ b/packages/slice-machine/components/Navigation/index.test.tsx @@ -153,7 +153,7 @@ describe("Side Navigation", () => { await user.click(link); expect(mockRouter.asPath).toBe(path); - } + }, ); test("should display the number of changes on the 'Changes' item", async () => { @@ -177,7 +177,7 @@ describe("Side Navigation", () => { expect(within(changesItem).queryByText("1")).not.toBeInTheDocument(); expect( - within(changesItem).queryByText("Logged out") + within(changesItem).queryByText("Logged out"), ).not.toBeInTheDocument(); }); @@ -241,7 +241,7 @@ describe("Side Navigation", () => { .closest("a") as HTMLAnchorElement; expect( - within(changesItem).queryByText("Logged out") + within(changesItem).queryByText("Logged out"), ).not.toBeInTheDocument(); }); @@ -265,7 +265,7 @@ describe("Side Navigation", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); renderSideNavigation({ canUpdate: true }); @@ -276,8 +276,8 @@ describe("Side Navigation", () => { await waitFor(() => expect(link).toHaveAttribute( "href", - "https://prismic.io/academy/prismic-and-nextjs" - ) + "https://prismic.io/academy/prismic-and-nextjs", + ), ); expect(link).toHaveAttribute("target", "_blank"); @@ -290,7 +290,7 @@ describe("Side Navigation", () => { ?.parentElement as HTMLElement; expect(link).toHaveAttribute( "href", - "https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH" + "https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH", ); expect(link).toHaveAttribute("target", "_blank"); @@ -299,7 +299,7 @@ describe("Side Navigation", () => { const tooltip = await screen.findByRole("tooltip"); expect(tooltip).toBeVisible(); const closeButton = await within(tooltip).findByTestId( - "video-tooltip-close-button" + "video-tooltip-close-button", ); await user.click(closeButton); diff --git a/packages/slice-machine/components/Navigation/index.tsx b/packages/slice-machine/components/Navigation/index.tsx index cd38554c7f..6dc679c0f8 100644 --- a/packages/slice-machine/components/Navigation/index.tsx +++ b/packages/slice-machine/components/Navigation/index.tsx @@ -66,7 +66,7 @@ const Navigation: FC = () => { })} href={CUSTOM_TYPES_CONFIG["page"].tablePagePathname} active={CUSTOM_TYPES_CONFIG["page"].matchesTablePagePathname( - router.asPath + router.asPath, )} component={Link} Icon={CUSTOM_TYPES_CONFIG.page.Icon} @@ -81,7 +81,7 @@ const Navigation: FC = () => { })} href={CUSTOM_TYPES_CONFIG["custom"].tablePagePathname} active={CUSTOM_TYPES_CONFIG["custom"].matchesTablePagePathname( - router.asPath + router.asPath, )} component={Link} Icon={CUSTOM_TYPES_CONFIG.custom.Icon} diff --git a/packages/slice-machine/components/ReviewModal/ReviewForm.tsx b/packages/slice-machine/components/ReviewModal/ReviewForm.tsx index 08b3e9aef8..6de0efaeb0 100644 --- a/packages/slice-machine/components/ReviewModal/ReviewForm.tsx +++ b/packages/slice-machine/components/ReviewModal/ReviewForm.tsx @@ -37,7 +37,7 @@ export const ReviewForm: FC = (props) => { (store: SliceMachineStoreType) => ({ isReviewLoading: isLoading(store, LoadingKeysEnum.REVIEW), isLoginModalOpen: isModalOpen(store, ModalKeysEnum.LOGIN), - }) + }), ); const { skipReview, sendAReview, startLoadingReview, stopLoadingReview } = useSliceMachineActions(); diff --git a/packages/slice-machine/components/ReviewModal/ReviewModal.tsx b/packages/slice-machine/components/ReviewModal/ReviewModal.tsx index d6581ecf55..9c1eb24f54 100644 --- a/packages/slice-machine/components/ReviewModal/ReviewModal.tsx +++ b/packages/slice-machine/components/ReviewModal/ReviewModal.tsx @@ -16,7 +16,7 @@ export const ReviewModal: FC = () => { customTypes: selectAllCustomTypes(store), libraries: getLibraries(store), lastSyncChange: getLastSyncChange(store), - }) + }), ); const sliceCount = @@ -33,13 +33,13 @@ export const ReviewModal: FC = () => { (customType) => hasLocal(customType) && customType.local.tabs.some( - (tab) => tab.sliceZone && tab.sliceZone?.value.length > 0 - ) + (tab) => tab.sliceZone && tab.sliceZone?.value.length > 0, + ), ); const hasPushedAnHourAgo = Boolean( // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions - lastSyncChange && Date.now() - lastSyncChange >= 3600000 + lastSyncChange && Date.now() - lastSyncChange >= 3600000, ); const isAdvancedRepository = diff --git a/packages/slice-machine/components/ScreenshotChangesModal/VariationDropZone.tsx b/packages/slice-machine/components/ScreenshotChangesModal/VariationDropZone.tsx index 2b22417dd2..fd6992aa2f 100644 --- a/packages/slice-machine/components/ScreenshotChangesModal/VariationDropZone.tsx +++ b/packages/slice-machine/components/ScreenshotChangesModal/VariationDropZone.tsx @@ -96,9 +96,9 @@ const DropZone: React.FC = ({ (state: SliceMachineStoreType) => ({ isLoadingScreenshot: isLoading( state, - LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT + LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT, ), - }) + }), ); const { FileInputRenderer, fileInputProps } = useCustomScreenshot({ @@ -107,7 +107,7 @@ const DropZone: React.FC = ({ variationID, slice, file, - isDragActive ? "dragAndDrop" : "upload" + isDragActive ? "dragAndDrop" : "upload", ); setIsHover(false); }, @@ -117,7 +117,7 @@ const DropZone: React.FC = ({ if (file.size > 128000000) { return openToaster( "File is too big. Max file size: 128Mb.", - ToasterType.ERROR + ToasterType.ERROR, ); } generateSliceCustomScreenshot(variationID, slice, file, "dragAndDrop"); @@ -131,7 +131,7 @@ const DropZone: React.FC = ({ const clipboardItems = await navigator.clipboard.read(); if (clipboardItems[0] !== undefined) { const maybeType = clipboardItems[0].types.find((type) => - imageTypes.map((t) => `image/${t}`).includes(type) + imageTypes.map((t) => `image/${t}`).includes(type), ); if (maybeType !== undefined) { const blob = await clipboardItems[0].getType(maybeType); @@ -153,7 +153,7 @@ const DropZone: React.FC = ({ } return openToaster( `Only files of type ${imageTypes.join(", ")} are accepted.`, - ToasterType.ERROR + ToasterType.ERROR, ); } }; diff --git a/packages/slice-machine/components/ScreenshotChangesModal/index.tsx b/packages/slice-machine/components/ScreenshotChangesModal/index.tsx index 73fd6c945e..7221564965 100644 --- a/packages/slice-machine/components/ScreenshotChangesModal/index.tsx +++ b/packages/slice-machine/components/ScreenshotChangesModal/index.tsx @@ -157,7 +157,7 @@ const VariationsList = ({ const variationSetter = ( defaultVariationSelector: SliceVariationSelector | undefined, - slices: ComponentUI[] + slices: ComponentUI[], ) => // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing defaultVariationSelector || @@ -182,7 +182,7 @@ const ScreenshotChangesModal = ({ })); const [variationSelector, setVariationSelector] = useState( - variationSetter(defaultVariationSelector, slices) + variationSetter(defaultVariationSelector, slices), ); useEffect(() => { @@ -269,7 +269,7 @@ const ScreenshotChangesModal = ({ {supportsClipboardRead ? : undefined} {(() => { const slice = slices.find( - (s) => s.model.id === variationSelector.sliceID + (s) => s.model.id === variationSelector.sliceID, ); return slice ? ( = ({ (store: SliceMachineStoreType) => ({ isScreenshotModalOpen: isModalOpen( store, - ModalKeysEnum.SCREENSHOT_PREVIEW + ModalKeysEnum.SCREENSHOT_PREVIEW, ), - }) + }), ); const { closeModals } = useSliceMachineActions(); diff --git a/packages/slice-machine/components/Simulator/components/Header/index.tsx b/packages/slice-machine/components/Simulator/components/Header/index.tsx index 35230bea14..2f525d496f 100644 --- a/packages/slice-machine/components/Simulator/components/Header/index.tsx +++ b/packages/slice-machine/components/Simulator/components/Header/index.tsx @@ -16,7 +16,7 @@ import { VariationSM } from "@lib/models/common/Slice"; const redirect = ( model: ComponentUI, variation: { id: string } | undefined, - isSimulator?: boolean + isSimulator?: boolean, ): void => { if (!variation) { void router.push(`/${model.href}/${model.model.name}`); diff --git a/packages/slice-machine/components/Simulator/components/IframeRenderer/index.tsx b/packages/slice-machine/components/Simulator/components/IframeRenderer/index.tsx index db5adcc3e7..a9e6354c40 100644 --- a/packages/slice-machine/components/Simulator/components/IframeRenderer/index.tsx +++ b/packages/slice-machine/components/Simulator/components/IframeRenderer/index.tsx @@ -149,7 +149,7 @@ const IframeRenderer: React.FunctionComponent = ({ export function getScaling( { height: iframeHeight, width: iframeWidth }: ScreenDimensions, - { height: viewportHeight, width: viewportWidth }: ScreenDimensions + { height: viewportHeight, width: viewportWidth }: ScreenDimensions, ): number { if (iframeWidth > viewportWidth || iframeHeight > viewportHeight) { return iframeWidth - viewportWidth > iframeHeight - viewportHeight diff --git a/packages/slice-machine/components/Simulator/components/SetupModal/index.tsx b/packages/slice-machine/components/Simulator/components/SetupModal/index.tsx index e874797e3a..bc7e3a3fae 100644 --- a/packages/slice-machine/components/Simulator/components/SetupModal/index.tsx +++ b/packages/slice-machine/components/Simulator/components/SetupModal/index.tsx @@ -83,7 +83,7 @@ const SetupModal: React.FC<{ isOpen: boolean }> = ({ isOpen }) => { isSimulatorAvailableForFramework: selectIsSimulatorAvailableForFramework(state), setupSteps: selectSetupSteps(state), - }) + }), ); // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing diff --git a/packages/slice-machine/components/Simulator/components/Toolbar/index.tsx b/packages/slice-machine/components/Simulator/components/Toolbar/index.tsx index dc2d488f92..32a26987db 100644 --- a/packages/slice-machine/components/Simulator/components/Toolbar/index.tsx +++ b/packages/slice-machine/components/Simulator/components/Toolbar/index.tsx @@ -30,7 +30,7 @@ export const Toolbar: React.FC = ({ actionsDisabled, }) => { const [selectedDropdown, setSelectedDropdown] = useState( - ScreenSizeOptions.DESKTOP + ScreenSizeOptions.DESKTOP, ); const dropDownChangeHandler = (selected: string) => { @@ -45,7 +45,7 @@ export const Toolbar: React.FC = ({ const screenSizeChangeHandler = (newScreenDimensions: ScreenDimensions) => { const matchingIndex = Object.values(ScreenSizes).findIndex( (dimension) => - JSON.stringify(dimension) === JSON.stringify(newScreenDimensions) + JSON.stringify(dimension) === JSON.stringify(newScreenDimensions), ); const newDropDownState = diff --git a/packages/slice-machine/components/Simulator/index.tsx b/packages/slice-machine/components/Simulator/index.tsx index 0634908097..920b8eecfc 100644 --- a/packages/slice-machine/components/Simulator/index.tsx +++ b/packages/slice-machine/components/Simulator/index.tsx @@ -77,7 +77,7 @@ const Simulator: ComponentWithSliceProps = ({ slice, variation }) => { env: "prod", unsplashUrl: endpoints.PrismicUnsplash, }), - [endpoints.PrismicOembed, endpoints.PrismicUnsplash] + [endpoints.PrismicOembed, endpoints.PrismicUnsplash], ); const setupIntervalId = useRef(null); @@ -156,14 +156,14 @@ const Simulator: ComponentWithSliceProps = ({ slice, variation }) => { }; const [screenDimensions, setScreenDimensions] = useState( - ScreenSizes[ScreenSizeOptions.DESKTOP] + ScreenSizes[ScreenSizeOptions.DESKTOP], ); const sharedSlice = useMemo(() => Slices.fromSM(slice.model), [slice.model]); // state used only to store updates coming from the editor const [editorState, setEditorState] = useState( - null + null, ); // computed state that takes the editorState if any change @@ -190,7 +190,7 @@ const Simulator: ComponentWithSliceProps = ({ slice, variation }) => { } ).id, // eslint-disable-next-line react-hooks/exhaustive-deps - [] + [], ); // When the content change, we re-render the content but overwrite the newly @@ -202,7 +202,7 @@ const Simulator: ComponentWithSliceProps = ({ slice, variation }) => { id: renderedSliceId, }), // eslint-disable-next-line react-hooks/exhaustive-deps - [sharedSlice, editorContent] + [sharedSlice, editorContent], ); const apiContent = useThrottle(renderSliceMockCb, 800, [ diff --git a/packages/slice-machine/components/Tooltip/TextWithTooltip.tsx b/packages/slice-machine/components/Tooltip/TextWithTooltip.tsx index f9ff47643a..60eb8c9fce 100644 --- a/packages/slice-machine/components/Tooltip/TextWithTooltip.tsx +++ b/packages/slice-machine/components/Tooltip/TextWithTooltip.tsx @@ -21,7 +21,7 @@ export const TextWithTooltip: React.FC = ({ const updateTooltipVisibility = () => { setShowTooltip( headingRef.current && - headingRef.current.offsetWidth < headingRef.current.scrollWidth + headingRef.current.offsetWidth < headingRef.current.scrollWidth, ); }; diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/List.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/List.tsx index 50604f0564..7438b98774 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/List.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/List.tsx @@ -46,14 +46,14 @@ export const SlicesList: React.FC = ({ start: false, plural: false, })} contains legacy slices that can be upgraded.`, - ToasterType.INFO + ToasterType.INFO, ) : openToaster( `This ${customTypesMessages.name({ start: false, plural: false, })} contains slices that are incompatible.`, - ToasterType.WARNING + ToasterType.WARNING, ); // eslint-disable-next-line react-hooks/exhaustive-deps }, [hasLegacySlices]); diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx index 6639b3604f..49d3af1b93 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx @@ -65,8 +65,8 @@ export const SlicesTemplatesModal: FC = ({ return slice.model; }) .filter( - (slice) => slice !== undefined - ) as Promise[] + (slice) => slice !== undefined, + ) as Promise[], ); await onSuccess(slices); @@ -112,9 +112,9 @@ export const SlicesTemplatesModal: FC = ({ url: curr[1], }, }), - {} + {}, ), - }) + }), ), ...sliceTemplatesComingSoon, ]} diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx index 5181486529..6851c797a7 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx @@ -34,7 +34,7 @@ const UpdateSliceZoneModal: React.FC = ({ const slices = sliceKeys .map( (sliceKey) => - availableSlices.find((s) => s.model.id === sliceKey)?.model + availableSlices.find((s) => s.model.id === sliceKey)?.model, ) .filter((slice) => slice !== undefined) as SharedSlice[]; void onSubmit(slices); diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx index b0344fa994..c376620f07 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/SliceZone/index.tsx @@ -42,14 +42,14 @@ import { SlicesList } from "./List"; const mapAvailableAndSharedSlices = ( sliceZone: SlicesSM, - libraries: ReadonlyArray | null + libraries: ReadonlyArray | null, ) => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const availableSlices = (libraries || []).reduce>( (acc, curr: LibraryUI) => { return [...acc, ...curr.components]; }, - [] + [], ); const { slicesInSliceZone, notFound } = sliceZone.value.reduce<{ slicesInSliceZone: ReadonlyArray; @@ -59,7 +59,7 @@ const mapAvailableAndSharedSlices = ( // Shared Slice if (value.type === "SharedSlice") { const maybeSliceState: ComponentUI | undefined = availableSlices.find( - (slice) => slice.model.id === key + (slice) => slice.model.id === key, ); if (maybeSliceState) { @@ -84,7 +84,7 @@ const mapAvailableAndSharedSlices = ( ], }; }, - { slicesInSliceZone: [], notFound: [] } + { slicesInSliceZone: [], notFound: [] }, ); return { availableSlices, slicesInSliceZone, notFound }; @@ -119,19 +119,19 @@ const SliceZone: React.FC = ({ remoteSlices: getRemoteSlices(store), libraries: getLibraries(store), slices: getFrontendSlices(store), - }) + }), ); const { initCustomTypeStore, saveCustomTypeSuccess } = useSliceMachineActions(); const localLibraries: readonly LibraryUI[] = libraries.filter( - (library) => library.isLocal + (library) => library.isLocal, ); const { availableSlices, slicesInSliceZone, notFound } = useMemo( () => sliceZone ? mapAvailableAndSharedSlices(sliceZone, libraries) : { availableSlices: [], slicesInSliceZone: [], notFound: [] }, - [sliceZone, libraries] + [sliceZone, libraries], ); const [isDeleteSliceZoneModalOpen, setIsDeleteSliceZoneModalOpen] = useState(false); @@ -153,8 +153,8 @@ const SliceZone: React.FC = ({ const availableSlicesToAdd = availableSlices.filter( (slice) => !sharedSlicesInSliceZone.some( - (sharedSlice) => sharedSlice.model.id === slice.model.id - ) + (sharedSlice) => sharedSlice.model.id === slice.model.id, + ), ); const openUpdateSliceZoneModal = () => { @@ -180,7 +180,7 @@ const SliceZone: React.FC = ({ void replace( { pathname, query: { pageTypeId: query.pageTypeId } }, undefined, - { shallow: true } + { shallow: true }, ); } }; @@ -330,7 +330,7 @@ const SliceZone: React.FC = ({ + />, ); }} close={closeSlicesTemplatesModal} @@ -362,7 +362,7 @@ const SliceZone: React.FC = ({ + />, ); }} localLibraries={localLibraries} diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/TabZone/index.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/TabZone/index.tsx index 4de6060721..a0f06ca988 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/TabZone/index.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/TabZone/index.tsx @@ -99,7 +99,7 @@ const TabZone: FC = ({ tabId, result.source.index, // @ts-expect-error We have to change the typeGuard above to cast properly the "result" property - result.destination.index + result.destination.index, ); }; diff --git a/packages/slice-machine/lib/builders/CustomTypeBuilder/index.tsx b/packages/slice-machine/lib/builders/CustomTypeBuilder/index.tsx index 41e67c1630..a60f892b0c 100644 --- a/packages/slice-machine/lib/builders/CustomTypeBuilder/index.tsx +++ b/packages/slice-machine/lib/builders/CustomTypeBuilder/index.tsx @@ -146,7 +146,7 @@ export const CustomTypeBuilder: FC = (props) => { deleteCustomTypeTab(dialog.tabKey); if (tabValue === dialog.tabKey) { const otherTabValue = customType.tabs.find( - (tab) => tab.key !== dialog.tabKey + (tab) => tab.key !== dialog.tabKey, )?.key; if (otherTabValue !== undefined) setTabValue(otherTabValue); } diff --git a/packages/slice-machine/lib/builders/SliceBuilder/FieldZones/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/FieldZones/index.tsx index 0e95635c9f..98165959f7 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/FieldZones/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/FieldZones/index.tsx @@ -66,7 +66,7 @@ const FieldZones: React.FunctionComponent = ({ previousKey, newKey, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - mockValue + mockValue, ); } else { deleteSliceWidgetMock(variation.id, widgetArea, newKey); @@ -93,7 +93,7 @@ const FieldZones: React.FunctionComponent = ({ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!widget) { console.log( - `Could not find widget with type name "${widgetTypeName}". Please contact us!` + `Could not find widget with type name "${widgetTypeName}". Please contact us!`, ); } @@ -102,7 +102,7 @@ const FieldZones: React.FunctionComponent = ({ widgetArea, id, // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call - widget.create(label) as NestableWidget + widget.create(label) as NestableWidget, ); }; @@ -113,7 +113,7 @@ const FieldZones: React.FunctionComponent = ({ variation.id, widgetArea, result.source.index, - result.destination?.index ?? undefined + result.destination?.index ?? undefined, ); }; diff --git a/packages/slice-machine/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx index d2f430f518..19729cbef1 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx @@ -101,7 +101,7 @@ const SimulatorButton: React.FC<{ (store: SliceMachineStoreType) => ({ hasSeenSimulatorTooltip: userHasSeenSimulatorToolTip(store), hasSeenTutorialsToolTip: userHasSeenTutorialsToolTip(store), - }) + }), ); useEffect(() => { diff --git a/packages/slice-machine/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx index c50973de46..5d209320ab 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx @@ -28,7 +28,7 @@ const VarationsPopover: React.FunctionComponent<{ const [isOpen, setIsOpen] = useState(false); const [current, setCurrent] = useState( // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - defaultValue || variations[0] + defaultValue || variations[0], ); useEffect(() => { diff --git a/packages/slice-machine/lib/builders/SliceBuilder/Header/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/Header/index.tsx index f7e4ef64cb..1203c6ff99 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/Header/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/Header/index.tsx @@ -33,7 +33,7 @@ const Header: React.FC<{ lib: component.href, sliceName: component.model.name, variationId: v.id, - }).all + }).all, ) } /> @@ -52,7 +52,7 @@ const Header: React.FC<{ lib: component.href, sliceName: component.model.name, variationId: id, - }).all + }).all, ); }} initialVariation={variation} diff --git a/packages/slice-machine/lib/builders/SliceBuilder/index.tsx b/packages/slice-machine/lib/builders/SliceBuilder/index.tsx index 13afdc83b9..4fa5466809 100644 --- a/packages/slice-machine/lib/builders/SliceBuilder/index.tsx +++ b/packages/slice-machine/lib/builders/SliceBuilder/index.tsx @@ -58,7 +58,7 @@ const SliceBuilder: ComponentWithSliceProps = ({ slice, variation }) => { (store: SliceMachineStoreType) => ({ isTouched: isSelectedSliceTouched(store, slice.from, slice.model.id), remoteSlice: getRemoteSlice(store, slice.model.id), - }) + }), ); // We need to move this state to somewhere global to update the UI if any action from anywhere save or update to the filesystem I'd guess @@ -115,7 +115,7 @@ const SliceBuilderForVariation: React.FC = ({ (state: SliceMachineStoreType) => ({ isSimulatorAvailableForFramework: selectIsSimulatorAvailableForFramework(state), - }) + }), ); const sliceModel: LocalAndRemoteSlice | LocalOnlySlice = { diff --git a/packages/slice-machine/lib/builders/common/EditModal/Form.jsx b/packages/slice-machine/lib/builders/common/EditModal/Form.jsx index 0f9f2b5d08..bbe63ad5a0 100644 --- a/packages/slice-machine/lib/builders/common/EditModal/Form.jsx +++ b/packages/slice-machine/lib/builders/common/EditModal/Form.jsx @@ -43,7 +43,7 @@ const WidgetForm = ({ [key]: value, }; }, - {} + {}, ); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment onSave({ newKey: apiId, value: withDefaultValues }); diff --git a/packages/slice-machine/lib/builders/common/EditModal/index.jsx b/packages/slice-machine/lib/builders/common/EditModal/index.jsx index 762b79d07f..dfd36be6bb 100644 --- a/packages/slice-machine/lib/builders/common/EditModal/index.jsx +++ b/packages/slice-machine/lib/builders/common/EditModal/index.jsx @@ -44,7 +44,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access initialModelValues.config, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access - initialModelValues.type + initialModelValues.type, ); // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions @@ -83,7 +83,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment config: initialConfig, }, - { stripUnknown: true } + { stripUnknown: true }, ), }; } catch (e) { @@ -96,7 +96,7 @@ const EditModal = ({ close, data, fields, onSave, zoneType }) => { if (err) { console.error( // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access - `[EditModal] Failed to validate field of type ${initialModelValues.type}.\n Please update model.json accordingly.` + `[EditModal] Failed to validate field of type ${initialModelValues.type}.\n Please update model.json accordingly.`, ); console.error(err); } diff --git a/packages/slice-machine/lib/builders/common/Zone/Card/components/NewField.tsx b/packages/slice-machine/lib/builders/common/Zone/Card/components/NewField.tsx index 8fa2cacb87..27d3fc0902 100644 --- a/packages/slice-machine/lib/builders/common/Zone/Card/components/NewField.tsx +++ b/packages/slice-machine/lib/builders/common/Zone/Card/components/NewField.tsx @@ -58,7 +58,7 @@ const NewField: React.FC = ({ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!widget) { console.error( - `Widget of type "${widgetTypeName}" not found. This is a problem on our side!` + `Widget of type "${widgetTypeName}" not found. This is a problem on our side!`, ); return
Unexpected error. Contact us for more info.
; } @@ -84,8 +84,8 @@ const NewField: React.FC = ({ values: FormFieldValues, setValues: ( values: SetStateAction, - shouldValidate?: boolean - ) => void + shouldValidate?: boolean, + ) => void, ) => { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (isIdFieldPristine && !FormFields.id.disabled) { @@ -104,8 +104,8 @@ const NewField: React.FC = ({ setFieldValue: ( field: keyof typeof FormFields, value: string, - shouldValidate?: boolean - ) => Promise + shouldValidate?: boolean, + ) => Promise, ) => { void setFieldValue("id", e.target.value); setIsIdFieldPristine(false); @@ -180,7 +180,7 @@ const NewField: React.FC = ({ : // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions errors.label ? InputFieldStyles.ERROR - : undefined + : undefined, )} aria-label="label-input" data-cy="new-field-name-input" @@ -215,7 +215,7 @@ const NewField: React.FC = ({ : // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions errors.id ? InputFieldStyles.ERROR - : undefined + : undefined, )} data-cy="new-field-id-input" /> diff --git a/packages/slice-machine/lib/builders/common/Zone/index.jsx b/packages/slice-machine/lib/builders/common/Zone/index.jsx index 8fe877717a..441c8706f7 100644 --- a/packages/slice-machine/lib/builders/common/Zone/index.jsx +++ b/packages/slice-machine/lib/builders/common/Zone/index.jsx @@ -37,7 +37,7 @@ const Zone = ({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument const hasUid = !!Object.entries(poolOfFieldsToCheck).find( // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access - ([, { value }]) => value.type === "UID" + ([, { value }]) => value.type === "UID", ); // eslint-disable-next-line @typescript-eslint/no-unsafe-return return hasUid @@ -237,7 +237,7 @@ Zone.propTypes = { fields: array, type: string.isRequired, }), - }) + }), ), }; diff --git a/packages/slice-machine/lib/builders/utils/index.ts b/packages/slice-machine/lib/builders/utils/index.ts index a27233d31c..e02fb48c97 100644 --- a/packages/slice-machine/lib/builders/utils/index.ts +++ b/packages/slice-machine/lib/builders/utils/index.ts @@ -8,7 +8,7 @@ export const findWidgetByConfigOrType = ( widgets: Widgets, // eslint-disable-next-line @typescript-eslint/no-explicit-any config: any, - type: string + type: string, ) => { if (type === "Link") { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access diff --git a/packages/slice-machine/lib/forms/defaults.ts b/packages/slice-machine/lib/forms/defaults.ts index cde301a096..6d6165d85c 100644 --- a/packages/slice-machine/lib/forms/defaults.ts +++ b/packages/slice-machine/lib/forms/defaults.ts @@ -28,7 +28,7 @@ export const DefaultFields: Record = { }, undefined, undefined, - "Label for content creators (defaults to field type)" + "Label for content creators (defaults to field type)", ), id: Input( "API ID*", @@ -40,7 +40,7 @@ export const DefaultFields: Record = { }, validateId, undefined, - "A unique identifier for the field (e.g. buttonLink)" + "A unique identifier for the field (e.g. buttonLink)", ), placeholder: Input( "Placeholder", @@ -50,6 +50,6 @@ export const DefaultFields: Record = { }, undefined, undefined, - "Placeholder text for content creators" + "Placeholder text for content creators", ), }; diff --git a/packages/slice-machine/lib/forms/fields.ts b/packages/slice-machine/lib/forms/fields.ts index f7cf8b0cef..422c9f73e5 100644 --- a/packages/slice-machine/lib/forms/fields.ts +++ b/packages/slice-machine/lib/forms/fields.ts @@ -5,7 +5,7 @@ import { createValidationArgs } from "."; export const CheckBox = ( label: string, required = true, - defaultValue = true + defaultValue = true, ) => ({ type: FormTypes.CHECKBOX, validate: { @@ -24,7 +24,7 @@ export const Select = ( options: any, required = true, multi = true, - defaultValue = true + defaultValue = true, ) => ({ type: FormTypes.SELECT, required, @@ -73,7 +73,7 @@ export const Input = ( }, fieldLevelValidation: FieldLevelValidationFn | undefined | null, defaultValue: string | undefined, - placeholder: string + placeholder: string, ): InputType => { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions const { min, max, required, matches } = conditions || {}; diff --git a/packages/slice-machine/lib/forms/index.ts b/packages/slice-machine/lib/forms/index.ts index 63aca8e9d6..b8593cd64e 100644 --- a/packages/slice-machine/lib/forms/index.ts +++ b/packages/slice-machine/lib/forms/index.ts @@ -27,7 +27,7 @@ export const createFieldNameFromKey = (key: string) => export const createValidationArgs = ( args: (string | number)[] | boolean | string | undefined, - defaultArgs: (string | number)[] + defaultArgs: (string | number)[], ) => { if (Array.isArray(args)) { return args; @@ -92,7 +92,7 @@ export const createValidationSchema = (FormFields: { if (args && validator[func]) { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call validator = validator[func]( - ...(Array.isArray(args) ? args : [args]) + ...(Array.isArray(args) ? args : [args]), ); return; } @@ -103,7 +103,7 @@ export const createValidationSchema = (FormFields: { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment [key]: validator, }; - }, {}) + }, {}), ) .required() .default(undefined) diff --git a/packages/slice-machine/lib/models/common/ComponentUI.ts b/packages/slice-machine/lib/models/common/ComponentUI.ts index 0c3b43b7a7..8372227120 100644 --- a/packages/slice-machine/lib/models/common/ComponentUI.ts +++ b/packages/slice-machine/lib/models/common/ComponentUI.ts @@ -10,7 +10,7 @@ export const buildScreenshotUrls = ( | { [variationId: string]: Screenshot; } - | undefined + | undefined, ): { [v: string]: ScreenshotUI } => { if (!screenshots) { return {}; @@ -28,7 +28,7 @@ export const buildScreenshotUrls = ( } : acc; }, - {} + {}, ); }; @@ -49,7 +49,7 @@ export const ComponentUI = { }, variation( component: ComponentUI, - variationId?: string + variationId?: string, ): VariationSM | undefined { if (component.model.variations.length) { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions diff --git a/packages/slice-machine/lib/models/common/CustomType/group.ts b/packages/slice-machine/lib/models/common/CustomType/group.ts index 1b3acc512e..de777e29b3 100644 --- a/packages/slice-machine/lib/models/common/CustomType/group.ts +++ b/packages/slice-machine/lib/models/common/CustomType/group.ts @@ -4,7 +4,7 @@ import { GroupSM } from "../Group"; export const Group = { addWidget( group: GroupSM, - newField: { key: string; value: NestableWidget } + newField: { key: string; value: NestableWidget }, ): GroupSM { return { ...group, @@ -58,7 +58,7 @@ export const Group = { group: GroupSM, previousKey: string, newKey: string, - value: NestableWidget + value: NestableWidget, ): GroupSM { return { ...group, diff --git a/packages/slice-machine/lib/models/common/CustomType/index.ts b/packages/slice-machine/lib/models/common/CustomType/index.ts index 5bc2648252..b4279f9a43 100644 --- a/packages/slice-machine/lib/models/common/CustomType/index.ts +++ b/packages/slice-machine/lib/models/common/CustomType/index.ts @@ -26,14 +26,14 @@ export const CustomTypeSM = t.exact( t.partial({ hash: t.string, }), - ]) + ]), ); export type CustomTypeSM = t.TypeOf; export const CustomTypes = { toSM(ct: CustomTypeInternal): CustomTypeSM { const tabs: Array = Object.entries(ct.json).map( - ([tabKey, tabValue]) => Tabs.toSM(tabKey, tabValue) + ([tabKey, tabValue]) => Tabs.toSM(tabKey, tabValue), ); return getOrElseW(() => { throw new Error("Error while parsing a prismic custom type."); @@ -41,7 +41,7 @@ export const CustomTypes = { CustomTypeSM.decode({ ...ct, tabs, - }) + }), ); }, fromSM(ct: CustomTypeSM): CustomTypeInternal { @@ -56,7 +56,7 @@ export const CustomTypes = { [tab.key]: Tabs.fromSM(tab), }; }, {}), - }) + }), ); }, }; diff --git a/packages/slice-machine/lib/models/common/CustomType/tab.ts b/packages/slice-machine/lib/models/common/CustomType/tab.ts index c4d78fa684..80e34a1c1e 100644 --- a/packages/slice-machine/lib/models/common/CustomType/tab.ts +++ b/packages/slice-machine/lib/models/common/CustomType/tab.ts @@ -17,7 +17,7 @@ export const TabFields = t.array( t.type({ key: t.string, value: t.union([NestableWidget, UID, GroupSM]), - }) + }), ); export type TabFields = t.TypeOf; @@ -35,7 +35,7 @@ export type TabSM = t.TypeOf; export const Tabs = { toSM(key: string, tab: DynamicSection): TabSM { const maybeSz = Object.entries(tab).find( - ([, value]) => value.type === "Slices" + ([, value]) => value.type === "Slices", ); const sliceZone = maybeSz && SliceZone.toSM(maybeSz[0], maybeSz[1] as DynamicSlices); @@ -60,7 +60,7 @@ export const Tabs = { return [...acc, { key: fieldId, value }]; } }, - [] + [], ), ...(sliceZone ? { sliceZone } : {}), }; @@ -76,12 +76,12 @@ export const Tabs = { return [...acc, [key, value]]; } }, - [] + [], ) .concat( !tab.sliceZone ? [] - : [[tab.sliceZone.key, SliceZone.fromSM(tab.sliceZone)]] + : [[tab.sliceZone.key, SliceZone.fromSM(tab.sliceZone)]], ) .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {}); return fields; @@ -137,7 +137,7 @@ export const Tab = { tab: TabSM, previousKey: string, newKey: string, - value: TabField + value: TabField, ): TabSM { return { ...tab, @@ -221,7 +221,7 @@ export const Tab = { }; } }, - { fields: [], groups: [] } + { fields: [], groups: [] }, ); return { fields, diff --git a/packages/slice-machine/lib/models/common/ErrorWithStatus.ts b/packages/slice-machine/lib/models/common/ErrorWithStatus.ts index 756b580f78..6488df77ef 100644 --- a/packages/slice-machine/lib/models/common/ErrorWithStatus.ts +++ b/packages/slice-machine/lib/models/common/ErrorWithStatus.ts @@ -1,7 +1,7 @@ export default class ErrorWithStatus extends Error { constructor( readonly reason: string, - readonly status: number + readonly status: number, ) { super(reason); } diff --git a/packages/slice-machine/lib/models/common/Fields.ts b/packages/slice-machine/lib/models/common/Fields.ts index 3d96fc2055..2177826150 100644 --- a/packages/slice-machine/lib/models/common/Fields.ts +++ b/packages/slice-machine/lib/models/common/Fields.ts @@ -2,6 +2,6 @@ import * as t from "io-ts"; import { NestableWidget } from "@prismicio/types-internal/lib/customtypes"; export const FieldsSM = t.array( - t.type({ key: t.string, value: NestableWidget }) + t.type({ key: t.string, value: NestableWidget }), ); export type FieldsSM = t.TypeOf; diff --git a/packages/slice-machine/lib/models/common/Group.ts b/packages/slice-machine/lib/models/common/Group.ts index a9cfbb1382..db70bbb306 100644 --- a/packages/slice-machine/lib/models/common/Group.ts +++ b/packages/slice-machine/lib/models/common/Group.ts @@ -9,7 +9,7 @@ export const GroupConfig = t.exact( label: StringOrNull, repeat: t.boolean, fields: FieldsSM, - }) + }), ); export type GroupConfig = t.TypeOf; @@ -24,7 +24,7 @@ export const GroupSM = t.exact( description: t.string, config: GroupConfig, }), - ]) + ]), ); export type GroupSM = t.TypeOf; @@ -35,7 +35,7 @@ export const Groups = { return group.config.fields.reduce( (acc, { key, value }) => ({ ...acc, [key]: value }), - {} + {}, ); })(); @@ -48,7 +48,7 @@ export const Groups = { ...group.config, ...(fields ? { fields } : {}), }, - }) + }), ); }, @@ -72,7 +72,7 @@ export const Groups = { ...group.config, ...(fields ? { fields } : {}), }, - }) + }), ); }, }; diff --git a/packages/slice-machine/lib/models/common/Library.ts b/packages/slice-machine/lib/models/common/Library.ts index 9c0e729c9d..dd6127c983 100644 --- a/packages/slice-machine/lib/models/common/Library.ts +++ b/packages/slice-machine/lib/models/common/Library.ts @@ -7,7 +7,7 @@ export const LibraryMeta = { t.partial({ name: t.string, version: t.string, - }) + }), ), }; diff --git a/packages/slice-machine/lib/models/common/Manifest.ts b/packages/slice-machine/lib/models/common/Manifest.ts index fc4bae4b65..8940c813ae 100644 --- a/packages/slice-machine/lib/models/common/Manifest.ts +++ b/packages/slice-machine/lib/models/common/Manifest.ts @@ -13,7 +13,7 @@ const apiEndpoint = new t.Type( return t.failure( input, context, - "could not parse apiEndpoint: invalid url." + "could not parse apiEndpoint: invalid url.", ); } @@ -23,13 +23,13 @@ const apiEndpoint = new t.Type( return t.failure( input, context, - 'apiEndpoint should end with "/api/v2".' + 'apiEndpoint should end with "/api/v2".', ); } const regx = new RegExp( "^https?://[a-z0-9][a-z0-9-]{2,}[a-z0-9](.cdn)?.(prismic.io|wroom.io|wroom.test|wroom-qa.com)/api/v2/?$", - "gi" + "gi", ); const result = regx.test(input); @@ -37,7 +37,7 @@ const apiEndpoint = new t.Type( ? t.success(input) : t.failure(input, context, `apiEndpoint should match ${regx.source}`); }, - t.identity + t.identity, ); export const Manifest = t.intersection([ diff --git a/packages/slice-machine/lib/models/common/ModelData.ts b/packages/slice-machine/lib/models/common/ModelData.ts index 9f3bc91f09..d2dc75d609 100644 --- a/packages/slice-machine/lib/models/common/ModelData.ts +++ b/packages/slice-machine/lib/models/common/ModelData.ts @@ -13,31 +13,31 @@ type LocalOnly = { local: L }; type RemoteOnly = { remote: R }; export function hasLocalAndRemote( - obj: T + obj: T, ): obj is T extends LocalAndRemote ? T : never { return "local" in obj && "remote" in obj; } export function hasLocal( - obj: T + obj: T, ): obj is T extends LocalAndRemote | LocalOnly ? T : never { return "local" in obj; } export function hasRemote( - obj: T + obj: T, ): obj is T extends LocalAndRemote | RemoteOnly ? T : never { return "remote" in obj; } export function isRemoteOnly( - obj: T + obj: T, ): obj is T extends RemoteOnly ? T : never { return hasRemote(obj) && !hasLocal(obj); } export function isLocalOnly( - obj: T + obj: T, ): obj is T extends LocalOnly ? T : never { return !hasRemote(obj) && hasLocal(obj); } @@ -70,7 +70,7 @@ export type RemoteOnlySlice = RemoteOnly & { export type LocalOrRemoteModel = LocalOrRemoteCustomType | LocalOrRemoteSlice; export function getModelId( - model: LocalOrRemote + model: LocalOrRemote, ): M["id"] { return hasLocal(model) ? model.local.id : model.remote.id; } diff --git a/packages/slice-machine/lib/models/common/ModelStatus/compareCustomTypeModels.ts b/packages/slice-machine/lib/models/common/ModelStatus/compareCustomTypeModels.ts index e9f5c21310..3fffce1808 100644 --- a/packages/slice-machine/lib/models/common/ModelStatus/compareCustomTypeModels.ts +++ b/packages/slice-machine/lib/models/common/ModelStatus/compareCustomTypeModels.ts @@ -3,7 +3,7 @@ import { ModelStatus } from "."; import { LocalAndRemoteCustomType } from "../ModelData"; export function compareCustomTypeLocalToRemote( - model: LocalAndRemoteCustomType + model: LocalAndRemoteCustomType, ): ModelStatus.Modified | ModelStatus.Synced { // If Custom Types are not equals then it was modified locally if (!equal(model.local, model.remote)) return ModelStatus.Modified; diff --git a/packages/slice-machine/lib/models/common/ModelStatus/compareSliceModels.ts b/packages/slice-machine/lib/models/common/ModelStatus/compareSliceModels.ts index ff1348a236..debaedccce 100644 --- a/packages/slice-machine/lib/models/common/ModelStatus/compareSliceModels.ts +++ b/packages/slice-machine/lib/models/common/ModelStatus/compareSliceModels.ts @@ -5,17 +5,17 @@ import { ModelStatus } from "."; import { LocalAndRemoteSlice } from "../ModelData"; export function compareSliceLocalToRemote( - model: LocalAndRemoteSlice + model: LocalAndRemoteSlice, ): ModelStatus.Modified | ModelStatus.Synced { const areScreenshotsEqual = compareScreenshots( model.remote, - model.localScreenshots + model.localScreenshots, ); if (!areScreenshotsEqual) return ModelStatus.Modified; const areModelsEquals = equal( stripImageUrl(model.local), - stripImageUrl(model.remote) + stripImageUrl(model.remote), ); if (!areModelsEquals) return ModelStatus.Modified; @@ -29,7 +29,7 @@ const stripImageUrl = (slice: SliceSM) => ({ export function compareScreenshots( remoteModel: SliceSM, - localScreenshots: Partial> + localScreenshots: Partial>, ) { return remoteModel.variations.every((variation) => { const localScreenshotHash = localScreenshots[variation.id]?.hash; diff --git a/packages/slice-machine/lib/models/common/ModelStatus/index.ts b/packages/slice-machine/lib/models/common/ModelStatus/index.ts index 9587a6f546..42c21aeb9c 100644 --- a/packages/slice-machine/lib/models/common/ModelStatus/index.ts +++ b/packages/slice-machine/lib/models/common/ModelStatus/index.ts @@ -36,14 +36,14 @@ export type ChangedCustomType = { }; const isSliceModel = ( - model: LocalAndRemoteSlice | LocalAndRemoteCustomType + model: LocalAndRemoteSlice | LocalAndRemoteCustomType, ): model is LocalAndRemoteSlice => { return "variations" in model.local && "variations" in model.remote; }; export function computeModelStatus( model: LocalOrRemoteSlice, - userHasAccessToPrismic: boolean + userHasAccessToPrismic: boolean, ): | { status: ModelStatus.Unknown; model: LocalOrRemoteSlice } | { status: ModelStatus.Deleted; model: RemoteOnlySlice } @@ -53,7 +53,7 @@ export function computeModelStatus( export function computeModelStatus( model: LocalOrRemoteCustomType, - userHasAccessToPrismic: boolean + userHasAccessToPrismic: boolean, ): | { status: ModelStatus.Unknown; model: LocalOrRemoteCustomType } | { status: ModelStatus.Deleted; model: RemoteOnlyCustomType } @@ -63,7 +63,7 @@ export function computeModelStatus( export function computeModelStatus( model: LocalOrRemoteModel, - userHasAccessToPrismic: boolean + userHasAccessToPrismic: boolean, ): | { status: ModelStatus.Unknown; @@ -85,7 +85,7 @@ export function computeModelStatus( export function computeModelStatus( model: LocalOrRemoteModel, - userHasAccessToPrismic: boolean + userHasAccessToPrismic: boolean, ): | { status: ModelStatus.Unknown; diff --git a/packages/slice-machine/lib/models/common/Screenshots.ts b/packages/slice-machine/lib/models/common/Screenshots.ts index 43682de15b..0252042c05 100644 --- a/packages/slice-machine/lib/models/common/Screenshots.ts +++ b/packages/slice-machine/lib/models/common/Screenshots.ts @@ -31,7 +31,7 @@ export type ScreenshotResponse = | ScreenshotSuccessResponse; export const isError = ( - response: ScreenshotResponse + response: ScreenshotResponse, ): response is ScreenshotErrorResponse => "err" in response; export type TmpFile = File & { path: string }; diff --git a/packages/slice-machine/lib/models/common/Slice.ts b/packages/slice-machine/lib/models/common/Slice.ts index 4317f85350..e1b03262d7 100644 --- a/packages/slice-machine/lib/models/common/Slice.ts +++ b/packages/slice-machine/lib/models/common/Slice.ts @@ -56,13 +56,13 @@ export const Variations = { ...variation, primary: variation.primary?.reduce( (acc, { key, value }) => ({ ...acc, [key]: value }), - {} + {}, ), items: variation.items?.reduce( (acc, { key, value }) => ({ ...acc, [key]: value }), - {} + {}, ), - }) + }), ); }, @@ -81,14 +81,14 @@ export const Variations = { ([key, value]) => ({ key, value, - }) + }), ), // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing items: Object.entries(variation.items || {}).map(([key, value]) => ({ key, value, })), - }) + }), ); }, }; @@ -101,7 +101,7 @@ export const Slices = { ...slice, // eslint-disable-next-line @typescript-eslint/unbound-method variations: slice.variations.map(Variations.fromSM), - }) + }), ); }, @@ -113,7 +113,7 @@ export const Slices = { ...slice, // eslint-disable-next-line @typescript-eslint/unbound-method variations: slice.variations.map(Variations.toSM), - }) + }), ); }, }; diff --git a/packages/slice-machine/lib/models/common/Slices.ts b/packages/slice-machine/lib/models/common/Slices.ts index c6b907afaa..66623d13ca 100644 --- a/packages/slice-machine/lib/models/common/Slices.ts +++ b/packages/slice-machine/lib/models/common/Slices.ts @@ -13,7 +13,7 @@ export const SlicesSM = t.type({ t.type({ key: t.string, value: t.union([LegacySlice, CompositeSlice, SharedSliceRef]), - }) + }), ), }); export type SlicesSM = t.TypeOf; @@ -29,10 +29,10 @@ export const SliceZone = { config: { choices: slices.value.reduce( (acc, { key, value }) => ({ ...acc, [key]: value }), - {} + {}, ), }, - }) + }), ); }, @@ -44,9 +44,9 @@ export const SliceZone = { key, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing value: Object.entries(slices.config?.choices || []).map( - ([key, value]) => ({ key, value }) + ([key, value]) => ({ key, value }), ), - }) + }), ); }, }; diff --git a/packages/slice-machine/lib/models/common/UserProfile.ts b/packages/slice-machine/lib/models/common/UserProfile.ts index 0e7b6295d5..b5d7bd53c1 100644 --- a/packages/slice-machine/lib/models/common/UserProfile.ts +++ b/packages/slice-machine/lib/models/common/UserProfile.ts @@ -8,7 +8,7 @@ export const UserProfile = t.exact( email: t.string, firstName: t.string, lastName: t.string, - }) + }), ); export type UserProfile = t.TypeOf; diff --git a/packages/slice-machine/lib/models/common/Variation.ts b/packages/slice-machine/lib/models/common/Variation.ts index d24e241aa4..846809b734 100644 --- a/packages/slice-machine/lib/models/common/Variation.ts +++ b/packages/slice-machine/lib/models/common/Variation.ts @@ -13,7 +13,7 @@ export const Variation = { variation: VariationSM, widgetsArea: WidgetsArea, start: number, - end: number + end: number, ): VariationSM { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const widgets = variation[widgetsArea] || []; @@ -23,7 +23,7 @@ export const Variation = { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!reorderedWidget) throw new Error( - `Unable to reorder the widget at index ${start}. the list of widgets contains only ${widgets.length} elements.` + `Unable to reorder the widget at index ${start}. the list of widgets contains only ${widgets.length} elements.`, ); const reorderedArea = widgets.reduce((acc, widget, index) => { @@ -48,7 +48,7 @@ export const Variation = { widgetsArea: WidgetsArea, previousKey: string, newKey: string, - newValue: NestableWidget + newValue: NestableWidget, ): VariationSM { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const widgets = variation[widgetsArea] || []; @@ -69,7 +69,7 @@ export const Variation = { variation: VariationSM, widgetsArea: WidgetsArea, key: string, - value: NestableWidget + value: NestableWidget, ): VariationSM { return { ...variation, @@ -80,12 +80,12 @@ export const Variation = { deleteWidget( variation: VariationSM, widgetsArea: WidgetsArea, - widgetKey: string + widgetKey: string, ): VariationSM { return { ...variation, [widgetsArea]: variation[widgetsArea]?.filter( - ({ key }) => widgetKey !== key + ({ key }) => widgetKey !== key, ), }; }, diff --git a/packages/slice-machine/lib/models/common/normalizers/customType.ts b/packages/slice-machine/lib/models/common/normalizers/customType.ts index db5c335088..e001440e92 100644 --- a/packages/slice-machine/lib/models/common/normalizers/customType.ts +++ b/packages/slice-machine/lib/models/common/normalizers/customType.ts @@ -3,7 +3,7 @@ import { CustomTypeSM } from "@lib/models/common/CustomType"; export const normalizeFrontendCustomType = ( localCustomType: CustomTypeSM, - remoteCustomType?: CustomTypeSM + remoteCustomType?: CustomTypeSM, ) => { return remoteCustomType ? { @@ -21,13 +21,13 @@ export const normalizeFrontendCustomType = ( export const normalizeFrontendCustomTypes = ( localCustomTypes: ReadonlyArray, - remoteCustomTypes: ReadonlyArray + remoteCustomTypes: ReadonlyArray, ): Record => { const customTypes: Record = {}; localCustomTypes.forEach((t) => (customTypes[t.id] = { local: t })); remoteCustomTypes.forEach( - (t) => (customTypes[t.id] = { ...customTypes[t.id], remote: t }) + (t) => (customTypes[t.id] = { ...customTypes[t.id], remote: t }), ); return customTypes; diff --git a/packages/slice-machine/lib/models/common/normalizers/slices.ts b/packages/slice-machine/lib/models/common/normalizers/slices.ts index dcae34f7fd..dc6872de8d 100644 --- a/packages/slice-machine/lib/models/common/normalizers/slices.ts +++ b/packages/slice-machine/lib/models/common/normalizers/slices.ts @@ -4,12 +4,12 @@ import { Library, Component } from "@lib/models/common/Library"; export const normalizeFrontendSlices = ( localLibraries: ReadonlyArray>, - remoteSlices: ReadonlyArray + remoteSlices: ReadonlyArray, ): LocalOrRemoteSlice[] => { const slices: Record = {}; const localComponents = localLibraries.flatMap( - (library) => library.components + (library) => library.components, ); localComponents.forEach((component) => { diff --git a/packages/slice-machine/lib/models/common/widgets/Boolean/index.ts b/packages/slice-machine/lib/models/common/widgets/Boolean/index.ts index 4ec586e808..8c4ecbd5bb 100644 --- a/packages/slice-machine/lib/models/common/widgets/Boolean/index.ts +++ b/packages/slice-machine/lib/models/common/widgets/Boolean/index.ts @@ -36,7 +36,7 @@ const FormFields = { { required: false }, null, "false", - "Value the content creator sees (Output as 'false' in the API)." + "Value the content creator sees (Output as 'false' in the API).", ), // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call placeholder_true: Input( @@ -44,7 +44,7 @@ const FormFields = { { required: false }, null, "true", - "Value the content creator sees (Output as 'true' in the API)" + "Value the content creator sees (Output as 'true' in the API)", ), default_value: CheckBox("Default to true"), }; diff --git a/packages/slice-machine/lib/models/common/widgets/ContentRelationship/Form.tsx b/packages/slice-machine/lib/models/common/widgets/ContentRelationship/Form.tsx index 0659a5dd39..56cbf8d2e4 100644 --- a/packages/slice-machine/lib/models/common/widgets/ContentRelationship/Form.tsx +++ b/packages/slice-machine/lib/models/common/widgets/ContentRelationship/Form.tsx @@ -43,7 +43,7 @@ const WidgetForm = ({ const selectValues = formValues.config.customtypes ? formValues.config.customtypes.map((id) => { const ct = customTypes.find( - (frontendCustomType) => frontendCustomType.local.id === id + (frontendCustomType) => frontendCustomType.local.id === id, ); return { value: ct?.local.id, label: ct?.local.label }; }) @@ -82,7 +82,7 @@ const WidgetForm = ({ if (v) { void setFieldValue( "config.customtypes", - v.map(({ value }) => value) + v.map(({ value }) => value), ); } }} diff --git a/packages/slice-machine/lib/models/common/widgets/ContentRelationship/index.ts b/packages/slice-machine/lib/models/common/widgets/ContentRelationship/index.ts index a64d207aed..7abe7da80b 100644 --- a/packages/slice-machine/lib/models/common/widgets/ContentRelationship/index.ts +++ b/packages/slice-machine/lib/models/common/widgets/ContentRelationship/index.ts @@ -76,8 +76,8 @@ export const ContentRelationshipWidget: Widget = { ...initialValues, customtypes: initialValues.customtypes.filter((ct) => customTypes.find( - (frontendCustomType) => frontendCustomType.local.id === ct - ) + (frontendCustomType) => frontendCustomType.local.id === ct, + ), ), }; }, diff --git a/packages/slice-machine/lib/models/common/widgets/Group/ListItem/index.jsx b/packages/slice-machine/lib/models/common/widgets/Group/ListItem/index.jsx index 801c24c1a3..e77e9e4602 100644 --- a/packages/slice-machine/lib/models/common/widgets/Group/ListItem/index.jsx +++ b/packages/slice-machine/lib/models/common/widgets/Group/ListItem/index.jsx @@ -95,7 +95,7 @@ const CustomListItem = ({ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access result.source.index, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access - result.destination.index + result.destination.index, ); }; @@ -151,7 +151,7 @@ const CustomListItem = ({ Widgets, config, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - type + type, ); if (!widget) { return null; @@ -185,7 +185,7 @@ const CustomListItem = ({ renderHintBase={({ item }) => // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access `data.${groupItem.key}${transformKeyAccessor( - item.key + item.key, )}` } Widgets={Widgets} diff --git a/packages/slice-machine/lib/models/common/widgets/Image/Form.tsx b/packages/slice-machine/lib/models/common/widgets/Image/Form.tsx index eb22b7a4d8..ef535b5327 100644 --- a/packages/slice-machine/lib/models/common/widgets/Image/Form.tsx +++ b/packages/slice-machine/lib/models/common/widgets/Image/Form.tsx @@ -23,7 +23,7 @@ const nullableNumberSchema = () => { .nullable() .transform((value: string | number, originalValue: string | number) => // When the user empties the field, it should convert it to null so that "auto" dimensions are set - originalValue === "" ? null : value + originalValue === "" ? null : value, ); }; @@ -56,7 +56,7 @@ const FormFields = { const hasWidthOrHeight = hasWidth || hasHeight; return value.name && hasWidthOrHeight; }, - }) + }), ), }, }; @@ -80,7 +80,7 @@ const thumbText = ( width?: number | string; height?: number | string; } = {}, - allowAuto = false + allowAuto = false, ) => { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (allowAuto && !width && !height) { diff --git a/packages/slice-machine/lib/models/common/widgets/StructuredText/Form.tsx b/packages/slice-machine/lib/models/common/widgets/StructuredText/Form.tsx index 173538c52e..130ad8b5d8 100644 --- a/packages/slice-machine/lib/models/common/widgets/StructuredText/Form.tsx +++ b/packages/slice-machine/lib/models/common/widgets/StructuredText/Form.tsx @@ -29,7 +29,7 @@ const _createInitialOptions = (str: string) => { function getValueFromYupContext( ctx: yup.TestContext, - key: string + key: string, ): string | null { if ( has("parent", ctx) && @@ -193,7 +193,7 @@ const WidgetForm: React.FC<{ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (acceptOptions.find((e) => e === opt.value)) { return setAcceptOptions( - acceptOptions.filter((e) => e !== opt.value) + acceptOptions.filter((e) => e !== opt.value), ); } setAcceptOptions([...acceptOptions, opt.value]); diff --git a/packages/slice-machine/lib/models/common/widgets/StructuredText/index.ts b/packages/slice-machine/lib/models/common/widgets/StructuredText/index.ts index f500442692..6aa369b0de 100644 --- a/packages/slice-machine/lib/models/common/widgets/StructuredText/index.ts +++ b/packages/slice-machine/lib/models/common/widgets/StructuredText/index.ts @@ -39,8 +39,8 @@ const schema = yup.object().shape({ config: createValidationSchema( removeProp( { ...(FormFields as Record), ...ManualFields }, - "id" - ) + "id", + ), ), }); diff --git a/packages/slice-machine/lib/utils/index.ts b/packages/slice-machine/lib/utils/index.ts index d9f7af4f39..dab084dc98 100644 --- a/packages/slice-machine/lib/utils/index.ts +++ b/packages/slice-machine/lib/utils/index.ts @@ -26,7 +26,7 @@ export const ensureDnDDestination = (result: DropResult): boolean => { export const ensureWidgetTypeExistence = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-explicit-any Widgets: { [x: string]: Widget }, - type: string + type: string, ) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-explicit-any const widget: Widget = Widgets[type]; diff --git a/packages/slice-machine/lib/utils/poll.ts b/packages/slice-machine/lib/utils/poll.ts index f7c26a09c6..b309a28809 100644 --- a/packages/slice-machine/lib/utils/poll.ts +++ b/packages/slice-machine/lib/utils/poll.ts @@ -5,12 +5,12 @@ export async function startPolling< fn: () => Promise, validate: (result: Result) => result is ValidatedResult, interval: number, - maxAttempts: number + maxAttempts: number, ): Promise { let attempts = 0; const checkCondition = ( resolve: (value: ValidatedResult | PromiseLike) => void, - reject: (reason?: Error) => void + reject: (reason?: Error) => void, ): void => { Promise.resolve(fn()) .then((result) => { diff --git a/packages/slice-machine/lib/utils/shared/customTypes.ts b/packages/slice-machine/lib/utils/shared/customTypes.ts index 019869b799..20fff1bcff 100644 --- a/packages/slice-machine/lib/utils/shared/customTypes.ts +++ b/packages/slice-machine/lib/utils/shared/customTypes.ts @@ -2,7 +2,7 @@ import { CustomTypeSM } from "@lib/models/common/CustomType"; export const filterSliceFromCustomType = ( ct: T, - sliceId: string + sliceId: string, ): T => { if (ct === undefined) { return ct; diff --git a/packages/slice-machine/next.config.mjs b/packages/slice-machine/next.config.mjs index fde9c9b703..077bb0501b 100644 --- a/packages/slice-machine/next.config.mjs +++ b/packages/slice-machine/next.config.mjs @@ -9,7 +9,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); /** @type {{ version: string }} */ const pkg = JSON.parse( - fs.readFileSync(path.resolve(__dirname, "package.json"), "utf8") + fs.readFileSync(path.resolve(__dirname, "package.json"), "utf8"), ); /** @type string */ @@ -31,7 +31,7 @@ if (process.env.NODE_ENV !== "development") { if (!process.env.SENTRY_AUTH_TOKEN) { console.warn("⚠️ Creating a production build with no Sentry config"); console.warn( - "⚠️ A release won't be created and the sourcemap won't be uploaded" + "⚠️ A release won't be created and the sourcemap won't be uploaded", ); console.warn("⚠️ To fix this add SENTRY_AUTH_TOKEN to your environment"); } else { @@ -78,7 +78,7 @@ if (process.env.NODE_ENV !== "development") { widenClientFileUpload: true, }, }, - sentryWebpackPluginOptions + sentryWebpackPluginOptions, ); } } diff --git a/packages/slice-machine/pages/_app.tsx b/packages/slice-machine/pages/_app.tsx index 4210c73dcc..e7d5e3a6bf 100644 --- a/packages/slice-machine/pages/_app.tsx +++ b/packages/slice-machine/pages/_app.tsx @@ -94,7 +94,7 @@ function MyApp({ const normalizedCustomTypes = normalizeFrontendCustomTypes( serverState.customTypes, - serverState.remoteCustomTypes + serverState.remoteCustomTypes, ); const { store, persistor } = configureStore({ diff --git a/packages/slice-machine/pages/api/embed.js b/packages/slice-machine/pages/api/embed.js index 186ed3ecaa..943e6793eb 100644 --- a/packages/slice-machine/pages/api/embed.js +++ b/packages/slice-machine/pages/api/embed.js @@ -2,7 +2,7 @@ import { extract } from "@extractus/oembed-extractor"; export default async function handler(req, res) { const oembed = await extract( - "https://twitter.com/rachelnabors/status/1354790533646979073?s=20" + "https://twitter.com/rachelnabors/status/1354790533646979073?s=20", ); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call res.status(200).json(oembed); diff --git a/packages/slice-machine/pages/slices.tsx b/packages/slice-machine/pages/slices.tsx index 0692a09a95..5f0fa1da3d 100644 --- a/packages/slice-machine/pages/slices.tsx +++ b/packages/slice-machine/pages/slices.tsx @@ -44,12 +44,12 @@ const SlicesIndex: React.FunctionComponent = () => { (store: SliceMachineStoreType) => ({ remoteSlices: getRemoteSlices(store), libraries: getLibraries(store), - }) + }), ); const [isCreateSliceModalOpen, setIsCreateSliceModalOpen] = useState(false); const localLibraries: LibraryUI[] = libraries.filter( - (library) => library.isLocal + (library) => library.isLocal, ); const sortedLibraries: LibraryUI[] = libraries.map((library) => { // Sort slices @@ -188,7 +188,7 @@ const SlicesIndex: React.FunctionComponent = () => { onOpenModal({ sliceFilterFn: (s) => s.filter( - (e) => e.model.id === slice.model.id + (e) => e.model.id === slice.model.id, ), }); }} @@ -226,7 +226,7 @@ const SlicesIndex: React.FunctionComponent = () => { toast.success( SliceToastMessage({ path: `${libraryName}/${newSlice.name}/model.json`, - }) + }), ); }} onClose={() => { diff --git a/packages/slice-machine/src/apiClient.ts b/packages/slice-machine/src/apiClient.ts index d747c948a8..12e21e2341 100644 --- a/packages/slice-machine/src/apiClient.ts +++ b/packages/slice-machine/src/apiClient.ts @@ -43,8 +43,8 @@ export const getState = async (): Promise => { url: URL.createObjectURL(screenshot.data), }, ]; - } - ) + }, + ), ), }; }), @@ -56,7 +56,7 @@ export const getState = async (): Promise => { remoteCustomTypes: rawState.remoteCustomTypes.map( (remoteCustomTypeModel) => { return CustomTypes.toSM(remoteCustomTypeModel); - } + }, ), remoteSlices: rawState.remoteSlices.map((remoteSliceModel) => { return Slices.toSM(remoteSliceModel); @@ -69,7 +69,7 @@ export const getState = async (): Promise => { /** Custom Type Routes * */ export const saveCustomType = async ( - customType: CustomTypeSM + customType: CustomTypeSM, ): ReturnType => { return await managerClient.customTypes.updateCustomType({ model: CustomTypes.fromSM(customType), @@ -79,7 +79,7 @@ export const saveCustomType = async ( /** Slice Routes * */ export const renameSlice = async ( slice: SliceSM, - libName: string + libName: string, ): ReturnType => { return await managerClient.slices.renameSlice({ libraryID: libName, @@ -94,7 +94,7 @@ export const deleteSlice = async (sliceId: string, libName: string) => }); export const generateSliceScreenshotApiClient = async ( - params: ScreenshotRequest + params: ScreenshotRequest, ): Promise< | { url: string; @@ -130,7 +130,7 @@ export const generateSliceScreenshotApiClient = async ( }; export const generateSliceCustomScreenshotApiClient = async ( - params: CustomScreenshotRequest + params: CustomScreenshotRequest, ): Promise<{ url: string; errors: Awaited< @@ -151,7 +151,7 @@ export const generateSliceCustomScreenshotApiClient = async ( }; export const updateSliceApiClient = async ( - component: ComponentUI + component: ComponentUI, ): Promise< Awaited> > => { @@ -222,7 +222,7 @@ export type ReadSliceMockRequest = { }; export const readSliceMocks = async ( - payload: ReadSliceMockRequest + payload: ReadSliceMockRequest, ): ReturnType => { return await managerClient.slices.readSliceMocks({ libraryID: payload.libraryID, @@ -231,7 +231,7 @@ export const readSliceMocks = async ( }; export const saveSliceMock = async ( - payload: SaveSliceMockRequest + payload: SaveSliceMockRequest, ): ReturnType => { return await managerClient.slices.updateSliceMocks({ libraryID: payload.libraryID, @@ -271,7 +271,7 @@ export const getChangelogApiClient = async (): Promise => { releaseNote: releaseNotes ?? null, kind: versionWithKind.kind, }; - }) + }), ); return { diff --git a/packages/slice-machine/src/components/BaseHoverCard/BaseHoverCard.test.tsx b/packages/slice-machine/src/components/BaseHoverCard/BaseHoverCard.test.tsx index 2fb2d00420..792f64edcd 100644 --- a/packages/slice-machine/src/components/BaseHoverCard/BaseHoverCard.test.tsx +++ b/packages/slice-machine/src/components/BaseHoverCard/BaseHoverCard.test.tsx @@ -11,7 +11,7 @@ describe("BaseHoverCard", () => { const { user } = render( Hello}>
hover content
-
+ , ); expect(screen.queryByText("hover content")).not.toBeInTheDocument(); diff --git a/packages/slice-machine/src/components/HoverCard/HoverCard.tsx b/packages/slice-machine/src/components/HoverCard/HoverCard.tsx index caa32b2669..5ccb7e6895 100644 --- a/packages/slice-machine/src/components/HoverCard/HoverCard.tsx +++ b/packages/slice-machine/src/components/HoverCard/HoverCard.tsx @@ -60,7 +60,7 @@ export const HoverCard: FC = ({ const handleDefaultOpening = useCallback( () => setOpen((wasOpen) => wasOpen === false), - [setOpen] + [setOpen], ); useDelayedAction({ diff --git a/packages/slice-machine/src/components/SideNav/SideNav.tsx b/packages/slice-machine/src/components/SideNav/SideNav.tsx index 8fbdd499b4..17b3ad30da 100644 --- a/packages/slice-machine/src/components/SideNav/SideNav.tsx +++ b/packages/slice-machine/src/components/SideNav/SideNav.tsx @@ -124,7 +124,7 @@ export const SideNavLink: FC = ({ {title} {RightElement} - + , ); type RightElementProps = PropsWithChildren< @@ -172,7 +172,7 @@ export const UpdateInfo: FC = ({ {createElement( component, { ...{ className: styles.updateInfoLink, onClick }, href }, - "Learn more" + "Learn more", )} ); diff --git a/packages/slice-machine/src/components/Table/Table.test.tsx b/packages/slice-machine/src/components/Table/Table.test.tsx index cc0ae18920..62b3777c14 100644 --- a/packages/slice-machine/src/components/Table/Table.test.tsx +++ b/packages/slice-machine/src/components/Table/Table.test.tsx @@ -36,7 +36,7 @@ const renderTable = () => { Cell 2 - B - + , ), onClickFirstRow, }; diff --git a/packages/slice-machine/src/components/TextLink/TextLink.tsx b/packages/slice-machine/src/components/TextLink/TextLink.tsx index 93851a0ae2..3490804204 100644 --- a/packages/slice-machine/src/components/TextLink/TextLink.tsx +++ b/packages/slice-machine/src/components/TextLink/TextLink.tsx @@ -44,7 +44,7 @@ export const TextLink: FC = (props) => { className: clsx( endIcon.props.className, styles.endIcon, - styles.iconVariant[textVariant] + styles.iconVariant[textVariant], ), }) : null} diff --git a/packages/slice-machine/src/domain/__tests__/CustomTypeModel.test.ts b/packages/slice-machine/src/domain/__tests__/CustomTypeModel.test.ts index d39194db8c..18873f0f55 100644 --- a/packages/slice-machine/src/domain/__tests__/CustomTypeModel.test.ts +++ b/packages/slice-machine/src/domain/__tests__/CustomTypeModel.test.ts @@ -62,7 +62,7 @@ describe("CustomTypeModel test suite", () => { CustomTypeModel.getSectionEntries({ ...mockCustomType, json: {}, - }) + }), ).toEqual([]); }); @@ -78,13 +78,13 @@ describe("CustomTypeModel test suite", () => { CustomTypeModel.getMainSectionEntry({ ...mockCustomType, json: {}, - }) + }), ).toEqual(undefined); }); it("getSection should return the section matching the key", () => { expect( - CustomTypeModel.getSection(mockCustomType, "anotherSection") + CustomTypeModel.getSection(mockCustomType, "anotherSection"), ).toEqual(anotherSection); }); @@ -95,14 +95,14 @@ describe("CustomTypeModel test suite", () => { ...mockCustomType, json: {}, }, - "mainSection" - ) + "mainSection", + ), ).toEqual(undefined); }); it("getSectionSliceZoneConfig should return the config of the given section", () => { expect( - CustomTypeModel.getSectionSliceZoneConfig(mockCustomType, "mainSection") + CustomTypeModel.getSectionSliceZoneConfig(mockCustomType, "mainSection"), ).toEqual({ choices: { hero_banner: { @@ -122,8 +122,8 @@ describe("CustomTypeModel test suite", () => { ...mockCustomType, json: {}, }, - "mainSection" - ) + "mainSection", + ), ).toEqual(undefined); }); @@ -136,8 +136,8 @@ describe("CustomTypeModel test suite", () => { anotherSection: {}, }, }, - "anotherSection" - ) + "anotherSection", + ), ).toEqual("slices"); }); @@ -145,8 +145,8 @@ describe("CustomTypeModel test suite", () => { expect( CustomTypeModel.findNextSectionSliceZoneKey( mockCustomType, - "anotherSection" - ) + "anotherSection", + ), ).toEqual("slices1"); }); @@ -165,8 +165,8 @@ describe("CustomTypeModel test suite", () => { anotherSection, }, }, - "anotherSection" - ) + "anotherSection", + ), ).toEqual("slices2"); }); @@ -185,14 +185,14 @@ describe("CustomTypeModel test suite", () => { anotherSection, }, }, - "anotherSection" - ) + "anotherSection", + ), ).toEqual("slices3"); }); it("createSectionSliceZone should return the given custom type with a slice zone for given section", () => { expect( - CustomTypeModel.createSectionSliceZone(mockCustomType, "anotherSection") + CustomTypeModel.createSectionSliceZone(mockCustomType, "anotherSection"), ).toEqual({ ...mockCustomType, json: { @@ -210,7 +210,7 @@ describe("CustomTypeModel test suite", () => { it("createSectionSliceZone should return the same custom type if slice zone already exist for given section", () => { expect( - CustomTypeModel.createSectionSliceZone(mockCustomType, "mainSection") + CustomTypeModel.createSectionSliceZone(mockCustomType, "mainSection"), ).toEqual(mockCustomType); }); @@ -229,7 +229,7 @@ describe("CustomTypeModel test suite", () => { mainSection: {}, anotherSection, }, - }) + }), ).toEqual({ ...mockCustomType, json: { diff --git a/packages/slice-machine/src/domain/customType.ts b/packages/slice-machine/src/domain/customType.ts index df7b123698..76fa767168 100644 --- a/packages/slice-machine/src/domain/customType.ts +++ b/packages/slice-machine/src/domain/customType.ts @@ -5,13 +5,13 @@ import { } from "@prismicio/types-internal/lib/customtypes"; export function getSectionEntries( - customType: CustomType + customType: CustomType, ): [string, DynamicSection][] { return Object.entries(customType.json); } export function getMainSectionEntry( - customType: CustomType + customType: CustomType, ): [string, DynamicSection] | undefined { // Currently we cannot rely on the name of the main section // since it's possible to rename it @@ -21,14 +21,14 @@ export function getMainSectionEntry( export function getSection( customType: CustomType, - sectionId: string + sectionId: string, ): DynamicSection | undefined { return customType.json[sectionId]; } export function getSectionSliceZoneConfig( customType: CustomType, - sectionId: string + sectionId: string, ): DynamicSlicesConfig | undefined { const section = getSection(customType, sectionId); @@ -39,7 +39,7 @@ export function getSectionSliceZoneConfig( // In Slice Machine we currently only support one slice zone per section // so we retrieve the first one const maybeSliceZone = Object.values(section).find( - (value) => value.type === "Slices" + (value) => value.type === "Slices", ); return maybeSliceZone?.config ?? undefined; @@ -51,13 +51,13 @@ export function getSectionSliceZoneConfig( // it's used as an API id export function findNextSectionSliceZoneKey( customType: CustomType, - sectionId: string + sectionId: string, ): string { const sectionsEntries = getSectionEntries(customType); const sectionIndex = sectionsEntries.findIndex(([key]) => key === sectionId); const existingKeys = sectionsEntries.flatMap(([_, section]) => - Object.keys(section).filter((key) => section[key].type === "Slices") + Object.keys(section).filter((key) => section[key].type === "Slices"), ); let i = sectionIndex; @@ -72,11 +72,11 @@ export function findNextSectionSliceZoneKey( export function createSectionSliceZone( customType: CustomType, - sectionId: string + sectionId: string, ): CustomType { const maybeSectionSliceZoneConfig = getSectionSliceZoneConfig( customType, - sectionId + sectionId, ); // If the section already has a slice zone, return the custom type as is @@ -87,7 +87,7 @@ export function createSectionSliceZone( // Get the next available section key for the slice zone const availableSectionSlicesKey = findNextSectionSliceZoneKey( customType, - sectionId + sectionId, ); return { diff --git a/packages/slice-machine/src/domain/slice.ts b/packages/slice-machine/src/domain/slice.ts index acf2838db1..c846ed240e 100644 --- a/packages/slice-machine/src/domain/slice.ts +++ b/packages/slice-machine/src/domain/slice.ts @@ -11,7 +11,7 @@ export function countMissingScreenshots(slice: ComponentUI): number { } export function getNonSharedSliceLabel( - slice: CompositeSlice | LegacySlice + slice: CompositeSlice | LegacySlice, ): string { return ( slice.config?.label ?? @@ -26,14 +26,14 @@ export function getNonSharedSliceLabel( export function getScreenshotUrl( slice: ComponentUI, - variation: VariationSM + variation: VariationSM, ): string | undefined { return slice.screenshots[variation.id]?.url; } export function getFieldMappingFingerprint( slice: LegacySlice | CompositeSlice | VariationSM, - sliceName: string + sliceName: string, ): { primary: string; items: string; @@ -69,12 +69,12 @@ export function getFieldMappingFingerprint( primary: JSON.stringify( Object.keys(primary) .sort() - .map((key) => [key, primary[key]]) + .map((key) => [key, primary[key]]), ), items: JSON.stringify( Object.keys(items) .sort() - .map((key) => [key, items[key]]) + .map((key) => [key, items[key]]), ), }; } diff --git a/packages/slice-machine/src/features/changes/StatusBadge.tsx b/packages/slice-machine/src/features/changes/StatusBadge.tsx index fd46bcf57e..d436669a04 100644 --- a/packages/slice-machine/src/features/changes/StatusBadge.tsx +++ b/packages/slice-machine/src/features/changes/StatusBadge.tsx @@ -32,7 +32,7 @@ type StatusBadgeContent = { }; function getStatusBadgeContent( - args: GetStatusBadgeContentArgs + args: GetStatusBadgeContentArgs, ): StatusBadgeContent { const modelTypeLabel = modelTypeLabels[args.modelType]; switch (args.modelStatus) { diff --git a/packages/slice-machine/src/features/customTypes/EditDropdown.tsx b/packages/slice-machine/src/features/customTypes/EditDropdown.tsx index 30dbf979c5..28a9fffdfe 100644 --- a/packages/slice-machine/src/features/customTypes/EditDropdown.tsx +++ b/packages/slice-machine/src/features/customTypes/EditDropdown.tsx @@ -49,7 +49,7 @@ export const EditDropdown: FC = ({ CUSTOM_TYPES_CONFIG.custom.getBuilderPagePathname(customType.id); if (router.asPath === customPagePathname) { const pagePagePathname = CUSTOM_TYPES_CONFIG.page.getBuilderPagePathname( - customType.id + customType.id, ); void router.replace(pagePagePathname); setCustomTypeBeingConverted(false); diff --git a/packages/slice-machine/src/features/customTypes/PageTypeOnboarding.tsx b/packages/slice-machine/src/features/customTypes/PageTypeOnboarding.tsx index c9c15ea1ab..19b86a1988 100644 --- a/packages/slice-machine/src/features/customTypes/PageTypeOnboarding.tsx +++ b/packages/slice-machine/src/features/customTypes/PageTypeOnboarding.tsx @@ -17,9 +17,9 @@ export function PageTypeOnboarding() { (store: SliceMachineStoreType) => ({ isCreatingCustomType: isLoading( store, - LoadingKeysEnum.CREATE_CUSTOM_TYPE + LoadingKeysEnum.CREATE_CUSTOM_TYPE, ), - }) + }), ); // State to ensure button loader is still visible while redirecting const [isButtonLoading, setIsButtonLoading] = useState(false); diff --git a/packages/slice-machine/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx b/packages/slice-machine/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx index da98919c6d..2522e1cc5a 100644 --- a/packages/slice-machine/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx +++ b/packages/slice-machine/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx @@ -22,7 +22,7 @@ mockRouter.useParser( createDynamicRouteParser([ "/page-types/[pageTypeId]", "/custom-types/[customTypeId]", - ]) + ]), ); const formats = [ @@ -79,7 +79,7 @@ describe.each(formats)( // Get form input const renamedCustomType = `My renamed ${format} type`; const nameInput = within(form).getByPlaceholderText( - `A display name for the ${format} type` + `A display name for the ${format} type`, ); // Clear the name and type a new one @@ -92,10 +92,10 @@ describe.each(formats)( const folder = customType.format === "page" ? "Page types" : "Custom types"; expect( - screen.getByTestId(`breadcrumb-${folder}-${renamedCustomType}`) + screen.getByTestId(`breadcrumb-${folder}-${renamedCustomType}`), ).toBeVisible(); }); - } + }, ); function createCustomTypeMock(format: CustomTypeFormat): CustomType { @@ -155,7 +155,7 @@ async function renderCustomTypesBuilderPage({ createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const customTypeMockStore = { @@ -165,7 +165,7 @@ async function renderCustomTypesBuilderPage({ ...obj, [item.id]: { local: CustomTypes.toSM(item) }, }), - {} + {}, ), environment: { manifest: { apiEndpoint: "https://foo.cdn.prismic.io/api/v2" }, @@ -179,7 +179,7 @@ async function renderCustomTypesBuilderPage({ const folder = customType.format === "page" ? "Page types" : "Custom types"; expect( - screen.getByTestId(`breadcrumb-${folder}-${customType.label as string}`) + screen.getByTestId(`breadcrumb-${folder}-${customType.label as string}`), ).toBeVisible(); return renderResults; diff --git a/packages/slice-machine/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx b/packages/slice-machine/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx index 5e4f0b2b4f..2571268fae 100644 --- a/packages/slice-machine/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx +++ b/packages/slice-machine/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx @@ -42,18 +42,18 @@ describe.each(formats)( .closest("tr") as HTMLElement; expect(within(row).getByText(customTypeMock.id)).toBeVisible(); expect( - within(row).getByText(customTypeMock.label as string) + within(row).getByText(customTypeMock.label as string), ).toBeVisible(); expect( within(row).getByText( - customTypeMock.repeatable ? "Reusable" : "Single" - ) + customTypeMock.repeatable ? "Reusable" : "Single", + ), ).toBeVisible(); } // Check that there is the correct number of custom types displayed expect(screen.getAllByText(/MyID/)).toHaveLength( - customTypesMockByFormat[format].length + customTypesMockByFormat[format].length, ); }); @@ -65,7 +65,7 @@ describe.each(formats)( // Ensure the modal is visible expect( - await screen.findByText(`Create a new ${format} type`) + await screen.findByText(`Create a new ${format} type`), ).toBeVisible(); // Scope the test to the modal @@ -75,10 +75,10 @@ describe.each(formats)( // Get form inputs const idInput = within(form).getByPlaceholderText( - CUSTOM_TYPES_MESSAGES[format].inputPlaceholder + CUSTOM_TYPES_MESSAGES[format].inputPlaceholder, ); const nameInput = within(form).getByPlaceholderText( - `A display name for the ${format} type` + `A display name for the ${format} type`, ); // Fill the form @@ -95,7 +95,7 @@ describe.each(formats)( // Check that the redirection has been done if (format === "page") { expect(mockRouter.asPath).toEqual( - `/${format}-types/${newCustomType}?newPageType=true` + `/${format}-types/${newCustomType}?newPageType=true`, ); } else { expect(mockRouter.asPath).toEqual(`/${format}-types/${newCustomType}`); @@ -125,7 +125,7 @@ describe.each(formats)( // Check that the custom type is not visible await waitFor(() => { expect( - screen.queryByText(customTypesMockByFormat[format][0].id) + screen.queryByText(customTypesMockByFormat[format][0].id), ).not.toBeInTheDocument(); }); }); @@ -155,7 +155,7 @@ describe.each(formats)( // Get form input const renamedCustomType = `My renamed ${format} type`; const nameInput = within(form).getByPlaceholderText( - `A display name for the ${format} type` + `A display name for the ${format} type`, ); // Clear the name and type a new one @@ -168,7 +168,9 @@ describe.each(formats)( // Check that the old custom type label is not visible anymore await waitFor(() => { expect( - screen.queryByText(customTypesMockByFormat[format][0].label as string) + screen.queryByText( + customTypesMockByFormat[format][0].label as string, + ), ).not.toBeInTheDocument(); }); @@ -184,10 +186,10 @@ describe.each(formats)( // Check that the redirection has been done expect(mockRouter.asPath).toEqual( - `/${format}-types/${customTypesMockByFormat[format][0].id}` + `/${format}-types/${customTypesMockByFormat[format][0].id}`, ); }); - } + }, ); describe("CustomTypesTablePage > Custom type", () => { @@ -212,21 +214,21 @@ describe("CustomTypesTablePage > Custom type", () => { // Check that the custom type is not visible anymore await waitFor(() => { expect( - screen.queryByText(customTypesMockByFormat[format][0].label as string) + screen.queryByText(customTypesMockByFormat[format][0].label as string), ).not.toBeInTheDocument(); }); // Check that the converted custom type is visible on the page type table now rerender(); expect( - screen.getByText(customTypesMockByFormat[format][0].id) + screen.getByText(customTypesMockByFormat[format][0].id), ).toBeVisible(); }); }); function createCustomTypesMock( format: CustomTypeFormat, - count: number + count: number, ): CustomType[] { return Array.from(Array(count), (_, index) => ({ id: `MyID${format}${index}`, @@ -275,7 +277,7 @@ async function renderCustomTypesTablePage({ }); hook("custom-type:read", (args: CustomTypeReadHookData) => { const model = customTypesMock.find( - (customTypeMock) => customTypeMock.id === args.id + (customTypeMock) => customTypeMock.id === args.id, ); if (model) { @@ -304,7 +306,7 @@ async function renderCustomTypesTablePage({ createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const customTypeMockStore = { @@ -315,14 +317,14 @@ async function renderCustomTypesTablePage({ ...obj, [item.id]: { local: CustomTypes.toSM(item) }, }), - {} + {}, ), ...customTypesMockByFormat.page.reduce( (obj, item) => ({ ...obj, [item.id]: { local: CustomTypes.toSM(item) }, }), - {} + {}, ), }, environment: { @@ -335,12 +337,12 @@ async function renderCustomTypesTablePage({ const renderResults = render( , // @ts-expect-error TS2345: Argument of type '{ preloadedState: { availableCustomTypes: {}; environment: { manifest: { apiEndpoint: string; }; }; slices: { libraries: never[]; remoteSlices: never[]; }; }; }' is not assignable to parameter of type 'Partial<{ preloadedState: Partial; store: Store; } & RenderOptions<...>>'. - customTypeMockStore + customTypeMockStore, ); // Ensure table finished loading expect( - await screen.findByText(customTypesMockByFormat[format][0].id) + await screen.findByText(customTypesMockByFormat[format][0].id), ).toBeVisible(); return renderResults; diff --git a/packages/slice-machine/src/features/customTypes/actions/convertCustomToPageType.ts b/packages/slice-machine/src/features/customTypes/actions/convertCustomToPageType.ts index 95b38aa5e3..e89504c3a4 100644 --- a/packages/slice-machine/src/features/customTypes/actions/convertCustomToPageType.ts +++ b/packages/slice-machine/src/features/customTypes/actions/convertCustomToPageType.ts @@ -9,7 +9,7 @@ import { CUSTOM_TYPES_MESSAGES } from "../customTypesMessages"; export async function convertCustomToPageType( customType: CustomType, - saveCustomType: (customType: CustomType) => void + saveCustomType: (customType: CustomType) => void, ) { const customTypesMessages = CUSTOM_TYPES_MESSAGES[customType.format as CustomTypeFormat]; @@ -27,14 +27,14 @@ export async function convertCustomToPageType( `${customTypesMessages.name({ start: true, plural: false, - })} converted to page type` + })} converted to page type`, ); } catch (e) { toast.error( `Internal Error: ${customTypesMessages.name({ start: true, plural: false, - })} not converted to page type` + })} not converted to page type`, ); } } diff --git a/packages/slice-machine/src/features/customTypes/actions/deleteCustomType.ts b/packages/slice-machine/src/features/customTypes/actions/deleteCustomType.ts index d8b113d20a..ef71a52689 100644 --- a/packages/slice-machine/src/features/customTypes/actions/deleteCustomType.ts +++ b/packages/slice-machine/src/features/customTypes/actions/deleteCustomType.ts @@ -25,7 +25,7 @@ export async function deleteCustomType({ `${customTypesMessages.name({ start: true, plural: false, - })} deleted` + })} deleted`, ); } catch (e) { const errorMessage = `Internal Error: ${customTypesMessages.name({ diff --git a/packages/slice-machine/src/features/customTypes/actions/renameCustomType.ts b/packages/slice-machine/src/features/customTypes/actions/renameCustomType.ts index bac5c86d25..49320c55a1 100644 --- a/packages/slice-machine/src/features/customTypes/actions/renameCustomType.ts +++ b/packages/slice-machine/src/features/customTypes/actions/renameCustomType.ts @@ -33,7 +33,7 @@ export async function renameCustomType({ `${customTypesMessages.name({ start: true, plural: false, - })} renamed` + })} renamed`, ); } catch (e) { const errorMessage = `Internal Error: ${customTypesMessages.name({ diff --git a/packages/slice-machine/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx b/packages/slice-machine/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx index 527927127d..9853ad7205 100644 --- a/packages/slice-machine/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +++ b/packages/slice-machine/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx @@ -37,9 +37,9 @@ export const CustomTypesBuilderPage: FC = () => { (store: SliceMachineStoreType) => ({ selectedCustomType: selectCustomTypeById( store, - readBuilderPageDynamicSegment(router.query) as string + readBuilderPageDynamicSegment(router.query) as string, ), - }) + }), ); const { cleanupCustomTypeStore } = useSliceMachineActions(); @@ -94,7 +94,7 @@ const CustomTypesBuilderPageWithProvider: React.FC< // eslint-disable-next-line react-hooks/exhaustive-deps [ /* leave this empty to prevent local updates to disappear */ - ] + ], ); const { currentCustomType, hasPendingModifications, isSavingCustomType } = diff --git a/packages/slice-machine/src/features/customTypes/customTypesConfig.ts b/packages/slice-machine/src/features/customTypes/customTypesConfig.ts index 433e71fc16..2d037c2d6c 100644 --- a/packages/slice-machine/src/features/customTypes/customTypesConfig.ts +++ b/packages/slice-machine/src/features/customTypes/customTypesConfig.ts @@ -28,15 +28,15 @@ export const CUSTOM_TYPES_CONFIG = { export function matchesBuilderPagePathname( pathname: string, - customTypeId: string + customTypeId: string, ): boolean { return Object.values(CUSTOM_TYPES_CONFIG).some(({ getBuilderPagePathname }) => - pathname.startsWith(getBuilderPagePathname(customTypeId)) + pathname.startsWith(getBuilderPagePathname(customTypeId)), ); } export function readBuilderPageDynamicSegment( - query: NextRouter["query"] + query: NextRouter["query"], ): string | undefined { const customTypesConfigValues = Object.values(CUSTOM_TYPES_CONFIG); for (const { builderPageDynamicSegment } of customTypesConfigValues) { diff --git a/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTable.tsx b/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTable.tsx index 8243b1d68f..9f37f43c7d 100644 --- a/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +++ b/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTable.tsx @@ -46,7 +46,7 @@ export const CustomTypesTable: FC = ({ const sortedCustomTypes = customTypes.sort( (customType1: CustomType, customType2: CustomType) => { return customType1.id.localeCompare(customType2.id); - } + }, ); const customTypesConfig = CUSTOM_TYPES_CONFIG[format]; const customTypesMessages = CUSTOM_TYPES_MESSAGES[format]; @@ -102,7 +102,7 @@ export const CustomTypesTable: FC = ({ key={id} onClick={() => { void router.push( - CUSTOM_TYPES_CONFIG[format].getBuilderPagePathname(id) + CUSTOM_TYPES_CONFIG[format].getBuilderPagePathname(id), ); }} > diff --git a/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx b/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx index 5fc8c1f04f..d470d1bfc9 100644 --- a/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +++ b/packages/slice-machine/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx @@ -38,9 +38,9 @@ export const CustomTypesTablePage: FC = ({ (store: SliceMachineStoreType) => ({ isCreatingCustomType: isLoading( store, - LoadingKeysEnum.CREATE_CUSTOM_TYPE + LoadingKeysEnum.CREATE_CUSTOM_TYPE, ), - }) + }), ); return ( @@ -59,7 +59,7 @@ export const CustomTypesTablePage: FC = ({ diff --git a/packages/slice-machine/src/features/customTypes/customTypesTable/createCustomType.ts b/packages/slice-machine/src/features/customTypes/customTypesTable/createCustomType.ts index 6e8f8deec9..7d48c9c84c 100644 --- a/packages/slice-machine/src/features/customTypes/customTypesTable/createCustomType.ts +++ b/packages/slice-machine/src/features/customTypes/customTypesTable/createCustomType.ts @@ -5,7 +5,7 @@ export function createCustomType( id: string, label: string, repeatable: boolean, - format: CustomTypeFormat + format: CustomTypeFormat, ): CustomType { const mainTab = makeMainTab(repeatable, format); @@ -21,7 +21,7 @@ export function createCustomType( function makeMainTab( repeatable: boolean, - format: CustomTypeFormat + format: CustomTypeFormat, ): CustomType["json"] { if (repeatable === false && format === "page") { return { ...DEFAULT_MAIN_WITH_SLICE_ZONE, ...DEFAULT_SEO_TAB }; diff --git a/packages/slice-machine/src/features/customTypes/customTypesTable/useCustomTypes.ts b/packages/slice-machine/src/features/customTypes/customTypesTable/useCustomTypes.ts index db90ab8e77..a25c2085d5 100644 --- a/packages/slice-machine/src/features/customTypes/customTypesTable/useCustomTypes.ts +++ b/packages/slice-machine/src/features/customTypes/customTypesTable/useCustomTypes.ts @@ -16,11 +16,11 @@ type UseCustomTypesReturnType = { }; export function useCustomTypes( - format: CustomTypeFormat + format: CustomTypeFormat, ): UseCustomTypesReturnType { const updateCustomTypes = useCallback( (data: CustomType[]) => updateData(getCustomTypes, [format], data), - [format] + [format], ); return { @@ -31,7 +31,7 @@ export function useCustomTypes( async function getCustomTypes(format: CustomTypeFormat): Promise { const { errors, models } = await managerClient.customTypes.readAllCustomTypes( - { format } + { format }, ); if (errors.length > 0) { @@ -48,7 +48,7 @@ async function getCustomTypes(format: CustomTypeFormat): Promise { export function useCustomTypesAutoRevalidation( customTypes: CustomType[], format: CustomTypeFormat, - updateCustomTypes: (data: CustomType[]) => void + updateCustomTypes: (data: CustomType[]) => void, ): void { const { storeCustomTypes } = useSelector((store: SliceMachineStoreType) => ({ storeCustomTypes: selectAllCustomTypes(store).filter(hasLocal), @@ -56,7 +56,7 @@ export function useCustomTypesAutoRevalidation( useEffect(() => { const storeCustomTypesFiltered = storeCustomTypes.filter( - ({ local }) => local.format === format + ({ local }) => local.format === format, ); if ( @@ -66,7 +66,7 @@ export function useCustomTypesAutoRevalidation( // the one from suspense because it could not be the same after some // modifications (rename, add/remove field, new tab, etc.) const currentCustomType = customTypes.find( - (ct2: CustomType) => ct2.id === ct.local.id + (ct2: CustomType) => ct2.id === ct.local.id, ); return ( @@ -77,7 +77,7 @@ export function useCustomTypesAutoRevalidation( }) ) { const newCustomTypes: CustomType[] = storeCustomTypesFiltered.map( - ({ local }) => CustomTypes.fromSM(local) + ({ local }) => CustomTypes.fromSM(local), ); updateCustomTypes(newCustomTypes); diff --git a/packages/slice-machine/src/features/labs/labsList/LabsList.tsx b/packages/slice-machine/src/features/labs/labsList/LabsList.tsx index b3ec954313..14cd0f3591 100644 --- a/packages/slice-machine/src/features/labs/labsList/LabsList.tsx +++ b/packages/slice-machine/src/features/labs/labsList/LabsList.tsx @@ -10,7 +10,7 @@ import { type UseLabArgs, type UseLabReturnType, useLab } from "./useLab"; export const LabsList: FC = () => { const [legacySliceUpgraderLab, setLegacySliceUpgraderLab] = useLabWithToast( "legacySliceUpgrader", - "Legacy Slice Upgrader" + "Legacy Slice Upgrader", ); return ( @@ -53,7 +53,7 @@ function useLabWithToast(key: UseLabArgs, name: string): UseLabReturnType { openToaster( enabled ? `Labs: enabled ${name}` : `Labs: disabled ${name}`, - ToasterType.SUCCESS + ToasterType.SUCCESS, ); } catch (error) { console.error(error); @@ -62,7 +62,7 @@ function useLabWithToast(key: UseLabArgs, name: string): UseLabReturnType { enabled ? `Labs: failed to enable ${name}` : `Labs: failed to disable ${name}`, - ToasterType.ERROR + ToasterType.ERROR, ); } }; diff --git a/packages/slice-machine/src/features/slices/actions/addSlicesToSliceZone.ts b/packages/slice-machine/src/features/slices/actions/addSlicesToSliceZone.ts index 40184664dd..5a4fd9e449 100644 --- a/packages/slice-machine/src/features/slices/actions/addSlicesToSliceZone.ts +++ b/packages/slice-machine/src/features/slices/actions/addSlicesToSliceZone.ts @@ -35,7 +35,7 @@ export async function addSlicesToSliceZone({ ], }, } - : tab + : tab, ), }; }); diff --git a/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx b/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx index 3ed12ade6d..6df9ac51de 100644 --- a/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +++ b/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx @@ -86,14 +86,14 @@ export const ConvertLegacySliceAsNewSliceDialog: FC = ({ void formik.setFieldValue( "sliceName", - value.slice(0, 30) + value.slice(0, 30), ) } data-cy="slice-name-input" diff --git a/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx b/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx index a2b47c6f15..d75f302a22 100644 --- a/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +++ b/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx @@ -137,7 +137,7 @@ export const ConvertLegacySliceAsNewVariationDialog: FC = ({ if (inferIDFromName) { values.variationID = Variation.generateId( - values.variationName + values.variationName, ); } @@ -163,7 +163,7 @@ export const ConvertLegacySliceAsNewVariationDialog: FC = ({ setInferIDFromName(false); void formik.setFieldValue( "variationID", - Variation.generateId(value.slice(0, 30)) + Variation.generateId(value.slice(0, 30)), ); }} data-cy="variation-id-input" @@ -191,7 +191,7 @@ export const ConvertLegacySliceAsNewVariationDialog: FC = ({ const validateAsNewVariationValues = ( values: FormValues, - libraries: readonly LibraryUI[] + libraries: readonly LibraryUI[], ): Partial> => { const errors: Partial> = {}; @@ -199,7 +199,7 @@ const validateAsNewVariationValues = ( errors.libraryID = "Cannot be empty."; } const library = libraries.find( - (library) => library.path === values.libraryID + (library) => library.path === values.libraryID, ); // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!errors.libraryID && !library) { @@ -210,7 +210,7 @@ const validateAsNewVariationValues = ( errors.sliceID = "Cannot be empty."; } const slice = library?.components.find( - (component) => component.model.id === values.sliceID + (component) => component.model.id === values.sliceID, ); // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (!errors.sliceID && !slice) { diff --git a/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx b/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx index 7ce788bbc9..be9d3e17cb 100644 --- a/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +++ b/packages/slice-machine/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx @@ -49,7 +49,7 @@ export const ConvertLegacySliceButton: FC = ({ const { libraries: allLibraries } = useSelector( (store: SliceMachineStoreType) => ({ libraries: getLibraries(store), - }) + }), ); const sliceName = @@ -63,11 +63,11 @@ export const ConvertLegacySliceButton: FC = ({ const identicalSlices = useIdenticalSlices( slice, sliceName, - localSharedSlices + localSharedSlices, ); const convertLegacySliceAndTrack = async ( - args: ConvertLegacySliceAndTrackArgs + args: ConvertLegacySliceAndTrackArgs, ) => { if (!dialog) { return; @@ -103,7 +103,7 @@ export const ConvertLegacySliceButton: FC = ({ openToaster( `Could not convert slice \`${sliceName}\``, - ToasterType.ERROR + ToasterType.ERROR, ); throw errors; @@ -117,12 +117,12 @@ export const ConvertLegacySliceButton: FC = ({ if (customTypeReadErrors.length || !customType) { console.error( `Could not refresh custom type view \`${path.customTypeID}\``, - customTypeReadErrors + customTypeReadErrors, ); openToaster( `Could not refresh custom type view \`${path.customTypeID}\``, - ToasterType.ERROR + ToasterType.ERROR, ); return; @@ -139,14 +139,14 @@ export const ConvertLegacySliceButton: FC = ({ case "as_new_slice": openToaster( `${sliceName} has been upgraded to a new slice ${args.libraryID} > ${args.sliceID}`, - ToasterType.SUCCESS + ToasterType.SUCCESS, ); break; case "as_new_variation": openToaster( `${sliceName} has been converted as a variation of ${args.libraryID} > ${args.sliceID}`, - ToasterType.SUCCESS + ToasterType.SUCCESS, ); break; @@ -154,7 +154,7 @@ export const ConvertLegacySliceButton: FC = ({ default: openToaster( `${sliceName} has been merged with ${args.libraryID} > ${args.sliceID}`, - ToasterType.SUCCESS + ToasterType.SUCCESS, ); break; } @@ -235,7 +235,7 @@ export const ConvertLegacySliceButton: FC = ({ const useIdenticalSlices = ( slice: NonSharedSliceInSliceZone, sliceName: string, - localSharedSlices: ComponentUI[] + localSharedSlices: ComponentUI[], ) => { return useMemo(() => { const results: IdenticalSlice[] = []; @@ -246,7 +246,7 @@ const useIdenticalSlices = ( for (const variation of sharedSlice.model.variations) { const variationFields = getFieldMappingFingerprint( variation, - sharedSlice.model.name + sharedSlice.model.name, ); if ( diff --git a/packages/slice-machine/src/features/slicesTemplates/useSlicesTemplates.ts b/packages/slice-machine/src/features/slicesTemplates/useSlicesTemplates.ts index 8799e955d3..1703d46a1e 100644 --- a/packages/slice-machine/src/features/slicesTemplates/useSlicesTemplates.ts +++ b/packages/slice-machine/src/features/slicesTemplates/useSlicesTemplates.ts @@ -22,7 +22,7 @@ async function getSlicesTemplates(): Promise { Object.entries(template.screenshots).map(([key, blob]) => [ key, URL.createObjectURL(blob), - ]) + ]), ), })); } catch (e) { diff --git a/packages/slice-machine/src/hooks/useCurrentSlice.tsx b/packages/slice-machine/src/hooks/useCurrentSlice.tsx index dfc0aadd5b..12b0ed4f92 100644 --- a/packages/slice-machine/src/hooks/useCurrentSlice.tsx +++ b/packages/slice-machine/src/hooks/useCurrentSlice.tsx @@ -18,7 +18,7 @@ const useCurrentSlice = (): UseCurrentSliceRet => { slice: selectCurrentSlice( store, router.query.lib as string, - router.query.sliceName as string + router.query.sliceName as string, ), })); @@ -35,7 +35,7 @@ const useCurrentSlice = (): UseCurrentSliceRet => { } const variation = slice.model.variations.find( - (variation) => variation.id === router.query.variation + (variation) => variation.id === router.query.variation, ); if (!variation) { diff --git a/packages/slice-machine/src/hooks/useElementSize.ts b/packages/slice-machine/src/hooks/useElementSize.ts index 7efa524296..b7ffa7e16d 100644 --- a/packages/slice-machine/src/hooks/useElementSize.ts +++ b/packages/slice-machine/src/hooks/useElementSize.ts @@ -7,7 +7,7 @@ import { export function useElementSize( callback: (size: ResizeObserverSize, element: E) => void, - deps: DependencyList + deps: DependencyList, ): RefCallback { const resizeObserverRef = useRef(); return useCallback((element: E | null) => { diff --git a/packages/slice-machine/src/hooks/useModelStatus.ts b/packages/slice-machine/src/hooks/useModelStatus.ts index 99a3f7288c..6037417d4f 100644 --- a/packages/slice-machine/src/hooks/useModelStatus.ts +++ b/packages/slice-machine/src/hooks/useModelStatus.ts @@ -26,15 +26,15 @@ export interface ModelStatusInformation { function computeStatuses( models: LocalOrRemoteCustomType[], - userHasAccessToModels: boolean + userHasAccessToModels: boolean, ): { [sliceId: string]: ModelStatus }; function computeStatuses( models: LocalOrRemoteSlice[], - userHasAccessToModels: boolean + userHasAccessToModels: boolean, ): { [sliceId: string]: ModelStatus }; function computeStatuses( models: LocalOrRemoteModel[], - userHasAccessToModels: boolean + userHasAccessToModels: boolean, ) { return models.reduce<{ [id: string]: ModelStatus }>( (acc, model) => { @@ -45,7 +45,7 @@ function computeStatuses( [hasLocal(model) ? model.local.id : model.remote.id]: status, }; }, - {} as { [sliceId: string]: ModelStatus } + {} as { [sliceId: string]: ModelStatus }, ); } diff --git a/packages/slice-machine/src/hooks/useRouteChange.tsx b/packages/slice-machine/src/hooks/useRouteChange.tsx index f19577a975..9cfe216b71 100644 --- a/packages/slice-machine/src/hooks/useRouteChange.tsx +++ b/packages/slice-machine/src/hooks/useRouteChange.tsx @@ -36,7 +36,7 @@ export function useRouteChange(): RouteChange { const routeChange = useContext(RouteChangeContext); if (routeChange === undefined) throw new Error( - "useRouteChange must be used within a RouteChangeProvider." + "useRouteChange must be used within a RouteChangeProvider.", ); return routeChange; } diff --git a/packages/slice-machine/src/hooks/useSMTracker.ts b/packages/slice-machine/src/hooks/useSMTracker.ts index 6719f6fd10..d4aeab1c24 100644 --- a/packages/slice-machine/src/hooks/useSMTracker.ts +++ b/packages/slice-machine/src/hooks/useSMTracker.ts @@ -46,7 +46,7 @@ const useSMTracker = () => { export default useSMTracker; function group( - libs: readonly LibraryUI[] + libs: readonly LibraryUI[], ): ReturnType | void { const downloadedLibs = libs.filter((l) => l.meta.isDownloaded); @@ -55,7 +55,7 @@ function group( downloadedLibsCount: downloadedLibs.length, npmLibsCount: libs.filter((l) => l.meta.isNodeModule).length, downloadedLibs: downloadedLibs.map((l) => - l.meta.name != null ? l.meta.name : "Unknown" + l.meta.name != null ? l.meta.name : "Unknown", ), }); } diff --git a/packages/slice-machine/src/hooks/useThrottle.ts b/packages/slice-machine/src/hooks/useThrottle.ts index 4cdc6ed771..1202326599 100644 --- a/packages/slice-machine/src/hooks/useThrottle.ts +++ b/packages/slice-machine/src/hooks/useThrottle.ts @@ -3,7 +3,7 @@ import { useEffect, useState, useRef } from "react"; function useThrottle( cb: () => T, limit: number, - args: ReadonlyArray + args: ReadonlyArray, ): T { const [throttledValue, setThrottledValue] = useState(cb()); const lastRan = useRef(Date.now()); @@ -16,7 +16,7 @@ function useThrottle( lastRan.current = Date.now(); } }, - limit - (Date.now() - lastRan.current) + limit - (Date.now() - lastRan.current), ); return () => { diff --git a/packages/slice-machine/src/hooks/useUnSyncChanges.ts b/packages/slice-machine/src/hooks/useUnSyncChanges.ts index 608e9e38a6..7b30ffce66 100644 --- a/packages/slice-machine/src/hooks/useUnSyncChanges.ts +++ b/packages/slice-machine/src/hooks/useUnSyncChanges.ts @@ -43,7 +43,7 @@ export const useUnSyncChanges = (): UnSyncChanges => { customTypes: selectAllCustomTypes(store), slices: getFrontendSlices(store), libraries: getLibraries(store), - }) + }), ); const { modelsStatuses, authStatus, isOnline } = useModelStatus({ @@ -52,7 +52,7 @@ export const useUnSyncChanges = (): UnSyncChanges => { }); const localComponents: ComponentUI[] = libraries.flatMap( - (lib) => lib.components + (lib) => lib.components, ); const deletedComponents: ComponentUI[] = slices @@ -67,15 +67,15 @@ export const useUnSyncChanges = (): UnSyncChanges => { (component) => // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions modelsStatuses.slices[component.model.id] && - unSyncStatuses.includes(modelsStatuses.slices[component.model.id]) + unSyncStatuses.includes(modelsStatuses.slices[component.model.id]), ); const unSyncedCustomTypes = customTypes.filter( (customType) => // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions modelsStatuses.customTypes[getModelId(customType)] && unSyncStatuses.includes( - modelsStatuses.customTypes[getModelId(customType)] - ) + modelsStatuses.customTypes[getModelId(customType)], + ), ); return { diff --git a/packages/slice-machine/src/hooks/useWindowDimensions.ts b/packages/slice-machine/src/hooks/useWindowDimensions.ts index 968faffb36..5a54efa6be 100644 --- a/packages/slice-machine/src/hooks/useWindowDimensions.ts +++ b/packages/slice-machine/src/hooks/useWindowDimensions.ts @@ -10,7 +10,7 @@ function getWindowDimensions() { export default function useWindowDimensions() { const [windowDimensions, setWindowDimensions] = useState( - getWindowDimensions() + getWindowDimensions(), ); useEffect(() => { diff --git a/packages/slice-machine/src/modules/availableCustomTypes/index.ts b/packages/slice-machine/src/modules/availableCustomTypes/index.ts index eb5f07f558..88c0373fb8 100644 --- a/packages/slice-machine/src/modules/availableCustomTypes/index.ts +++ b/packages/slice-machine/src/modules/availableCustomTypes/index.ts @@ -41,7 +41,7 @@ import { ToastMessageWithPath } from "@components/ToasterContainer"; export const createCustomTypeCreator = createAsyncAction( "CUSTOM_TYPES/CREATE.REQUEST", "CUSTOM_TYPES/CREATE.RESPONSE", - "CUSTOM_TYPES/CREATE.FAILURE" + "CUSTOM_TYPES/CREATE.FAILURE", )< { id: string; @@ -55,7 +55,7 @@ export const createCustomTypeCreator = createAsyncAction( >(); export const renameAvailableCustomType = createAction( - "CUSTOM_TYPES/RENAME_CUSTOM_TYPE" + "CUSTOM_TYPES/RENAME_CUSTOM_TYPE", )<{ renamedCustomType: CustomTypeSM; }>(); @@ -63,7 +63,7 @@ export const renameAvailableCustomType = createAction( export const deleteCustomTypeCreator = createAsyncAction( "CUSTOM_TYPES/DELETE.REQUEST", "CUSTOM_TYPES/DELETE.RESPONSE", - "CUSTOM_TYPES/DELETE.FAILURE" + "CUSTOM_TYPES/DELETE.FAILURE", )< { customTypeId: string; @@ -85,15 +85,15 @@ type CustomTypesActions = // Selectors export const selectAllCustomTypes = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): LocalOrRemoteCustomType[] => Object.values(store.availableCustomTypes); export const selectAllCustomTypeIds = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): string[] => Object.keys(store.availableCustomTypes); export const selectAllCustomTypeLabels = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): string[] => { return Object.values(store.availableCustomTypes) .flatMap((localOrRemote) => { @@ -108,7 +108,7 @@ export const selectAllCustomTypeLabels = ( export const selectCustomTypeById = ( store: SliceMachineStoreType, - id: string + id: string, ): LocalOrRemoteCustomType | null => store.availableCustomTypes[id]; // Reducer @@ -122,7 +122,7 @@ export const availableCustomTypesReducer: Reducer< case getType(refreshStateCreator): { const normalizedNewCustomType = normalizeFrontendCustomTypes( action.payload.localCustomTypes, - action.payload.remoteCustomTypes + action.payload.remoteCustomTypes, ); return { @@ -131,7 +131,7 @@ export const availableCustomTypesReducer: Reducer< } case getType(createCustomTypeCreator.success): { const normalizedNewCustomType = normalizeFrontendCustomType( - action.payload.newCustomType + action.payload.newCustomType, ); return { @@ -173,7 +173,7 @@ export const availableCustomTypesReducer: Reducer< if (hasLocalAndRemote(customType)) { const remoteOnlyCustomType: RemoteOnlyCustomType = omit( customType, - "local" + "local", ); return { ...state, @@ -190,7 +190,7 @@ export const availableCustomTypesReducer: Reducer< const sliceId = action.payload.sliceId; const customTypesUpdated: AvailableCustomTypesStoreType = Object.entries( - state + state, ) .map<[string, LocalOrRemoteCustomType]>( ([customTypeId, customType]) => { @@ -205,7 +205,7 @@ export const availableCustomTypesReducer: Reducer< } return [customTypeId, customType]; - } + }, ) .reduce( (acc, [customTypeId, customType]) => { @@ -214,7 +214,7 @@ export const availableCustomTypesReducer: Reducer< [customTypeId]: customType, }; }, - {} + {}, ); return customTypesUpdated; @@ -237,8 +237,8 @@ export function* createCustomTypeSaga({ payload.id, payload.label, payload.repeatable, - payload.format - ) + payload.format, + ), ); yield call(saveCustomType, newCustomType); yield put(createCustomTypeCreator.success({ newCustomType })); @@ -252,7 +252,7 @@ export function* createCustomTypeSaga({ newPageType: true, } : undefined, - }) + }), ); yield put( openToasterCreator({ @@ -264,7 +264,7 @@ export function* createCustomTypeSaga({ path: `./customtypes/${newCustomType.id}/index.json`, }), type: ToasterType.SUCCESS, - }) + }), ); } catch (e) { yield put( @@ -274,7 +274,7 @@ export function* createCustomTypeSaga({ plural: false, })} not saved`, type: ToasterType.ERROR, - }) + }), ); } } @@ -283,7 +283,7 @@ export function* createCustomTypeSaga({ function* handleCustomTypeRequests() { yield takeLatest( getType(createCustomTypeCreator.request), - withLoader(createCustomTypeSaga, LoadingKeysEnum.CREATE_CUSTOM_TYPE) + withLoader(createCustomTypeSaga, LoadingKeysEnum.CREATE_CUSTOM_TYPE), ); } diff --git a/packages/slice-machine/src/modules/environment/index.ts b/packages/slice-machine/src/modules/environment/index.ts index 40e6a26d14..5b9f3d2ff8 100644 --- a/packages/slice-machine/src/modules/environment/index.ts +++ b/packages/slice-machine/src/modules/environment/index.ts @@ -38,7 +38,7 @@ export const updateManifestCreator = createAction("STATE/UPDATE_MANIFEST")<{ export const getChangelogCreator = createAsyncAction( "CHANGELOG.REQUEST", "CHANGELOG.RESPONSE", - "CHANGELOG.FAILURE" + "CHANGELOG.FAILURE", )< undefined, { @@ -55,11 +55,11 @@ type EnvironmentActions = ActionType< // Selectors export const getEnvironment = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): FrontEndEnvironment => store.environment; export const selectSimulatorUrl = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): string | undefined => { return store.environment.manifest.localSliceSimulatorURL; }; @@ -74,7 +74,7 @@ export const selectEndpoints = (store: SliceMachineStoreType): APIEndpoints => store.environment.endpoints; export const selectIsSimulatorAvailableForFramework = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): boolean => { return store.environment.supportsSliceSimulator; }; @@ -98,7 +98,7 @@ export const getChangelog = (store: SliceMachineStoreType) => { }; export const getPackageManager = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): PackageManager => { return store.environment.packageManager; }; @@ -152,7 +152,7 @@ export function* getChangelogSaga(): Generator< function* watchChangelog() { yield takeLatest( getType(getChangelogCreator.request), - withLoader(getChangelogSaga, LoadingKeysEnum.CHANGELOG) + withLoader(getChangelogSaga, LoadingKeysEnum.CHANGELOG), ); } diff --git a/packages/slice-machine/src/modules/loading/index.ts b/packages/slice-machine/src/modules/loading/index.ts index 7607dbd95f..1c5fb4bef2 100644 --- a/packages/slice-machine/src/modules/loading/index.ts +++ b/packages/slice-machine/src/modules/loading/index.ts @@ -29,13 +29,13 @@ type LoadingActions = ActionType< // Selectors export const isLoading = ( store: SliceMachineStoreType, - key: LoadingKeysEnum + key: LoadingKeysEnum, ): boolean => store.loading[key]; // Reducer export const loadingReducer: Reducer = ( state = initialState, - action + action, ) => { switch (action.type) { case getType(startLoadingActionCreator): @@ -68,7 +68,7 @@ export const withLoader = (saga: any, loadingKey: LoadingKeysEnum): Saga => args[3], args[4], args[5], - args[6] + args[6], ); } finally { yield put(stopLoadingActionCreator({ loadingKey })); diff --git a/packages/slice-machine/src/modules/modal/index.ts b/packages/slice-machine/src/modules/modal/index.ts index 97a1843ff6..532ce5614f 100644 --- a/packages/slice-machine/src/modules/modal/index.ts +++ b/packages/slice-machine/src/modules/modal/index.ts @@ -22,13 +22,13 @@ type ModalActions = ActionType< // Selectors export const isModalOpen = ( state: SliceMachineStoreType, - dialog: ModalKeysEnum + dialog: ModalKeysEnum, ): boolean => state.modal[dialog]; // Reducer export const modalReducer: Reducer = ( state = initialState, - action + action, ) => { switch (action.type) { case getType(modalCloseCreator): diff --git a/packages/slice-machine/src/modules/pushChangesSaga/index.ts b/packages/slice-machine/src/modules/pushChangesSaga/index.ts index 097dce8a9c..ac24e6c826 100644 --- a/packages/slice-machine/src/modules/pushChangesSaga/index.ts +++ b/packages/slice-machine/src/modules/pushChangesSaga/index.ts @@ -47,7 +47,7 @@ type Limit = NonNullable< export const changesPushCreator = createAsyncAction( "PUSH_CHANGES.REQUEST", "PUSH_CHANGES.RESPONSE", - "PUSH_CHANGES.FAILURE" + "PUSH_CHANGES.FAILURE", )(); export const sortDocumentLimits = (limit: Readonly) => ({ @@ -55,7 +55,7 @@ export const sortDocumentLimits = (limit: Readonly) => ({ details: { ...limit.details, customTypes: [...limit.details.customTypes].sort( - (doc1, doc2) => doc2.numberOfDocuments - doc1.numberOfDocuments + (doc1, doc2) => doc2.numberOfDocuments - doc1.numberOfDocuments, ), }, }); @@ -107,7 +107,7 @@ export function* changesPushSaga({ yield put( modalOpenCreator({ modalKey: MODAL_KEY_MAP[response.type], - }) + }), ); return; } @@ -123,7 +123,7 @@ export function* changesPushSaga({ libraries: serverState.libraries, remoteSlices: serverState.remoteSlices, clientError: serverState.clientError, - }) + }), ); // Tracking the success of the push @@ -137,7 +137,7 @@ export function* changesPushSaga({ openToasterCreator({ content: "All slices and types have been pushed", type: ToasterType.SUCCESS, - }) + }), ); } catch (error) { if (isUnauthenticatedError(error) || isUnauthorizedError(error)) { @@ -150,7 +150,7 @@ export function* changesPushSaga({ content: "Something went wrong when pushing your changes. Check your terminal logs.", type: ToasterType.ERROR, - }) + }), ); } } @@ -158,7 +158,7 @@ export function* changesPushSaga({ function* watchChangesPush() { yield takeLatest( getType(changesPushCreator.request), - withLoader(changesPushSaga, LoadingKeysEnum.CHANGES_PUSH) + withLoader(changesPushSaga, LoadingKeysEnum.CHANGES_PUSH), ); } diff --git a/packages/slice-machine/src/modules/pushChangesSaga/trackPushChangesSuccess.ts b/packages/slice-machine/src/modules/pushChangesSaga/trackPushChangesSuccess.ts index 50aabd1c42..d92086f671 100644 --- a/packages/slice-machine/src/modules/pushChangesSaga/trackPushChangesSuccess.ts +++ b/packages/slice-machine/src/modules/pushChangesSaga/trackPushChangesSuccess.ts @@ -40,7 +40,7 @@ export function trackPushChangesSuccess(params: trackingParameters) { customTypesCreated: 0, customTypesModified: 0, customTypesDeleted: 0, - } + }, ); const slicesStats = changedSlices.reduce<{ @@ -70,13 +70,13 @@ export function trackPushChangesSuccess(params: trackingParameters) { slicesCreated: 0, slicesModified: 0, slicesDeleted: 0, - } + }, ); const total = changedSlices.length + changedCustomTypes.length; const missingScreenshots: number = changedSlices.reduce( (sum, sliceChange) => sum + countMissingScreenshots(sliceChange.slice), - 0 + 0, ); const duration = Date.now() - startTime; diff --git a/packages/slice-machine/src/modules/screenshots/actions.ts b/packages/slice-machine/src/modules/screenshots/actions.ts index 4b4cd460ea..fc7445d156 100644 --- a/packages/slice-machine/src/modules/screenshots/actions.ts +++ b/packages/slice-machine/src/modules/screenshots/actions.ts @@ -12,7 +12,7 @@ export type SelectedSliceActions = export const generateSliceScreenshotCreator = createAsyncAction( "SLICE/TAKE_SCREENSHOT.REQUEST", "SLICE/TAKE_SCREENSHOT.RESPONSE", - "SLICE/TAKE_SCREENSHOT.FAILURE" + "SLICE/TAKE_SCREENSHOT.FAILURE", )< { variationId: string; @@ -30,7 +30,7 @@ export const generateSliceScreenshotCreator = createAsyncAction( export const generateSliceCustomScreenshotCreator = createAsyncAction( "SLICE/GENERATE_CUSTOM_SCREENSHOT.REQUEST", "SLICE/GENERATE_CUSTOM_SCREENSHOT.RESPONSE", - "SLICE/GENERATE_CUSTOM_SCREENSHOT.FAILURE" + "SLICE/GENERATE_CUSTOM_SCREENSHOT.FAILURE", )< { variationId: string; diff --git a/packages/slice-machine/src/modules/screenshots/sagas.ts b/packages/slice-machine/src/modules/screenshots/sagas.ts index 69712a3f2b..5d70e40540 100644 --- a/packages/slice-machine/src/modules/screenshots/sagas.ts +++ b/packages/slice-machine/src/modules/screenshots/sagas.ts @@ -39,7 +39,7 @@ export function* generateSliceScreenshotSaga({ openToasterCreator({ url: response.url, type: ToasterType.SCREENSHOT_CAPTURED, - }) + }), ); void telemetry.track({ @@ -55,14 +55,14 @@ export function* generateSliceScreenshotSaga({ url: response.url, }, component, - }) + }), ); } catch (e) { yield put( openToasterCreator({ content: "Internal Error: Screenshot not saved", type: ToasterType.ERROR, - }) + }), ); } } @@ -97,14 +97,14 @@ export function* generateSliceCustomScreenshotSaga({ url: response.url, }, component, - }) + }), ); } catch (e) { yield put( openToasterCreator({ content: "Internal Error: Custom screenshot not saved", type: ToasterType.ERROR, - }) + }), ); } } @@ -114,8 +114,8 @@ function* watchGenerateSliceScreenshot() { getType(generateSliceScreenshotCreator.request), withLoader( generateSliceScreenshotSaga, - LoadingKeysEnum.GENERATE_SLICE_SCREENSHOT - ) + LoadingKeysEnum.GENERATE_SLICE_SCREENSHOT, + ), ); } function* watchGenerateSliceCustomScreenshot() { @@ -123,8 +123,8 @@ function* watchGenerateSliceCustomScreenshot() { getType(generateSliceCustomScreenshotCreator.request), withLoader( generateSliceCustomScreenshotSaga, - LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT - ) + LoadingKeysEnum.GENERATE_SLICE_CUSTOM_SCREENSHOT, + ), ); } diff --git a/packages/slice-machine/src/modules/selectedCustomType/actions.ts b/packages/slice-machine/src/modules/selectedCustomType/actions.ts index 0aba4ea5b3..7eee87d606 100644 --- a/packages/slice-machine/src/modules/selectedCustomType/actions.ts +++ b/packages/slice-machine/src/modules/selectedCustomType/actions.ts @@ -28,14 +28,14 @@ export const initCustomTypeStoreCreator = createAction("CUSTOM_TYPE/INIT")<{ }>(); export const cleanupCustomTypeStoreCreator = createAction( - "CUSTOM_TYPE/CLEANUP" + "CUSTOM_TYPE/CLEANUP", )(); // Async actions export const saveCustomTypeCreator = createAsyncAction( "CUSTOM_TYPE/SAVE.REQUEST", "CUSTOM_TYPE/SAVE.RESPONSE", - "CUSTOM_TYPE/SAVE.FAILURE" + "CUSTOM_TYPE/SAVE.FAILURE", )(); // Tab actions @@ -79,13 +79,13 @@ export const reorderFieldCreator = createAction("CUSTOM_TYPE/REORDER_FIELD")<{ // Slice zone actions export const createSliceZoneCreator = createAction( - "CUSTOM_TYPE/CREATE_SLICE_ZONE" + "CUSTOM_TYPE/CREATE_SLICE_ZONE", )<{ tabId: string; }>(); export const deleteSliceZoneCreator = createAction( - "CUSTOM_TYPE/DELETE_SLICE_ZONE" + "CUSTOM_TYPE/DELETE_SLICE_ZONE", )<{ tabId: string; }>(); @@ -97,21 +97,21 @@ export type ReplaceSharedSliceCreatorPayload = { }; export const deleteSharedSliceCreator = createAction( - "CUSTOM_TYPE/DELETE_SHARED_SLICE" + "CUSTOM_TYPE/DELETE_SHARED_SLICE", )<{ tabId: string; sliceId: string; }>(); export const renameSelectedCustomTypeLabel = createAction( - "CUSTOM_TYPE/RENAME_CUSTOM_TYPE" + "CUSTOM_TYPE/RENAME_CUSTOM_TYPE", )<{ newLabel: string; }>(); // Group actions (can be grouped into the field actions probably) export const addFieldIntoGroupCreator = createAction( - "CUSTOM_TYPE/GROUP/ADD_FIELD" + "CUSTOM_TYPE/GROUP/ADD_FIELD", )<{ tabId: string; groupId: string; @@ -120,7 +120,7 @@ export const addFieldIntoGroupCreator = createAction( }>(); export const replaceFieldIntoGroupCreator = createAction( - "CUSTOM_TYPE/GROUP/REPLACE_FIELD" + "CUSTOM_TYPE/GROUP/REPLACE_FIELD", )<{ tabId: string; groupId: string; @@ -130,7 +130,7 @@ export const replaceFieldIntoGroupCreator = createAction( }>(); export const reorderFieldIntoGroupCreator = createAction( - "CUSTOM_TYPE/GROUP/REORDER_FIELD" + "CUSTOM_TYPE/GROUP/REORDER_FIELD", )<{ tabId: string; groupId: string; @@ -139,7 +139,7 @@ export const reorderFieldIntoGroupCreator = createAction( }>(); export const deleteFieldIntoGroupCreator = createAction( - "CUSTOM_TYPE/GROUP/DELETE_FIELD" + "CUSTOM_TYPE/GROUP/DELETE_FIELD", )<{ tabId: string; groupId: string; diff --git a/packages/slice-machine/src/modules/selectedCustomType/reducer.ts b/packages/slice-machine/src/modules/selectedCustomType/reducer.ts index 33a8b62592..d0be3a5dfa 100644 --- a/packages/slice-machine/src/modules/selectedCustomType/reducer.ts +++ b/packages/slice-machine/src/modules/selectedCustomType/reducer.ts @@ -120,12 +120,12 @@ export const selectedCustomTypeReducer: Reducer< CurrentWidget.schema.validateSync(field, { stripUnknown: false }); return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.addWidget(tab, fieldId, field)); } catch (err) { console.error( // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `[store/addWidget] Model is invalid for widget "${field.type}".\nFull error: ${err}` + `[store/addWidget] Model is invalid for widget "${field.type}".\nFull error: ${err}`, ); return state; } @@ -134,7 +134,7 @@ export const selectedCustomTypeReducer: Reducer< const { tabId, fieldId } = action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.removeWidget(tab, fieldId)); } case getType(replaceFieldCreator): { @@ -152,7 +152,7 @@ export const selectedCustomTypeReducer: Reducer< CurrentWidget.schema.validateSync(value, { stripUnknown: false }); return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.replaceWidget(tab, previousFieldId, newFieldId, value)); } catch (err) { return state; @@ -162,7 +162,7 @@ export const selectedCustomTypeReducer: Reducer< const { tabId, start, end } = action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.reorderWidget(tab, start, end)); } case getType(createSliceZoneCreator): { @@ -176,11 +176,11 @@ export const selectedCustomTypeReducer: Reducer< } const existingSliceZones = CustomType.getSliceZones(state.model).filter( - (e) => e + (e) => e, ); return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => { const i = findAvailableKey(tabIndex, existingSliceZones); return Tab.createSliceZone(tab, `slices${i !== 0 ? i.toString() : ""}`); @@ -198,7 +198,7 @@ export const selectedCustomTypeReducer: Reducer< return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => { return Tab.deleteSliceZone(tab); }); @@ -207,26 +207,26 @@ export const selectedCustomTypeReducer: Reducer< const { tabId, sliceId } = action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => // eslint-disable-next-line @typescript-eslint/no-unsafe-return Tab.updateSliceZone(tab)((sliceZone: SlicesSM) => - SliceZone.removeSharedSlice(sliceZone, sliceId) - ) + SliceZone.removeSharedSlice(sliceZone, sliceId), + ), ); } case getType(addFieldIntoGroupCreator): { const { tabId, groupId, fieldId, field } = action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.updateGroup( tab, - groupId + groupId, )((group: GroupSM) => - Group.addWidget(group, { key: fieldId, value: field }) - ) + Group.addWidget(group, { key: fieldId, value: field }), + ), ); } case getType(replaceFieldIntoGroupCreator): { @@ -234,38 +234,38 @@ export const selectedCustomTypeReducer: Reducer< action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.updateGroup( tab, - groupId + groupId, )((group: GroupSM) => - Group.replaceWidget(group, previousFieldId, newFieldId, value) - ) + Group.replaceWidget(group, previousFieldId, newFieldId, value), + ), ); } case getType(deleteFieldIntoGroupCreator): { const { tabId, groupId, fieldId } = action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.updateGroup( tab, - groupId - )((group: GroupSM) => Group.deleteWidget(group, fieldId)) + groupId, + )((group: GroupSM) => Group.deleteWidget(group, fieldId)), ); } case getType(reorderFieldIntoGroupCreator): { const { tabId, groupId, start, end } = action.payload; return StateHelpers.updateTab( state, - tabId + tabId, )((tab) => Tab.updateGroup( tab, - groupId - )((group: GroupSM) => Group.reorderWidget(group, start, end)) + groupId, + )((group: GroupSM) => Group.reorderWidget(group, start, end)), ); } default: @@ -275,7 +275,7 @@ export const selectedCustomTypeReducer: Reducer< const findAvailableKey = ( startI: number, - existingSliceZones: (SlicesSM | null)[] + existingSliceZones: (SlicesSM | null)[], ) => { for (let i = startI; i < Infinity; i++) { const key = `slices${i.toString()}`; diff --git a/packages/slice-machine/src/modules/selectedCustomType/sagas.ts b/packages/slice-machine/src/modules/selectedCustomType/sagas.ts index bcf24d2029..74a89138df 100644 --- a/packages/slice-machine/src/modules/selectedCustomType/sagas.ts +++ b/packages/slice-machine/src/modules/selectedCustomType/sagas.ts @@ -12,7 +12,7 @@ import { CUSTOM_TYPES_MESSAGES } from "@src/features/customTypes/customTypesMess export function* saveCustomTypeSaga() { try { const currentCustomType = (yield select( - selectCurrentCustomType + selectCurrentCustomType, )) as ReturnType; if (!currentCustomType) { @@ -21,7 +21,7 @@ export function* saveCustomTypeSaga() { const { errors } = (yield call( saveCustomType, - currentCustomType + currentCustomType, )) as Awaited>; if (errors.length) { throw errors; @@ -45,7 +45,7 @@ export function* saveCustomTypeSaga() { path: `./customtypes/${currentCustomType.id}/index.json`, }), type: ToasterType.SUCCESS, - }) + }), ); } catch (e) { // Unknown errors @@ -53,7 +53,7 @@ export function* saveCustomTypeSaga() { openToasterCreator({ content: "Internal Error: Custom type not saved", type: ToasterType.ERROR, - }) + }), ); } } @@ -62,7 +62,7 @@ export function* saveCustomTypeSaga() { function* watchSaveCustomType() { yield takeLatest( getType(saveCustomTypeCreator.request), - withLoader(saveCustomTypeSaga, LoadingKeysEnum.SAVE_CUSTOM_TYPE) + withLoader(saveCustomTypeSaga, LoadingKeysEnum.SAVE_CUSTOM_TYPE), ); } diff --git a/packages/slice-machine/src/modules/selectedCustomType/selectors.ts b/packages/slice-machine/src/modules/selectedCustomType/selectors.ts index 2c3507b0ff..41cd7158da 100644 --- a/packages/slice-machine/src/modules/selectedCustomType/selectors.ts +++ b/packages/slice-machine/src/modules/selectedCustomType/selectors.ts @@ -5,21 +5,21 @@ import { CustomTypeSM, TabSM } from "@lib/models/common/CustomType"; // Selectors export const selectCurrentCustomType = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): CustomTypeSM | null => { if (!store.selectedCustomType) return null; return store.selectedCustomType.model; }; export const selectCurrentPoolOfFields = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): PoolOfFields => { if (!store.selectedCustomType) return []; return store.selectedCustomType.model.tabs.reduce( (acc: PoolOfFields, curr: TabSM) => { return [...acc, ...curr.value]; }, - [] + [], ); }; @@ -28,6 +28,6 @@ export const isSelectedCustomTypeTouched = (store: SliceMachineStoreType) => { return !equal( store.selectedCustomType.initialModel, - store.selectedCustomType.model + store.selectedCustomType.model, ); }; diff --git a/packages/slice-machine/src/modules/selectedCustomType/stateHelpers.ts b/packages/slice-machine/src/modules/selectedCustomType/stateHelpers.ts index 04dca511b7..019bdcac7c 100644 --- a/packages/slice-machine/src/modules/selectedCustomType/stateHelpers.ts +++ b/packages/slice-machine/src/modules/selectedCustomType/stateHelpers.ts @@ -22,7 +22,7 @@ const updateTab = const deleteTab = ( state: SelectedCustomTypeStoreType, - tabId: string + tabId: string, ): SelectedCustomTypeStoreType => { if (!state) return state; const tabs = state.model.tabs.filter((v) => v.key !== tabId); diff --git a/packages/slice-machine/src/modules/selectedSlice/actions.ts b/packages/slice-machine/src/modules/selectedSlice/actions.ts index f9b7496c7c..743972ede0 100644 --- a/packages/slice-machine/src/modules/selectedSlice/actions.ts +++ b/packages/slice-machine/src/modules/selectedSlice/actions.ts @@ -28,7 +28,7 @@ export type SelectedSliceActions = | ActionType; export const updateSelectedSliceMocks = createAction( - "SELECTED_SLICE/UPDATE_MOCKS" + "SELECTED_SLICE/UPDATE_MOCKS", )<{ mocks: SharedSliceContent[]; }>(); @@ -65,7 +65,7 @@ export const removeSliceWidgetCreator = createAction("SLICE/REMOVE_WIDGET")<{ }>(); export const updateSliceWidgetMockCreator = createAction( - "SLICE/UPDATE_WIDGET_MOCK" + "SLICE/UPDATE_WIDGET_MOCK", )<{ variationId: string; widgetArea: WidgetsArea; @@ -76,7 +76,7 @@ export const updateSliceWidgetMockCreator = createAction( }>(); export const deleteSliceWidgetMockCreator = createAction( - "SLICE/DELETE_WIDGET_MOCK" + "SLICE/DELETE_WIDGET_MOCK", )<{ variationId: string; widgetArea: WidgetsArea; @@ -86,7 +86,7 @@ export const deleteSliceWidgetMockCreator = createAction( export const updateSliceCreator = createAsyncAction( "SLICE/UPDATE.REQUEST", "SLICE/UPDATE.RESPONSE", - "SLICE/UPDATE.FAILURE" + "SLICE/UPDATE.FAILURE", )< { component: ComponentUI; diff --git a/packages/slice-machine/src/modules/selectedSlice/reducer.ts b/packages/slice-machine/src/modules/selectedSlice/reducer.ts index 2742c946be..10d7e90599 100644 --- a/packages/slice-machine/src/modules/selectedSlice/reducer.ts +++ b/packages/slice-machine/src/modules/selectedSlice/reducer.ts @@ -63,14 +63,14 @@ export const selectedSliceReducer: Reducer< return ComponentUI.updateVariation( prevState, - variationId + variationId, )((v) => Variation.addWidget(v, widgetsArea, key, value)); } return prevState; } catch (err) { console.error( // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `[store/addWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}` + `[store/addWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}`, ); return prevState; } @@ -91,16 +91,16 @@ export const selectedSliceReducer: Reducer< return ComponentUI.updateVariation( prevState, - variationId + variationId, )((v) => - Variation.replaceWidget(v, widgetsArea, previousKey, newKey, value) + Variation.replaceWidget(v, widgetsArea, previousKey, newKey, value), ); } return prevState; } catch (err) { console.error( // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - `[store/replaceWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}` + `[store/replaceWidget] Model is invalid for widget "${value.type}".\nFull error: ${err}`, ); return prevState; } @@ -124,7 +124,7 @@ export const selectedSliceReducer: Reducer< return ComponentUI.updateVariation( prevState, - variationId + variationId, )((v) => Variation.reorderWidget(v, widgetsArea, start, end)); } case getType(removeSliceWidgetCreator): { @@ -133,7 +133,7 @@ export const selectedSliceReducer: Reducer< return ComponentUI.updateVariation( prevState, - variationId + variationId, )((v) => Variation.deleteWidget(v, widgetsArea, key)); } case getType(copyVariationSliceCreator): { diff --git a/packages/slice-machine/src/modules/selectedSlice/sagas.ts b/packages/slice-machine/src/modules/selectedSlice/sagas.ts index 9298a06d45..0888431826 100644 --- a/packages/slice-machine/src/modules/selectedSlice/sagas.ts +++ b/packages/slice-machine/src/modules/selectedSlice/sagas.ts @@ -29,7 +29,7 @@ export function* updateSliceSaga({ }); const { errors } = (yield call( updateSliceApiClient, - component + component, )) as SagaReturnType; if (errors.length > 0) { return setData({ @@ -55,14 +55,14 @@ export function* updateSliceSaga({ })) as SagaReturnType; yield put( - updateSliceCreator.success({ component: { ...component, mocks } }) + updateSliceCreator.success({ component: { ...component, mocks } }), ); } catch (e) { yield put( openToasterCreator({ content: "Internal Error: Models & mocks not generated", type: ToasterType.ERROR, - }) + }), ); } } @@ -70,7 +70,7 @@ export function* updateSliceSaga({ function* watchSaveSlice() { yield takeLatest( getType(updateSliceCreator.request), - withLoader(updateSliceSaga, LoadingKeysEnum.SAVE_SLICE) + withLoader(updateSliceSaga, LoadingKeysEnum.SAVE_SLICE), ); } diff --git a/packages/slice-machine/src/modules/selectedSlice/selectors.ts b/packages/slice-machine/src/modules/selectedSlice/selectors.ts index 40f4d28323..8c8d8a8aa6 100644 --- a/packages/slice-machine/src/modules/selectedSlice/selectors.ts +++ b/packages/slice-machine/src/modules/selectedSlice/selectors.ts @@ -5,7 +5,7 @@ import { getLibraries } from "../slices"; export const selectSliceById = ( store: SliceMachineStoreType, libraryName: string, - sliceId: string + sliceId: string, ) => { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions const libraries = getLibraries(store) || []; @@ -19,7 +19,7 @@ export const selectSliceById = ( export const selectCurrentSlice = ( store: SliceMachineStoreType, lib: string, - sliceName: string + sliceName: string, ) => { const openedModel = store.selectedSlice; if (openedModel?.model.name === sliceName) { @@ -27,7 +27,7 @@ export const selectCurrentSlice = ( } const library = getLibraries(store)?.find( - (l) => l.name.replace(/\//g, "--") === lib + (l) => l.name.replace(/\//g, "--") === lib, ); const slice = library?.components.find((c) => c.model.name === sliceName); @@ -38,7 +38,7 @@ export const selectCurrentSlice = ( export const isSelectedSliceTouched = ( store: SliceMachineStoreType, lib: string, - sliceId: string + sliceId: string, ): boolean => { const selectedSlice = store.selectedSlice; const library = getLibraries(store)?.find((l) => l.name === lib); @@ -48,7 +48,7 @@ export const isSelectedSliceTouched = ( const sameVariations = equal( librarySlice.model.variations, - selectedSlice.model.variations + selectedSlice.model.variations, ); return !sameVariations; diff --git a/packages/slice-machine/src/modules/simulator/index.ts b/packages/slice-machine/src/modules/simulator/index.ts index 06ae5ba93f..efcee6f175 100644 --- a/packages/slice-machine/src/modules/simulator/index.ts +++ b/packages/slice-machine/src/modules/simulator/index.ts @@ -47,7 +47,7 @@ export const initialState: SimulatorStoreType = { export const checkSimulatorSetupCreator = createAsyncAction( "SIMULATOR/CHECK_SETUP.REQUEST", "SIMULATOR/CHECK_SETUP.SUCCESS", - "SIMULATOR/CHECK_SETUP.FAILURE" + "SIMULATOR/CHECK_SETUP.FAILURE", )< { callback?: () => void; @@ -65,13 +65,13 @@ export const checkSimulatorSetupCreator = createAsyncAction( export const connectToSimulatorIframeCreator = createAsyncAction( "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.REQUEST", "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.SUCCESS", - "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.FAILURE" + "SIMULATOR/CONNECT_TO_SIMULATOR_IFRAME.FAILURE", )(); export const saveSliceMockCreator = createAsyncAction( "SIMULATOR/SAVE_MOCK.REQUEST", "SIMULATOR/SAVE_MOCK.SUCCESS", - "SIMULATOR/SAVE_MOCK.FAILURE" + "SIMULATOR/SAVE_MOCK.FAILURE", )(); type SimulatorActions = ActionType< @@ -88,19 +88,19 @@ type SimulatorActions = ActionType< // Selectors export const selectSetupStatus = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): SimulatorStoreType["setupStatus"] => state.simulator.setupStatus; export const selectIsWaitingForIFrameCheck = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): boolean => state.simulator.isWaitingForIframeCheck; export const selectIframeStatus = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): string | null => state.simulator.iframeStatus; export const selectSetupSteps = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): SimulatorStoreType["setupSteps"] => state.simulator.setupSteps; export const selectSavingMock = (state: SliceMachineStoreType): boolean => @@ -109,7 +109,7 @@ export const selectSavingMock = (state: SliceMachineStoreType): boolean => // Reducer export const simulatorReducer: Reducer = ( state = initialState, - action + action, ) => { switch (action.type) { case getType(connectToSimulatorIframeCreator.request): @@ -176,7 +176,7 @@ export const simulatorReducer: Reducer = ( // Sagas export function* checkSetupSaga( - action: ReturnType + action: ReturnType, ) { try { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment @@ -191,7 +191,7 @@ export function* checkSetupSaga( checkSimulatorSetupCreator.success({ setupSteps: setupSteps.steps, setupStatus, - }) + }), ); yield put(updateManifestCreator({ value: setupStatus.value })); if (action.payload.callback) { @@ -232,7 +232,7 @@ export function* failCheckSetupSaga({ setupSteps, }: { setupSteps?: NonNullable } = {}) { const isPreviewAvailableForFramework = (yield select( - selectIsSimulatorAvailableForFramework + selectIsSimulatorAvailableForFramework, )) as ReturnType; if (!isPreviewAvailableForFramework) { @@ -243,7 +243,7 @@ export function* failCheckSetupSaga({ checkSimulatorSetupCreator.failure({ setupSteps, error: new Error(), - }) + }), ); yield put(modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP })); } @@ -262,7 +262,7 @@ export function* saveSliceMockSaga({ openToasterCreator({ type: ToasterType.SUCCESS, content: "Saved", - }) + }), ); yield put(updateSliceMock(payload)); @@ -273,7 +273,7 @@ export function* saveSliceMockSaga({ openToasterCreator({ type: ToasterType.ERROR, content: "Error saving content", - }) + }), ); yield put(saveSliceMockCreator.failure()); } @@ -283,21 +283,24 @@ export function* saveSliceMockSaga({ function* watchCheckSetup() { yield takeLeading( getType(checkSimulatorSetupCreator.request), - withLoader(checkSetupSaga, LoadingKeysEnum.CHECK_SIMULATOR) + withLoader(checkSetupSaga, LoadingKeysEnum.CHECK_SIMULATOR), ); } function* watchIframeCheck() { yield takeLeading( getType(connectToSimulatorIframeCreator.request), - withLoader(connectToSimulatorIframe, LoadingKeysEnum.CHECK_SIMULATOR_IFRAME) + withLoader( + connectToSimulatorIframe, + LoadingKeysEnum.CHECK_SIMULATOR_IFRAME, + ), ); } function* watchSaveSliceMock() { yield takeLatest( getType(saveSliceMockCreator.request), - withLoader(saveSliceMockSaga, LoadingKeysEnum.SIMULATOR_SAVE_MOCK) + withLoader(saveSliceMockSaga, LoadingKeysEnum.SIMULATOR_SAVE_MOCK), ); } diff --git a/packages/slice-machine/src/modules/slices/index.ts b/packages/slice-machine/src/modules/slices/index.ts index bc74e10535..16433f4698 100644 --- a/packages/slice-machine/src/modules/slices/index.ts +++ b/packages/slice-machine/src/modules/slices/index.ts @@ -41,7 +41,7 @@ export const createSlice = createAction("SLICES/CREATE_SLICE")<{ export const renameSliceCreator = createAsyncAction( "SLICES/RENAME.REQUEST", "SLICES/RENAME.RESPONSE", - "SLICES/RENAME.FAILURE" + "SLICES/RENAME.FAILURE", )< { libName: string; @@ -57,7 +57,7 @@ export const renameSliceCreator = createAsyncAction( export const deleteSliceCreator = createAsyncAction( "SLICES/DELETE.REQUEST", "SLICES/DELETE.RESPONSE", - "SLICES/DELETE.FAILURE" + "SLICES/DELETE.FAILURE", )< { sliceId: string; @@ -85,29 +85,29 @@ type SlicesActions = // Selectors export const getLibraries = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): ReadonlyArray => store.slices.libraries; export const getRemoteSlice = ( store: SliceMachineStoreType, - componentId: string + componentId: string, ): SliceSM | undefined => { return store.slices.remoteSlices.find((rs) => rs.id === componentId); }; export const getRemoteSlices = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): ReadonlyArray => store.slices.remoteSlices; export const getFrontendSlices = ( - store: SliceMachineStoreType + store: SliceMachineStoreType, ): LocalOrRemoteSlice[] => normalizeFrontendSlices(store.slices.libraries, getRemoteSlices(store)); // Reducer export const slicesReducer: Reducer = ( state, - action + action, ) => { if (!state) return null; @@ -178,7 +178,7 @@ export const slicesReducer: Reducer = ( [variationId]: screenshot, }, } - : c + : c, ), }; }); @@ -192,7 +192,7 @@ export const slicesReducer: Reducer = ( return { ...library, components: library.components.filter( - (component) => component.model.id !== sliceId + (component) => component.model.id !== sliceId, ), }; }); @@ -239,11 +239,11 @@ export function* renameSliceSaga({ const { libName, sliceId, newSliceName } = payload; try { const slice = (yield select((store: SliceMachineStoreType) => - selectSliceById(store, libName, sliceId) + selectSliceById(store, libName, sliceId), )) as ReturnType; if (!slice) { throw new Error( - `Slice "${payload.sliceId} in the "${payload.libName}" library not found.` + `Slice "${payload.sliceId} in the "${payload.libName}" library not found.`, ); } @@ -260,14 +260,14 @@ export function* renameSliceSaga({ openToasterCreator({ content: "Slice name updated", type: ToasterType.SUCCESS, - }) + }), ); } catch (e) { yield put( openToasterCreator({ content: "Internal Error: Slice name not saved", type: ToasterType.ERROR, - }) + }), ); } } @@ -275,7 +275,7 @@ export function* renameSliceSaga({ function* watchRenameSlice() { yield takeLatest( getType(renameSliceCreator.request), - withLoader(renameSliceSaga, LoadingKeysEnum.RENAME_SLICE) + withLoader(renameSliceSaga, LoadingKeysEnum.RENAME_SLICE), ); } @@ -287,7 +287,7 @@ export function* deleteSliceSaga({ const result = (yield call( deleteSlice, sliceId, - libName + libName, )) as SagaReturnType; if (result.errors.length > 0) { throw result.errors; @@ -297,14 +297,14 @@ export function* deleteSliceSaga({ openToasterCreator({ content: `Successfully deleted Slice “${sliceName}”`, type: ToasterType.SUCCESS, - }) + }), ); } catch (e) { yield put( openToasterCreator({ content: "An unexpected error happened while deleting your slice.", type: ToasterType.ERROR, - }) + }), ); } yield put(modalCloseCreator()); @@ -313,7 +313,7 @@ export function* deleteSliceSaga({ function* watchDeleteSlice() { yield takeLatest( getType(deleteSliceCreator.request), - withLoader(deleteSliceSaga, LoadingKeysEnum.DELETE_SLICE) + withLoader(deleteSliceSaga, LoadingKeysEnum.DELETE_SLICE), ); } diff --git a/packages/slice-machine/src/modules/toaster/index.tsx b/packages/slice-machine/src/modules/toaster/index.tsx index a0a9532d03..1cbd6245f8 100644 --- a/packages/slice-machine/src/modules/toaster/index.tsx +++ b/packages/slice-machine/src/modules/toaster/index.tsx @@ -43,7 +43,7 @@ export const closeToasterCreator = createAction("TOASTER/CLOSE")<{ // Sagas export function* openToasterSaga( - action: ReturnType + action: ReturnType, ) { switch (action.payload.type) { case ToasterType.SUCCESS: @@ -68,13 +68,13 @@ export function* openToasterSaga( } export function* updateToasterSaga( - action: ReturnType + action: ReturnType, ) { toast.update(action.payload.toasterId, action.payload.options); } export function* closeToasterSaga( - action: ReturnType + action: ReturnType, ) { toast.dismiss(action.payload.toasterId); } diff --git a/packages/slice-machine/src/modules/toaster/utils.tsx b/packages/slice-machine/src/modules/toaster/utils.tsx index 7902773009..fe97d76edd 100644 --- a/packages/slice-machine/src/modules/toaster/utils.tsx +++ b/packages/slice-machine/src/modules/toaster/utils.tsx @@ -23,7 +23,7 @@ export const handleRemoteResponse = return ToasterType.WARNING; } return ToasterType.SUCCESS; - })() + })(), ); } }; diff --git a/packages/slice-machine/src/modules/useSliceMachineActions.ts b/packages/slice-machine/src/modules/useSliceMachineActions.ts index 2404a73ea6..033aa2d4e6 100644 --- a/packages/slice-machine/src/modules/useSliceMachineActions.ts +++ b/packages/slice-machine/src/modules/useSliceMachineActions.ts @@ -114,13 +114,13 @@ const useSliceMachineActions = () => { dispatch( modalOpenCreator({ modalKey: ModalKeysEnum.SOFT_DELETE_DOCUMENTS_DRAWER, - }) + }), ); const openDeleteDocumentsDrawerOverLimit = () => dispatch( modalOpenCreator({ modalKey: ModalKeysEnum.HARD_DELETE_DOCUMENTS_DRAWER, - }) + }), ); const openSimulatorSetupModal = () => dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP })); @@ -140,13 +140,13 @@ const useSliceMachineActions = () => { dispatch( skipReviewCreator({ reviewType, - }) + }), ); const sendAReview = (reviewType: UserReviewType) => dispatch( sendAReviewCreator({ reviewType, - }) + }), ); const setUpdatesViewed = (versions: UserContextStoreType["updatesViewed"]) => dispatch(updatesViewedCreator(versions)); @@ -161,16 +161,16 @@ const useSliceMachineActions = () => { id: string, label: string, repeatable: boolean, - format: CustomTypeFormat + format: CustomTypeFormat, ) => dispatch( - createCustomTypeCreator.request({ id, label, repeatable, format }) + createCustomTypeCreator.request({ id, label, repeatable, format }), ); // Custom type module const initCustomTypeStore = ( model: CustomTypeSM, - remoteModel: CustomTypeSM | undefined + remoteModel: CustomTypeSM | undefined, ) => dispatch(initCustomTypeStoreCreator({ model, remoteModel })); const cleanupCustomTypeStore = () => dispatch(cleanupCustomTypeStoreCreator()); @@ -185,21 +185,21 @@ const useSliceMachineActions = () => { dispatch( saveCustomTypeCreator.success({ customType: CustomTypes.toSM(customType), - }) + }), ); const deleteCustomTypeSuccess = (id: string) => dispatch( deleteCustomTypeCreator.success({ customTypeId: id, - }) + }), ); const renameAvailableCustomTypeSuccess = (customType: CustomType) => dispatch( renameAvailableCustomType({ renamedCustomType: CustomTypes.toSM(customType), - }) + }), ); /** End of sucess actions */ @@ -213,7 +213,7 @@ const useSliceMachineActions = () => { const addCustomTypeField = ( tabId: string, fieldId: string, - field: TabField + field: TabField, ) => dispatch(addFieldCreator({ tabId, fieldId, field })); const deleteCustomTypeField = (tabId: string, fieldId: string) => dispatch(deleteFieldCreator({ tabId, fieldId })); @@ -225,10 +225,10 @@ const useSliceMachineActions = () => { tabId: string, previousFieldId: string, newFieldId: string, - value: TabField + value: TabField, ) => dispatch( - replaceFieldCreator({ tabId, previousFieldId, newFieldId, value }) + replaceFieldCreator({ tabId, previousFieldId, newFieldId, value }), ); const createSliceZone = (tabId: string) => dispatch(createSliceZoneCreator({ tabId })); @@ -240,25 +240,25 @@ const useSliceMachineActions = () => { tabId: string, groupId: string, fieldId: string, - field: NestableWidget + field: NestableWidget, ) => dispatch(addFieldIntoGroupCreator({ tabId, groupId, fieldId, field })); const deleteFieldIntoGroup = ( tabId: string, groupId: string, - fieldId: string + fieldId: string, ) => dispatch(deleteFieldIntoGroupCreator({ tabId, groupId, fieldId })); const reorderFieldIntoGroup = ( tabId: string, groupId: string, start: number, - end: number + end: number, ) => dispatch(reorderFieldIntoGroupCreator({ tabId, groupId, start, end })); const replaceFieldIntoGroup = ( tabId: string, groupId: string, previousFieldId: string, newFieldId: string, - value: NestableWidget + value: NestableWidget, ) => dispatch( replaceFieldIntoGroupCreator({ @@ -267,7 +267,7 @@ const useSliceMachineActions = () => { previousFieldId, newFieldId, value, - }) + }), ); // Slice module @@ -278,7 +278,7 @@ const useSliceMachineActions = () => { variationId: string, widgetsArea: WidgetsArea, key: string, - value: NestableWidget + value: NestableWidget, ) => { dispatch(addSliceWidgetCreator({ variationId, widgetsArea, key, value })); }; @@ -288,7 +288,7 @@ const useSliceMachineActions = () => { widgetsArea: WidgetsArea, previousKey: string, newKey: string, - value: NestableWidget + value: NestableWidget, ) => { dispatch( replaceSliceWidgetCreator({ @@ -297,7 +297,7 @@ const useSliceMachineActions = () => { previousKey, newKey, value, - }) + }), ); }; @@ -305,7 +305,7 @@ const useSliceMachineActions = () => { variationId: string, widgetsArea: WidgetsArea, start: number, - end: number | undefined + end: number | undefined, ) => { dispatch( reorderSliceWidgetCreator({ @@ -313,35 +313,35 @@ const useSliceMachineActions = () => { widgetsArea, start, end, - }) + }), ); }; const removeSliceWidget = ( variationId: string, widgetsArea: WidgetsArea, - key: string + key: string, ) => { dispatch( removeSliceWidgetCreator({ variationId, widgetsArea, key, - }) + }), ); }; const deleteSliceWidgetMock = ( variationId: string, widgetArea: WidgetsArea, - newKey: string + newKey: string, ) => { dispatch( deleteSliceWidgetMockCreator({ variationId, widgetArea, newKey, - }) + }), ); }; @@ -351,7 +351,7 @@ const useSliceMachineActions = () => { previousKey: string, newKey: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any - mockValue: any + mockValue: any, ) => { dispatch( updateSliceWidgetMockCreator({ @@ -361,7 +361,7 @@ const useSliceMachineActions = () => { newKey, // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment mockValue, - }) + }), ); }; @@ -369,7 +369,7 @@ const useSliceMachineActions = () => { variationId: string, component: ComponentUI, screenDimensions: ScreenDimensions, - method: ScreenshotGenerationMethod + method: ScreenshotGenerationMethod, ) => { dispatch( generateSliceScreenshotCreator.request({ @@ -377,7 +377,7 @@ const useSliceMachineActions = () => { component, screenDimensions, method, - }) + }), ); }; @@ -385,7 +385,7 @@ const useSliceMachineActions = () => { variationId: string, component: ComponentUI, file: Blob, - method: ScreenshotGenerationMethod + method: ScreenshotGenerationMethod, ) => { dispatch( generateSliceCustomScreenshotCreator.request({ @@ -393,27 +393,27 @@ const useSliceMachineActions = () => { component, file, method, - }) + }), ); }; const updateSlice = ( component: ComponentUI, // eslint-disable-next-line @typescript-eslint/no-explicit-any - setData: (data: any) => void + setData: (data: any) => void, ) => { dispatch( updateSliceCreator.request({ component, setData, - }) + }), ); }; const copyVariationSlice = ( key: string, name: string, - copied: VariationSM + copied: VariationSM, ) => { dispatch(copyVariationSliceCreator({ key, name, copied })); }; @@ -424,14 +424,14 @@ const useSliceMachineActions = () => { const renameSlice = ( libName: string, sliceId: string, - newSliceName: string + newSliceName: string, ) => dispatch( renameSliceCreator.request({ sliceId, newSliceName, libName, - }) + }), ); const deleteSlice = (sliceId: string, sliceName: string, libName: string) => @@ -440,7 +440,7 @@ const useSliceMachineActions = () => { sliceId, sliceName, libName, - }) + }), ); const pushChanges = (payload: ChangesPushSagaPayload) => @@ -449,7 +449,7 @@ const useSliceMachineActions = () => { // Toaster store const openToaster = ( content: string | React.ReactNode, - type: GenericToastTypes + type: GenericToastTypes, ) => dispatch(openToasterCreator({ content, type })); // Simulator @@ -466,7 +466,7 @@ const useSliceMachineActions = () => { libraries: serverState.libraries, remoteSlices: serverState.remoteSlices, clientError: serverState.clientError, - }) + }), ); }; diff --git a/packages/slice-machine/src/modules/userContext/index.ts b/packages/slice-machine/src/modules/userContext/index.ts index 45191cf2ae..e0cb54fc54 100644 --- a/packages/slice-machine/src/modules/userContext/index.ts +++ b/packages/slice-machine/src/modules/userContext/index.ts @@ -43,15 +43,15 @@ export const updatesViewedCreator = createAction("USER_CONTEXT/VIEWED_UPDATES")< >(); export const hasSeenTutorialsToolTipCreator = createAction( - "USER_CONTEXT/VIEW_TUTORIALS_TOOL_TIP" + "USER_CONTEXT/VIEW_TUTORIALS_TOOL_TIP", )(); export const hasSeenSimulatorToolTipCreator = createAction( - "USER_CONTEXT/VIEW_SIMULATOR_TOOL_TIP" + "USER_CONTEXT/VIEW_SIMULATOR_TOOL_TIP", )(); export const hasSeenChangesToolTipCreator = createAction( - "USER_CONTEXT/VIEW_CHANGES_TOOL_TIP" + "USER_CONTEXT/VIEW_CHANGES_TOOL_TIP", )(); type userContextActions = ActionType< @@ -73,23 +73,23 @@ export const getUserReview = (state: SliceMachineStoreType): UserReviewState => }; export const getUpdatesViewed = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): UserContextStoreType["updatesViewed"] => state.userContext.updatesViewed; export const userHasSeenTutorialsToolTip = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): boolean => state.userContext.hasSeenTutorialsToolTip || false; export const userHasSeenSimulatorToolTip = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): boolean => state.userContext.hasSeenSimulatorToolTip || false; export const userHasSeenChangesToolTip = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): boolean => state.userContext.hasSeenChangesToolTip || false; export const getLastSyncChange = ( - state: SliceMachineStoreType + state: SliceMachineStoreType, ): number | null => state.userContext.lastSyncChange; // Reducer @@ -150,7 +150,7 @@ export const userContextReducer: Reducer< }; const getAuthStatus = ( - clientError: ErrorWithStatus | undefined + clientError: ErrorWithStatus | undefined, ): AuthStatus => { switch (clientError?.status) { case undefined: { diff --git a/packages/slice-machine/src/redux/store.ts b/packages/slice-machine/src/redux/store.ts index 2769e35e85..102a6b0c12 100644 --- a/packages/slice-machine/src/redux/store.ts +++ b/packages/slice-machine/src/redux/store.ts @@ -23,7 +23,7 @@ declare const window: { }; export default function configureStore( - preloadedState: Partial = {} + preloadedState: Partial = {}, ): { store: Store; persistor: Persistor } { const middlewares = [sagaMiddleware, routerMiddleware]; const enhancers = [applyMiddleware(...middlewares)]; @@ -48,7 +48,7 @@ export default function configureStore( persistedReducer, preloadedState, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call - composeEnhancers(...enhancers) + composeEnhancers(...enhancers), ); const persistor = persistStore(store); sagaMiddleware.run(rootSaga); diff --git a/packages/slice-machine/src/utils/editor.ts b/packages/slice-machine/src/utils/editor.ts index 2f95a68cc3..f5533a11a0 100644 --- a/packages/slice-machine/src/utils/editor.ts +++ b/packages/slice-machine/src/utils/editor.ts @@ -1,7 +1,7 @@ import { SharedSliceContent } from "@prismicio/types-internal/lib/content"; export const defaultSharedSliceContent = ( - variationId: string + variationId: string, ): SharedSliceContent => ({ __TYPE__: "SharedSliceContent", variation: variationId, diff --git a/packages/slice-machine/src/utils/fieldNameCreator.ts b/packages/slice-machine/src/utils/fieldNameCreator.ts index 51e71fbc71..28a651c533 100644 --- a/packages/slice-machine/src/utils/fieldNameCreator.ts +++ b/packages/slice-machine/src/utils/fieldNameCreator.ts @@ -3,7 +3,7 @@ export const createFriendlyFieldNameWithId = (fieldId: string): string => { /[\s\-_]+(\w)/g, function (_match: string, p1: string) { return p1.toUpperCase(); - } + }, ); return fieldIdWithoutSpecialCharacter @@ -15,7 +15,7 @@ export const createFriendlyFieldNameWithId = (fieldId: string): string => { // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions if (p1) return p1.toUpperCase(); return match; - } + }, ) .trim(); }; diff --git a/packages/slice-machine/test/__setup__.ts b/packages/slice-machine/test/__setup__.ts index d3651ca5bf..53e4c46d63 100644 --- a/packages/slice-machine/test/__setup__.ts +++ b/packages/slice-machine/test/__setup__.ts @@ -46,7 +46,7 @@ beforeEach(async (ctx) => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); await fs.mkdir(os.homedir(), { recursive: true }); @@ -104,7 +104,7 @@ vi.mock("analytics-node", () => { if (callback) { callback(); } - } + }, ); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access @@ -113,7 +113,7 @@ vi.mock("analytics-node", () => { if (callback) { callback(); } - } + }, ); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access @@ -122,7 +122,7 @@ vi.mock("analytics-node", () => { if (callback) { callback(); } - } + }, ); return { @@ -159,7 +159,7 @@ vi.stubGlobal( } } else { throw new Error( - "`fetch` with RequestInfo is not supported in this test environment." + "`fetch` with RequestInfo is not supported in this test environment.", ); } @@ -185,7 +185,7 @@ vi.stubGlobal( } else { return res; } - }) + }), ); vi.stubGlobal( @@ -196,5 +196,5 @@ vi.stubGlobal( observe: vi.fn(), unobserve: vi.fn(), }; - }) + }), ); diff --git a/packages/slice-machine/test/__testutils__/createPrismicAuthLoginResponse.ts b/packages/slice-machine/test/__testutils__/createPrismicAuthLoginResponse.ts index 600a5d9d18..2a12d8b48e 100644 --- a/packages/slice-machine/test/__testutils__/createPrismicAuthLoginResponse.ts +++ b/packages/slice-machine/test/__testutils__/createPrismicAuthLoginResponse.ts @@ -4,7 +4,7 @@ type PrismicAuthLoginResponse = { }; export const createPrismicAuthLoginResponse = ( - loginResponse?: Partial + loginResponse?: Partial, ): PrismicAuthLoginResponse => { return { email: `name@example.com`, diff --git a/packages/slice-machine/test/__testutils__/createTestProject.ts b/packages/slice-machine/test/__testutils__/createTestProject.ts index 2f85a9e7f6..b0904bc5fa 100644 --- a/packages/slice-machine/test/__testutils__/createTestProject.ts +++ b/packages/slice-machine/test/__testutils__/createTestProject.ts @@ -17,7 +17,7 @@ export const createTestProject = async ( > & { adapter?: string | SliceMachinePlugin; plugins?: (string | SliceMachinePlugin)[]; - } = {} + } = {}, ): Promise => { const state = expect.getState(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -26,7 +26,7 @@ export const createTestProject = async ( await fs.mkdir(os.tmpdir(), { recursive: true }); const root = await fs.mkdtemp( - path.join(os.tmpdir(), `project-${testNameDigest}-`) + path.join(os.tmpdir(), `project-${testNameDigest}-`), ); await fs.writeFile(path.join(root, "package.json"), JSON.stringify({})); @@ -47,7 +47,7 @@ export const createTestProject = async ( ...sliceMachineConfig, adapter: adapterName, plugins, - }) + }), ); return root; diff --git a/packages/slice-machine/test/__testutils__/index.tsx b/packages/slice-machine/test/__testutils__/index.tsx index 7692486bf9..89a9cfba21 100644 --- a/packages/slice-machine/test/__testutils__/index.tsx +++ b/packages/slice-machine/test/__testutils__/index.tsx @@ -26,7 +26,7 @@ function render( preloadedState, store = configureStore(preloadedState).store, ...renderOptions - }: RenderArgs = {} + }: RenderArgs = {}, ): RenderReturnType { if (!document.getElementById("__next")) { const div = document.createElement("div"); diff --git a/packages/slice-machine/test/__testutils__/mockAWSACLAPI.ts b/packages/slice-machine/test/__testutils__/mockAWSACLAPI.ts index 2a740260a2..8f64802ddd 100644 --- a/packages/slice-machine/test/__testutils__/mockAWSACLAPI.ts +++ b/packages/slice-machine/test/__testutils__/mockAWSACLAPI.ts @@ -40,7 +40,7 @@ type MockAWSACLAPIReturnType = { export const mockAWSACLAPI = ( ctx: TestContext, - config?: MockAWSACLAPIConfig + config?: MockAWSACLAPIConfig, ): MockAWSACLAPIReturnType => { const endpoint = config?.endpoint ?? @@ -74,16 +74,16 @@ export const mockAWSACLAPI = ( fields: s3ACL.requiredFormDataFields, }, imgixEndpoint: s3ACL.imgixEndpoint, - }) + }), ); } else { return res( ctx.json({ message: "[MOCK ERROR MESSAGE]: Failed to generate ACL", - }) + }), ); } - }) + }), ); } @@ -110,7 +110,7 @@ export const mockAWSACLAPI = ( Buffer.isBuffer(formData.file.data) && formData.file.data.equals(expectedUpload.file) ); - } + }, ); if (!expectedFileMetadata) { @@ -130,7 +130,7 @@ export const mockAWSACLAPI = ( formData[key].data === uploadEndpointConfig.requiredFormDataFields[key] ); - } + }, ) && Buffer.isBuffer(formData.file.data) && formData.file.data.equals(expectedFileMetadata.file) @@ -139,7 +139,7 @@ export const mockAWSACLAPI = ( } else { return res(ctx.status(401)); } - }) + }), ); } @@ -156,8 +156,8 @@ export const mockAWSACLAPI = ( } else { return res(ctx.status(401)); } - } - ) + }, + ), ); } diff --git a/packages/slice-machine/test/__testutils__/mockCustomTypesAPI.ts b/packages/slice-machine/test/__testutils__/mockCustomTypesAPI.ts index b288f36d6f..c415ae0b0e 100644 --- a/packages/slice-machine/test/__testutils__/mockCustomTypesAPI.ts +++ b/packages/slice-machine/test/__testutils__/mockCustomTypesAPI.ts @@ -15,7 +15,7 @@ type MockCustomTypesAPIConfig = { export const mockCustomTypesAPI = ( ctx: TestContext, - config?: MockCustomTypesAPIConfig + config?: MockCustomTypesAPIConfig, ): void => { const endpoint = config?.endpoint ?? "https://customtypes.prismic.io"; @@ -23,8 +23,8 @@ export const mockCustomTypesAPI = ( ctx.msw.use( rest.get( new URL("./customtypes", endpoint).toString(), - config.onCustomTypeGetAll - ) + config.onCustomTypeGetAll, + ), ); } @@ -40,8 +40,8 @@ export const mockCustomTypesAPI = ( } else { return res(ctx.status(404)); } - } - ) + }, + ), ); } @@ -49,8 +49,8 @@ export const mockCustomTypesAPI = ( ctx.msw.use( rest.post( new URL("./customtypes/insert", endpoint).toString(), - config.onCustomTypeInsert - ) + config.onCustomTypeInsert, + ), ); } @@ -58,14 +58,14 @@ export const mockCustomTypesAPI = ( ctx.msw.use( rest.post( new URL("./customtypes/update", endpoint).toString(), - config.onCustomTypeUpdate - ) + config.onCustomTypeUpdate, + ), ); } if (config?.onSliceGetAll) { ctx.msw.use( - rest.get(new URL("./slices", endpoint).toString(), config.onSliceGetAll) + rest.get(new URL("./slices", endpoint).toString(), config.onSliceGetAll), ); } @@ -81,8 +81,8 @@ export const mockCustomTypesAPI = ( } else { return res(ctx.status(404)); } - } - ) + }, + ), ); } @@ -90,8 +90,8 @@ export const mockCustomTypesAPI = ( ctx.msw.use( rest.post( new URL("./slices/insert", endpoint).toString(), - config.onSliceInsert - ) + config.onSliceInsert, + ), ); } @@ -99,8 +99,8 @@ export const mockCustomTypesAPI = ( ctx.msw.use( rest.post( new URL("./slices/update", endpoint).toString(), - config.onSliceUpdate - ) + config.onSliceUpdate, + ), ); } }; diff --git a/packages/slice-machine/test/__testutils__/mockPrismicAuthAPI.ts b/packages/slice-machine/test/__testutils__/mockPrismicAuthAPI.ts index 745a0e27a2..0c3c3f75e3 100644 --- a/packages/slice-machine/test/__testutils__/mockPrismicAuthAPI.ts +++ b/packages/slice-machine/test/__testutils__/mockPrismicAuthAPI.ts @@ -18,7 +18,7 @@ type MockPrismicUserAPIReturnType = { export const mockPrismicAuthAPI = ( ctx: TestContext, - config?: MockPrismicAuthAPIConfig + config?: MockPrismicAuthAPIConfig, ): MockPrismicUserAPIReturnType => { const endpoint = config?.endpoint ?? "https://auth.prismic.io/"; @@ -49,8 +49,8 @@ export const mockPrismicAuthAPI = ( } else { return res(ctx.status(401)); } - } - ) + }, + ), ); return { diff --git a/packages/slice-machine/test/__testutils__/mockPrismicUserAPI.ts b/packages/slice-machine/test/__testutils__/mockPrismicUserAPI.ts index 93bbb076e6..e4d7b086e1 100644 --- a/packages/slice-machine/test/__testutils__/mockPrismicUserAPI.ts +++ b/packages/slice-machine/test/__testutils__/mockPrismicUserAPI.ts @@ -37,7 +37,7 @@ type MockPrismicUserAPIReturnType = { export const mockPrismicUserAPI = ( ctx: TestContext, - config?: MockPrismicUserAPIConfig + config?: MockPrismicUserAPIConfig, ): MockPrismicUserAPIReturnType => { const endpoint = config?.endpoint ?? "https://user.internal-prismic.io/"; @@ -64,7 +64,7 @@ export const mockPrismicUserAPI = ( } else { return res(ctx.status(401)); } - }) + }), ); } @@ -87,8 +87,8 @@ export const mockPrismicUserAPI = ( } else { return res(ctx.json({}), ctx.status(401)); } - } - ) + }, + ), ); } diff --git a/packages/slice-machine/test/__testutils__/readMSWFormData.ts b/packages/slice-machine/test/__testutils__/readMSWFormData.ts index aac8c55ea0..fb2c96eb0b 100644 --- a/packages/slice-machine/test/__testutils__/readMSWFormData.ts +++ b/packages/slice-machine/test/__testutils__/readMSWFormData.ts @@ -6,15 +6,15 @@ type FormDataField = | { data: string }; export const readMSWFormData = async ( - req: RestRequest + req: RestRequest, ): Promise> => { const boundary = parseMultipartFormData.getBoundary( // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - req.headers.get("Content-Type")! + req.headers.get("Content-Type")!, ); const parsedData = parseMultipartFormData.parse( Buffer.from(await req.text()), - boundary + boundary, ); const res: Record = {}; diff --git a/packages/slice-machine/test/components/CreateCustomTypeModal.test.tsx b/packages/slice-machine/test/components/CreateCustomTypeModal.test.tsx index 43e600c958..e4120a20e5 100644 --- a/packages/slice-machine/test/components/CreateCustomTypeModal.test.tsx +++ b/packages/slice-machine/test/components/CreateCustomTypeModal.test.tsx @@ -67,7 +67,7 @@ describe("CreateCustomTypeModal", () => { origin: "table", }, }), - expect.any(Function) + expect.any(Function), ); }); }); diff --git a/packages/slice-machine/test/components/LoginModal.test.tsx b/packages/slice-machine/test/components/LoginModal.test.tsx index 06153e55c1..93994203e8 100644 --- a/packages/slice-machine/test/components/LoginModal.test.tsx +++ b/packages/slice-machine/test/components/LoginModal.test.tsx @@ -42,7 +42,7 @@ describe("LoginModal", () => { expect(result.getByText("Click here").closest("a")).toHaveAttribute( "href", // Since we're not using the `start-slicemachine` server proxy, port defaults to Next/React Testing Library's default port - "https://prismic.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth" + "https://prismic.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth", ); }); @@ -61,7 +61,7 @@ describe("LoginModal", () => { expect(result.getByText("Click here").closest("a")).toHaveAttribute( "href", // Since we're not using the `start-slicemachine` server proxy, port defaults to Next/React Testing Library's default port - "https://wroom.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth" + "https://wroom.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth", ); }); }); diff --git a/packages/slice-machine/test/lib/builders/EditModal.test.tsx b/packages/slice-machine/test/lib/builders/EditModal.test.tsx index 7389bd2643..aa86368f07 100644 --- a/packages/slice-machine/test/lib/builders/EditModal.test.tsx +++ b/packages/slice-machine/test/lib/builders/EditModal.test.tsx @@ -42,11 +42,11 @@ describe("EditModal", () => { data={data} fields={fields} zoneType="slice" - /> + />, ); const removeButton = document.querySelector( - 'input[name="config.options.2"]' + 'input[name="config.options.2"]', )?.nextSibling; // @ts-expect-error TS(2345) FIXME: Argument of type 'ChildNode | null | undefined' is... Remove this comment to see the full error message @@ -97,21 +97,21 @@ describe("EditModal", () => { data={data} fields={fields} zoneType="slice" - /> + />, ); const labelInput = document.querySelector('input[name="config.label"]'); const fakeLabel = "rich text"; await act(async () => // @ts-expect-error TS(2345) FIXME: Argument of type 'Element | null' is not assignabl... Remove this comment to see the full error message - fireEvent.change(labelInput, { target: { value: fakeLabel } }) + fireEvent.change(labelInput, { target: { value: fakeLabel } }), ); const idInput = document.querySelector('input[name="id"]'); const fakeId = "some_id"; await act(async () => // @ts-expect-error TS(2345) FIXME: Argument of type 'Element | null' is not assignabl... Remove this comment to see the full error message - fireEvent.change(idInput, { target: { value: fakeId } }) + fireEvent.change(idInput, { target: { value: fakeId } }), ); const saveButton = document.querySelector('button[type="submit"]'); diff --git a/packages/slice-machine/test/lib/builders/buildersUtils.test.ts b/packages/slice-machine/test/lib/builders/buildersUtils.test.ts index ba10b70966..19fce37410 100644 --- a/packages/slice-machine/test/lib/builders/buildersUtils.test.ts +++ b/packages/slice-machine/test/lib/builders/buildersUtils.test.ts @@ -17,7 +17,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Image" + "Image", ); expect(widgetFound).toEqual(Widgets.Image); }); @@ -26,7 +26,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Color" + "Color", ); expect(widgetFound).toEqual(Widgets.Color); }); @@ -35,7 +35,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "UID" + "UID", ); expect(widgetFound).toEqual(Widgets.UID); }); @@ -44,7 +44,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Group" + "Group", ); expect(widgetFound).toEqual(Widgets.Group); }); @@ -53,7 +53,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "GeoPoint" + "GeoPoint", ); expect(widgetFound).toEqual(Widgets.GeoPoint); }); @@ -62,7 +62,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Select" + "Select", ); expect(widgetFound).toEqual(Widgets.Select); }); @@ -71,7 +71,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Boolean" + "Boolean", ); expect(widgetFound).toEqual(Widgets.Boolean); }); @@ -80,7 +80,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Date" + "Date", ); expect(widgetFound).toEqual(Widgets.Date); }); @@ -89,7 +89,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Timestamp" + "Timestamp", ); expect(widgetFound).toEqual(Widgets.Timestamp); }); @@ -98,7 +98,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Number" + "Number", ); expect(widgetFound).toEqual(Widgets.Number); }); @@ -107,7 +107,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, dumbConfig, - "Link" + "Link", ); expect(widgetFound).toEqual(Widgets.Link); }); @@ -121,7 +121,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, contentRelationshipConfig, - "Link" + "Link", ); expect(widgetFound).toEqual(Widgets.ContentRelationship); }); @@ -135,7 +135,7 @@ describe("utils/findWidgetByConfigOrType", () => { // @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message Widgets, contentRelationshipConfig, - "Link" + "Link", ); expect(widgetFound).toEqual(Widgets.LinkToMedia); }); diff --git a/packages/slice-machine/test/lib/models/common/CustomType/sliceZone.test.ts b/packages/slice-machine/test/lib/models/common/CustomType/sliceZone.test.ts index c02e7b187f..abeff2b3f2 100644 --- a/packages/slice-machine/test/lib/models/common/CustomType/sliceZone.test.ts +++ b/packages/slice-machine/test/lib/models/common/CustomType/sliceZone.test.ts @@ -19,7 +19,7 @@ describe("Slice Zone", () => { const result = SliceZone.removeSharedSlice(mockSliceZone, keyToRemove); expect(result.value.map((slice) => slice.key).includes(keyToRemove)).toBe( - false + false, ); expect(result.value.length).toEqual(2); }); @@ -41,7 +41,7 @@ describe("Slice Zone", () => { expect(result.value.map((slice) => slice.key)).toEqual( // @ts-expect-error TS(7006) FIXME: Parameter 'slice' implicitly has an 'any' type. - mockSliceZone.value.map((slice) => slice.key).concat([newKey]) + mockSliceZone.value.map((slice) => slice.key).concat([newKey]), ); expect(result.value.length).toEqual(4); }); diff --git a/packages/slice-machine/test/lib/models/common/ModelStatus.test.ts b/packages/slice-machine/test/lib/models/common/ModelStatus.test.ts index 9ca21b8b1e..30442aa5de 100644 --- a/packages/slice-machine/test/lib/models/common/ModelStatus.test.ts +++ b/packages/slice-machine/test/lib/models/common/ModelStatus.test.ts @@ -17,7 +17,7 @@ describe("Model Status", () => { test("computeModelStatus returns the status Modified", () => { const result = computeModelStatus( { local: model, remote: { ...model, name: "modified" } }, - true + true, ); expect(result.status).toBe(ModelStatus.Modified); }); diff --git a/packages/slice-machine/test/lib/models/common/widgets/index.test.ts b/packages/slice-machine/test/lib/models/common/widgets/index.test.ts index 9e22113dce..8f8524609b 100644 --- a/packages/slice-machine/test/lib/models/common/widgets/index.test.ts +++ b/packages/slice-machine/test/lib/models/common/widgets/index.test.ts @@ -20,10 +20,10 @@ describe("Widgets", () => { type: field?.type, config: field?.config, }, - { stripUnknown: true } - ) + { stripUnknown: true }, + ), ).toBeTruthy(); - } + }, ); test.each(widgetEntries)( @@ -59,7 +59,7 @@ describe("Widgets", () => { // compare the two fields to ensure that what slicemachine creates is what is written in the file system. expect(field).toBeDefined(); expect(field).toEqual(fieldExpected); - } + }, ); // Issue: https://github.com/prismicio/slice-machine/issues/672 @@ -78,8 +78,8 @@ describe("Widgets", () => { }, }, }, - { stripUnknown: true } - ) + { stripUnknown: true }, + ), ).toBeTruthy(); }); }); diff --git a/packages/slice-machine/test/lib/utils/shared/customTypes.test.ts b/packages/slice-machine/test/lib/utils/shared/customTypes.test.ts index f5b1322124..596a2983e8 100644 --- a/packages/slice-machine/test/lib/utils/shared/customTypes.test.ts +++ b/packages/slice-machine/test/lib/utils/shared/customTypes.test.ts @@ -83,7 +83,7 @@ describe("Slice IO", () => { const sliceIdToDelete = "slice_1"; const result = filterSliceFromCustomType( baseCustomTypeModel, - sliceIdToDelete + sliceIdToDelete, ); expect(result).toStrictEqual(customTypeModel); }); diff --git a/packages/slice-machine/test/pages/custom-types.test.tsx b/packages/slice-machine/test/pages/custom-types.test.tsx index 3736966961..93e9a12f4b 100644 --- a/packages/slice-machine/test/pages/custom-types.test.tsx +++ b/packages/slice-machine/test/pages/custom-types.test.tsx @@ -221,7 +221,7 @@ describe("Custom Type Builder", () => { nodeVersion: process.versions.node, }, }), - expect.any(Function) + expect.any(Function), ); }); @@ -326,7 +326,7 @@ describe("Custom Type Builder", () => { event: "SliceMachine Slicezone Updated", properties: { customTypeId, nodeVersion: process.versions.node }, }), - expect.any(Function) + expect.any(Function), ); }); @@ -353,7 +353,7 @@ describe("Custom Type Builder", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const customTypeId = "a-page"; @@ -448,7 +448,7 @@ describe("Custom Type Builder", () => { nodeVersion: process.versions.node, }, }), - expect.any(Function) + expect.any(Function), ); const saveCustomType = screen.getByTestId("builder-save-button"); @@ -471,7 +471,7 @@ describe("Custom Type Builder", () => { nodeVersion: process.versions.node, }, }), - expect.any(Function) + expect.any(Function), ); }); }); @@ -500,7 +500,7 @@ describe("Custom Type Builder", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const customTypeId = "a-page"; @@ -608,7 +608,7 @@ describe("Custom Type Builder", () => { nodeVersion: process.versions.node, }, }), - expect.any(Function) + expect.any(Function), ); const saveCustomType = screen.getByTestId("builder-save-button"); diff --git a/packages/slice-machine/test/pages/simulator.test.tsx b/packages/slice-machine/test/pages/simulator.test.tsx index e88583ee78..9ac2375b69 100644 --- a/packages/slice-machine/test/pages/simulator.test.tsx +++ b/packages/slice-machine/test/pages/simulator.test.tsx @@ -18,7 +18,7 @@ import { createSliceMachineManagerMSWHandler } from "@slicemachine/manager/test" vi.mock("next/router", () => require("next-router-mock")); vi.mock("next/dist/client/router", () => require("next-router-mock")); mockRouter.useParser( - createDynamicRouteParser(["/slices/[lib]/[sliceName]/[variation]/simulator"]) + createDynamicRouteParser(["/slices/[lib]/[sliceName]/[variation]/simulator"]), ); // mock simulator client, it would be nice not to have to do this :/ vi.mock("@prismicio/simulator", () => { @@ -98,7 +98,7 @@ describe.skip("simulator", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); vi.useFakeTimers(); @@ -282,7 +282,7 @@ describe.skip("simulator", () => { }); await waitFor(() => - expect(SegmentClient.prototype.track).toHaveBeenCalled() + expect(SegmentClient.prototype.track).toHaveBeenCalled(), ); expect(SegmentClient.prototype.track).toHaveBeenCalledOnce(); @@ -293,7 +293,7 @@ describe.skip("simulator", () => { version: state.environment.changelog.sliceMachine.currentVersion, }, }), - expect.any(Function) + expect.any(Function), ); const button = App.container.querySelector('[data-cy="save-mock"]'); @@ -328,7 +328,7 @@ describe.skip("simulator", () => { libraryName: "slices", mocks: expectedMock, }), - expect.any(Function) + expect.any(Function), ); }); }); diff --git a/packages/slice-machine/test/pages/slices.test.tsx b/packages/slice-machine/test/pages/slices.test.tsx index 4be4f0ad2a..5f63e2b64e 100644 --- a/packages/slice-machine/test/pages/slices.test.tsx +++ b/packages/slice-machine/test/pages/slices.test.tsx @@ -57,7 +57,7 @@ describe("slices", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const environment = { @@ -188,7 +188,7 @@ describe("slices", () => { }); await waitFor(() => - expect(SegmentClient.prototype.track).toHaveBeenCalled() + expect(SegmentClient.prototype.track).toHaveBeenCalled(), ); expect(SegmentClient.prototype.track).toHaveBeenCalledOnce(); @@ -202,7 +202,7 @@ describe("slices", () => { nodeVersion: process.versions.node, }, }), - expect.any(Function) + expect.any(Function), ); }); @@ -233,7 +233,7 @@ describe("slices", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const environment = { diff --git a/packages/slice-machine/test/src/modules/__fixtures__/sliceUtilsFactory.ts b/packages/slice-machine/test/src/modules/__fixtures__/sliceUtilsFactory.ts index 0ab952debf..cb1c7f1c0f 100644 --- a/packages/slice-machine/test/src/modules/__fixtures__/sliceUtilsFactory.ts +++ b/packages/slice-machine/test/src/modules/__fixtures__/sliceUtilsFactory.ts @@ -41,7 +41,7 @@ export const generateSliceSM = (overrides: Partial): SliceSM => { }; export const generateComponentUI = ( - overrides?: Partial + overrides?: Partial, ): ComponentUI => { return { ...DEFAULT_COMPONENT_UI, @@ -50,7 +50,7 @@ export const generateComponentUI = ( }; export const generateLibraryUI = ( - overrides?: Partial + overrides?: Partial, ): LibraryUI => { return { ...DEFAULT_LIBRARY_UI, diff --git a/packages/slice-machine/test/src/modules/availableCustomTypes/index.test.ts b/packages/slice-machine/test/src/modules/availableCustomTypes/index.test.ts index c69a490fb5..4ee73d839d 100644 --- a/packages/slice-machine/test/src/modules/availableCustomTypes/index.test.ts +++ b/packages/slice-machine/test/src/modules/availableCustomTypes/index.test.ts @@ -25,7 +25,7 @@ describe("[Available Custom types module]", () => { it("should return the initial state if no action", () => { // @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message expect(availableCustomTypesReducer(dummyCustomTypesState, {})).toEqual( - dummyCustomTypesState + dummyCustomTypesState, ); }); @@ -34,7 +34,7 @@ describe("[Available Custom types module]", () => { availableCustomTypesReducer(dummyCustomTypesState, { // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"CUST... Remove this comment to see the full error message type: "NO.MATCH", - }) + }), ).toEqual(dummyCustomTypesState); }); @@ -49,7 +49,7 @@ describe("[Available Custom types module]", () => { }); expect( - availableCustomTypesReducer(dummyCustomTypesState, action) + availableCustomTypesReducer(dummyCustomTypesState, action), ).toEqual({ ...dummyCustomTypesState, about: { @@ -77,7 +77,7 @@ describe("[Available Custom types module]", () => { }); expect( - availableCustomTypesReducer(dummyCustomTypesState, action) + availableCustomTypesReducer(dummyCustomTypesState, action), ).toEqual({ ...dummyCustomTypesState, [createdCustomType.id]: { @@ -169,13 +169,13 @@ describe("[Available Custom types module]", () => { const result = availableCustomTypesReducer( originalState, - action + action, ) as AvailableCustomTypesStoreType; expect( Object.values(result).flatMap((localAndRemote) => { return Object.values(localAndRemote); - }) + }), ).not.toContain(undefined); expect(result).toEqual({ @@ -223,26 +223,26 @@ describe("[Available Custom types module]", () => { actionPayload.id, actionPayload.label, actionPayload.repeatable, - actionPayload.format - ) + actionPayload.format, + ), ); const saga = testSaga( createCustomTypeSaga, - createCustomTypeCreator.request(actionPayload) + createCustomTypeCreator.request(actionPayload), ); saga.next().call(saveCustomType, customTypeCreated); saga .next() .put( - createCustomTypeCreator.success({ newCustomType: customTypeCreated }) + createCustomTypeCreator.success({ newCustomType: customTypeCreated }), ); saga.next().put(modalCloseCreator()); saga.next().put( push({ pathname: "/custom-types/id", query: undefined, - }) + }), ); saga .next() @@ -252,9 +252,9 @@ describe("[Available Custom types module]", () => { }) => { expect(action.payload.action.type).toBe("TOASTER/OPEN"); expect(action.payload.action.payload.type).toBe( - ToasterType.SUCCESS + ToasterType.SUCCESS, ); - } + }, ); saga.next().isDone(); }); @@ -271,12 +271,12 @@ describe("[Available Custom types module]", () => { actionPayload.id, actionPayload.label, actionPayload.repeatable, - actionPayload.format - ) + actionPayload.format, + ), ); const saga = testSaga( createCustomTypeSaga, - createCustomTypeCreator.request(actionPayload) + createCustomTypeCreator.request(actionPayload), ); saga.next().call(saveCustomType, customTypeCreated); @@ -284,7 +284,7 @@ describe("[Available Custom types module]", () => { openToasterCreator({ content: "Internal Error: Custom type not saved", type: ToasterType.ERROR, - }) + }), ); saga.next().isDone(); }); diff --git a/packages/slice-machine/test/src/modules/environment.test.ts b/packages/slice-machine/test/src/modules/environment.test.ts index da5bef1831..c3302f5fda 100644 --- a/packages/slice-machine/test/src/modules/environment.test.ts +++ b/packages/slice-machine/test/src/modules/environment.test.ts @@ -17,14 +17,14 @@ describe("[Environment module]", () => { it("should return the initial state if no action", () => { // @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message expect(environmentReducer(dummyEnvironmentState, {})).toEqual( - dummyEnvironmentState + dummyEnvironmentState, ); }); it("should return the initial state if no matching action", () => { expect( // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"STAT... Remove this comment to see the full error message - environmentReducer(dummyEnvironmentState, { type: "NO.MATCH" }) + environmentReducer(dummyEnvironmentState, { type: "NO.MATCH" }), ).toEqual(dummyEnvironmentState); }); diff --git a/packages/slice-machine/test/src/modules/loading.test.ts b/packages/slice-machine/test/src/modules/loading.test.ts index a217058701..83b799a26d 100644 --- a/packages/slice-machine/test/src/modules/loading.test.ts +++ b/packages/slice-machine/test/src/modules/loading.test.ts @@ -20,7 +20,7 @@ describe("[Loading module]", () => { it("should return the initial state if no matching action", () => { // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"LOAD... Remove this comment to see the full error message expect(loadingReducer(dummyLoadingState, { type: "NO.MATCH" })).toEqual( - dummyLoadingState + dummyLoadingState, ); }); diff --git a/packages/slice-machine/test/src/modules/modal.test.ts b/packages/slice-machine/test/src/modules/modal.test.ts index 784935cf79..3ee080536e 100644 --- a/packages/slice-machine/test/src/modules/modal.test.ts +++ b/packages/slice-machine/test/src/modules/modal.test.ts @@ -18,7 +18,7 @@ describe("[Modal module]", () => { it("should return the initial state if no matching action", () => { // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"MODA... Remove this comment to see the full error message expect(modalReducer(undefined, { type: "NO.MATCH" })).toEqual( - modalInitialState + modalInitialState, ); }); diff --git a/packages/slice-machine/test/src/modules/pushChangesSaga.test.ts b/packages/slice-machine/test/src/modules/pushChangesSaga.test.ts index 671abb38f4..8c965a852b 100644 --- a/packages/slice-machine/test/src/modules/pushChangesSaga.test.ts +++ b/packages/slice-machine/test/src/modules/pushChangesSaga.test.ts @@ -90,7 +90,7 @@ describe("[pushChanges module]", () => { beforeEach(() => { saga = testSaga( changesPushSaga, - changesPushCreator.request(changesPayload) + changesPushCreator.request(changesPayload), ); }); test("Pushes changes when API response is OK display success toaster", async () => { @@ -106,7 +106,7 @@ describe("[pushChanges module]", () => { libraries: dummyServerState.libraries, remoteSlices: [], clientError: undefined, - }) + }), ); saga.next().put(changesPushCreator.success()); @@ -115,7 +115,7 @@ describe("[pushChanges module]", () => { openToasterCreator({ content: "All slices and types have been pushed", type: ToasterType.SUCCESS, - }) + }), ); saga.next().isDone(); @@ -169,13 +169,13 @@ describe("[pushChanges module]", () => { }, ], }, - }) + }), ); saga.next().put( modalOpenCreator({ modalKey: expectedModalKey, - }) + }), ); saga.next().isDone(); @@ -183,7 +183,7 @@ describe("[pushChanges module]", () => { // Wait for network request to be performed await new Promise((resolve) => setTimeout(resolve, 100)); expect(SegmentClient.prototype.track).toHaveBeenCalledOnce(); - } + }, ); test("Displays an error toaster when there is an API error on push", () => { @@ -194,7 +194,7 @@ describe("[pushChanges module]", () => { content: "Something went wrong when pushing your changes. Check your terminal logs.", type: ToasterType.ERROR, - }) + }), ); saga.next().isDone(); @@ -213,7 +213,7 @@ describe("[pushChanges module]", () => { .put(modalOpenCreator({ modalKey: ModalKeysEnum.LOGIN })); saga.next().isDone(); - } + }, ); // TODO: unskip when invalid references are handled @@ -246,13 +246,13 @@ describe("[pushChanges module]", () => { details: { customTypes: [{ id: "CT1" }, { id: "CT2" }], }, - }) + }), ); saga.next().put( modalOpenCreator({ modalKey: ModalKeysEnum.REFERENCES_MISSING_DRAWER, - }) + }), ); saga.next().isDone(); diff --git a/packages/slice-machine/test/src/modules/screenshots/sagas.test.ts b/packages/slice-machine/test/src/modules/screenshots/sagas.test.ts index 79f091d0a9..59892d04e7 100644 --- a/packages/slice-machine/test/src/modules/screenshots/sagas.test.ts +++ b/packages/slice-machine/test/src/modules/screenshots/sagas.test.ts @@ -21,7 +21,7 @@ describe("[Selected Slice sagas]", () => { component: dummySliceState, screenDimensions, method: "fromSimulator", - }) + }), ); saga.next().call(generateSliceScreenshotApiClient, { @@ -39,7 +39,7 @@ describe("[Selected Slice sagas]", () => { openToasterCreator({ url: "testScreenshotUrl", type: ToasterType.SCREENSHOT_CAPTURED, - }) + }), ); saga.next().put( @@ -49,7 +49,7 @@ describe("[Selected Slice sagas]", () => { }, component: dummySliceState, variationId: dummyModelVariationID, - }) + }), ); saga.next().isDone(); @@ -67,14 +67,14 @@ describe("[Selected Slice sagas]", () => { component: dummySliceState, screenDimensions, method: "fromSimulator", - }) + }), ).next(); saga.throw(new Error()).put( openToasterCreator({ content: "Internal Error: Screenshot not saved", type: ToasterType.ERROR, - }) + }), ); saga.next().isDone(); }); diff --git a/packages/slice-machine/test/src/modules/selectedCustomType/reducer.test.ts b/packages/slice-machine/test/src/modules/selectedCustomType/reducer.test.ts index 926480002b..ffde5a51f1 100644 --- a/packages/slice-machine/test/src/modules/selectedCustomType/reducer.test.ts +++ b/packages/slice-machine/test/src/modules/selectedCustomType/reducer.test.ts @@ -32,14 +32,14 @@ describe("[Selected Custom type module]", () => { it("should return the initial state if no action", () => { // @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message expect(selectedCustomTypeReducer(dummyCustomTypesState, {})).toEqual( - dummyCustomTypesState + dummyCustomTypesState, ); }); it("should return the initial state if no matching action", () => { expect( // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"CUST... Remove this comment to see the full error message - selectedCustomTypeReducer(dummyCustomTypesState, { type: "NO.MATCH" }) + selectedCustomTypeReducer(dummyCustomTypesState, { type: "NO.MATCH" }), ).toEqual(dummyCustomTypesState); }); @@ -47,8 +47,8 @@ describe("[Selected Custom type module]", () => { expect( selectedCustomTypeReducer( dummyCustomTypesState, - cleanupCustomTypeStoreCreator() - ) + cleanupCustomTypeStoreCreator(), + ), ).toEqual(null); }); @@ -59,8 +59,8 @@ describe("[Selected Custom type module]", () => { initCustomTypeStoreCreator({ model: customTypeAsArray, remoteModel: undefined, - }) - ) + }), + ), ).toEqual({ model: customTypeAsArray, initialModel: customTypeAsArray, @@ -74,7 +74,7 @@ describe("[Selected Custom type module]", () => { dummyCustomTypesState, createTabCreator({ tabId: newTabId, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. const tabs = newState.model.tabs; @@ -86,7 +86,7 @@ describe("[Selected Custom type module]", () => { dummyCustomTypesState, createTabCreator({ tabId: newTabId, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. const tabs2 = newState2.model.tabs; @@ -101,7 +101,7 @@ describe("[Selected Custom type module]", () => { updateTabCreator({ newTabId, tabId: initialTab.key, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. const tabs = newState.model.tabs[0]; @@ -117,7 +117,7 @@ describe("[Selected Custom type module]", () => { updateTabCreator({ newTabId, tabId: unknownTabId, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -126,7 +126,7 @@ describe("[Selected Custom type module]", () => { // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. expect(!!newState.model.tabs.find((e) => e.key === unknownTabId)).toBe( - false + false, ); }); it("should add a field into a custom type given CUSTOM_TYPE/ADD_FIELD action", () => { @@ -139,7 +139,7 @@ describe("[Selected Custom type module]", () => { tabId: initialTab.key, fieldId, field: widgets.Boolean.create(fieldId), - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -155,12 +155,12 @@ describe("[Selected Custom type module]", () => { deleteFieldCreator({ tabId: initialTab.key, fieldId: initialTab.value[0].key, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. expect(newState.model.tabs[0].value.length).toEqual( - initialTab.value.length - 1 + initialTab.value.length - 1, ); }); it("should reorder fields into a custom type given CUSTOM_TYPE/REORDER_FIELD action", () => { @@ -175,7 +175,7 @@ describe("[Selected Custom type module]", () => { tabId: initialTab.key, start: 0, end: 1, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -189,7 +189,7 @@ describe("[Selected Custom type module]", () => { tabId: initialTab.key, start: 0, end: 1, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -203,7 +203,7 @@ describe("[Selected Custom type module]", () => { tabId: initialTab.key, start: 0, end: 2, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -219,7 +219,7 @@ describe("[Selected Custom type module]", () => { tabId: initialTab.key, start: 2, end: 0, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -237,7 +237,7 @@ describe("[Selected Custom type module]", () => { dummyCustomTypesState, createSliceZoneCreator({ tabId: initialTab.key, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -260,16 +260,16 @@ describe("[Selected Custom type module]", () => { previousFieldId: field.key, newFieldId: "newKey", value: field.value, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. expect(equal(newState.model.tabs[0].value, initialTab.value)).toEqual( - false + false, ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. expect(equal(newState.model.tabs[0].value[0].value, field.value)).toEqual( - true + true, ); }); it("should not update the field into a custom type given CUSTOM_TYPE/REPLACE_FIELD action if the field is the same", () => { @@ -284,7 +284,7 @@ describe("[Selected Custom type module]", () => { previousFieldId: field.key, newFieldId: field.key, value: field.value, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. @@ -311,12 +311,12 @@ describe("[Selected Custom type module]", () => { placeholder: newPlaceholder, }, }, - }) + }), ); // @ts-expect-error TS(2531) FIXME: Object is possibly 'null'. expect(newState.model.tabs[0].value[0].value.config.placeholder).toEqual( - newPlaceholder + newPlaceholder, ); }); }); diff --git a/packages/slice-machine/test/src/modules/selectedCustomType/sagas.test.ts b/packages/slice-machine/test/src/modules/selectedCustomType/sagas.test.ts index 561de5f1d1..afd4422bf0 100644 --- a/packages/slice-machine/test/src/modules/selectedCustomType/sagas.test.ts +++ b/packages/slice-machine/test/src/modules/selectedCustomType/sagas.test.ts @@ -63,9 +63,9 @@ describe("[Selected Custom type sagas]", () => { }) => { expect(action.payload.action.type).toBe("TOASTER/OPEN"); expect(action.payload.action.payload.type).toBe( - ToasterType.SUCCESS + ToasterType.SUCCESS, ); - } + }, ); saga.next().isDone(); @@ -81,7 +81,7 @@ describe("[Selected Custom type sagas]", () => { openToasterCreator({ content: "Internal Error: Custom type not saved", type: ToasterType.ERROR, - }) + }), ); saga.next().isDone(); }); diff --git a/packages/slice-machine/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts b/packages/slice-machine/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts index 61dd74455e..db3e3e7759 100644 --- a/packages/slice-machine/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +++ b/packages/slice-machine/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts @@ -3,7 +3,7 @@ import { LibraryUI } from "@lib/models/common/LibraryUI"; export const getRefreshStateCreatorPayloadData = ( libraryName: string, - modelId: string + modelId: string, ) => { const MOCK_UPDATED_LIBRARY: LibraryUI[] = [ { diff --git a/packages/slice-machine/test/src/modules/selectedSlice/reducer.test.ts b/packages/slice-machine/test/src/modules/selectedSlice/reducer.test.ts index 49f0a6b636..754294f63e 100644 --- a/packages/slice-machine/test/src/modules/selectedSlice/reducer.test.ts +++ b/packages/slice-machine/test/src/modules/selectedSlice/reducer.test.ts @@ -20,17 +20,17 @@ describe("[Selected Slice module]", () => { it("should return the initial state if no matching action", () => { expect( // @ts-expect-error the NO.MATCH is not a valid action type - selectedSliceReducer(dummySliceState, { type: "NO.MATCH" }) + selectedSliceReducer(dummySliceState, { type: "NO.MATCH" }), ).toEqual(dummySliceState); expect( // @ts-expect-error the NO.MATCH is not a valid action type - selectedSliceReducer(null, { type: "NO.MATCH" }) + selectedSliceReducer(null, { type: "NO.MATCH" }), ).toEqual(null); }); it("should update the selected slice state given SELECTED_SLICE/INIT action", () => { expect( - selectedSliceReducer(null, initSliceStoreCreator(dummySliceState)) + selectedSliceReducer(null, initSliceStoreCreator(dummySliceState)), ).toEqual(dummySliceState); }); it("should update the selected slice state given SLICE/ADD_WIDGET action", () => { @@ -55,7 +55,7 @@ describe("[Selected Slice module]", () => { widgetsArea: WidgetsArea.Primary, key: newWidget.key, value: newWidget.value, - }) + }), ); const primaryWidgets = newState?.model.variations[0].primary; expect(primaryWidgets?.length).toEqual(primaryWidgetsInit.length + 1); @@ -87,13 +87,13 @@ describe("[Selected Slice module]", () => { previousKey: widgetToReplace.key, newKey: updatedWidget.key, value: updatedWidget.value, - }) + }), ); const primaryWidgets = newState?.model.variations[0].primary; expect(primaryWidgets?.length).toEqual(primaryWidgetsInit.length); const replacedWidget = primaryWidgets?.find( - (w) => w.key === updatedWidget.key + (w) => w.key === updatedWidget.key, ); expect(replacedWidget).toBeTruthy(); expect(replacedWidget?.value).toBe(updatedWidget.value); @@ -110,7 +110,7 @@ describe("[Selected Slice module]", () => { variationId: dummyModelVariationID, widgetsArea: WidgetsArea.Primary, key: widgetToDelete.key, - }) + }), ); const primaryWidgets = newState?.model.variations[0].primary; @@ -125,7 +125,7 @@ describe("[Selected Slice module]", () => { key: "new-variation", name: "New Variation", copied: dummySliceState.model.variations[0], - }) + }), ); const variations = newState?.model.variations; @@ -139,8 +139,8 @@ describe("[Selected Slice module]", () => { const action = refreshStateCreator( getRefreshStateCreatorPayloadData( dummySliceState.from, - dummySliceState.model.id - ) + dummySliceState.model.id, + ), ); const newState = selectedSliceReducer(dummySliceState, action); @@ -157,8 +157,8 @@ describe("[Selected Slice module]", () => { const action = refreshStateCreator( getRefreshStateCreatorPayloadData( "unknown-livrary", - dummySliceState.model.id - ) + dummySliceState.model.id, + ), ); const newState = selectedSliceReducer(dummySliceState, action); diff --git a/packages/slice-machine/test/src/modules/selectedSlice/sagas.test.ts b/packages/slice-machine/test/src/modules/selectedSlice/sagas.test.ts index 8e1b7fa936..2c440d6e06 100644 --- a/packages/slice-machine/test/src/modules/selectedSlice/sagas.test.ts +++ b/packages/slice-machine/test/src/modules/selectedSlice/sagas.test.ts @@ -29,7 +29,7 @@ describe("[Selected Slice sagas]", () => { updateSliceCreator.request({ component: dummySliceState, setData: mockSetData, - }) + }), ); saga.next().call(updateSliceApiClient, dummySliceState); @@ -42,7 +42,7 @@ describe("[Selected Slice sagas]", () => { saga.next({ errors: [], mocks: [] }).put( updateSliceCreator.success({ component: { ...dummySliceState, mocks: [] }, - }) + }), ); saga.next().isDone(); @@ -52,10 +52,10 @@ describe("[Selected Slice sagas]", () => { expect(mockSetDataCalls?.done).toBe(true); expect(mockSetDataCalls?.loading).toBe(false); expect(mockSetDataCalls?.message.props.message).toBe( - "Slice saved successfully at " + "Slice saved successfully at ", ); expect(mockSetDataCalls?.message.props.path).toBe( - "slices/libName/DummySlice/model.json" + "slices/libName/DummySlice/model.json", ); }); it("should open a error toaster on internal error", () => { @@ -65,14 +65,14 @@ describe("[Selected Slice sagas]", () => { updateSliceCreator.request({ component: dummySliceState, setData: mockSetData, - }) + }), ).next(); saga.throw(new Error()).put( openToasterCreator({ content: "Internal Error: Models & mocks not generated", type: ToasterType.ERROR, - }) + }), ); saga.next().isDone(); }); diff --git a/packages/slice-machine/test/src/modules/simulator.test.ts b/packages/slice-machine/test/src/modules/simulator.test.ts index dcfa66fe27..b3b03c6e9b 100644 --- a/packages/slice-machine/test/src/modules/simulator.test.ts +++ b/packages/slice-machine/test/src/modules/simulator.test.ts @@ -39,14 +39,14 @@ describe("[Simulator module]", () => { it("should return the initial state if no action", () => { // @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message expect(simulatorReducer(dummySimulatorState, {})).toEqual( - dummySimulatorState + dummySimulatorState, ); }); it("should return the initial state if no matching action", () => { expect( // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"SIMU... Remove this comment to see the full error message - simulatorReducer(dummySimulatorState, { type: "NO.MATCH" }) + simulatorReducer(dummySimulatorState, { type: "NO.MATCH" }), ).toEqual(dummySimulatorState); }); @@ -136,7 +136,7 @@ describe("[Simulator module]", () => { checkSimulatorSetupCreator.success({ setupStatus: response, setupSteps: response2.steps, - }) + }), ); saga.next().put(updateManifestCreator({ value: undefined })); saga.next().isDone(); @@ -189,7 +189,7 @@ describe("[Simulator module]", () => { checkSimulatorSetupCreator.failure({ setupSteps: payload.setupSteps, error: new Error(), - }) + }), ); saga .next() @@ -217,12 +217,12 @@ describe("[Simulator module]", () => { checkSimulatorSetupCreator.failure({ setupSteps: payload.setupSteps, error: new Error(), - }) + }), ) .put( modalOpenCreator({ modalKey: ModalKeysEnum.SIMULATOR_SETUP, - }) + }), ) .run(); }); @@ -265,7 +265,7 @@ describe("[Simulator module]", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const updateSliceMocksSpy = vi.spyOn(manager.slices, "updateSliceMocks"); @@ -281,7 +281,7 @@ describe("[Simulator module]", () => { openToasterCreator({ type: ToasterType.SUCCESS, content: "Saved", - }) + }), ) .put(updateSliceMock(payload.payload)) .put(updateSelectedSliceMocks({ mocks: payload.payload.mocks })) @@ -317,7 +317,7 @@ describe("[Simulator module]", () => { createSliceMachineManagerMSWHandler({ url: "http://localhost:3000/_manager", sliceMachineManager: manager, - }) + }), ); const updateSliceMocksSpy = vi.spyOn(manager.slices, "updateSliceMocks"); @@ -335,7 +335,7 @@ describe("[Simulator module]", () => { openToasterCreator({ type: ToasterType.ERROR, content: errorMessage, - }) + }), ) .put(saveSliceMockCreator.failure()) .run(); diff --git a/packages/slice-machine/test/src/modules/slices.test.ts b/packages/slice-machine/test/src/modules/slices.test.ts index 61ffcadef5..eddef3626e 100644 --- a/packages/slice-machine/test/src/modules/slices.test.ts +++ b/packages/slice-machine/test/src/modules/slices.test.ts @@ -32,7 +32,7 @@ describe("[Slices module]", () => { it("should return the initial state if no matching action", () => { // @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"STAT... Remove this comment to see the full error message expect(slicesReducer(dummySlicesState, { type: "NO.MATCH" })).toEqual( - dummySlicesState + dummySlicesState, ); }); @@ -122,7 +122,7 @@ describe("[Slices module]", () => { }; const saga = testSaga( deleteSliceSaga, - deleteSliceCreator.request(actionPayload) + deleteSliceCreator.request(actionPayload), ); saga @@ -133,7 +133,7 @@ describe("[Slices module]", () => { openToasterCreator({ content: `Successfully deleted Slice “${actionPayload.sliceName}”`, type: ToasterType.SUCCESS, - }) + }), ); saga.next().put(modalCloseCreator()); @@ -147,7 +147,7 @@ describe("[Slices module]", () => { }; const saga = testSaga( deleteSliceSaga, - deleteSliceCreator.request(actionPayload) + deleteSliceCreator.request(actionPayload), ); saga @@ -157,7 +157,7 @@ describe("[Slices module]", () => { openToasterCreator({ content: "An unexpected error happened while deleting your slice.", type: ToasterType.ERROR, - }) + }), ); saga.next().put(modalCloseCreator()); diff --git a/packages/slice-machine/test/src/modules/toaster/utils.test.ts b/packages/slice-machine/test/src/modules/toaster/utils.test.ts index 54668e21df..d3e4a7fbef 100644 --- a/packages/slice-machine/test/src/modules/toaster/utils.test.ts +++ b/packages/slice-machine/test/src/modules/toaster/utils.test.ts @@ -23,7 +23,7 @@ describe("[Toaster utils]", () => { expect(addToastFakeFunction).toHaveBeenCalledWith( "message", - ToasterType.SUCCESS + ToasterType.SUCCESS, ); }); @@ -56,7 +56,7 @@ describe("[Toaster utils]", () => { expect(addToastFakeFunction).toHaveBeenCalledWith( "message", - ToasterType.WARNING + ToasterType.WARNING, ); }); @@ -74,7 +74,7 @@ describe("[Toaster utils]", () => { expect(addToastFakeFunction).toHaveBeenCalledWith( "message", - ToasterType.ERROR + ToasterType.ERROR, ); }); }); diff --git a/packages/slice-machine/test/src/normalizers/customType.test.ts b/packages/slice-machine/test/src/normalizers/customType.test.ts index 68aa8e97cb..311d36b9cb 100644 --- a/packages/slice-machine/test/src/normalizers/customType.test.ts +++ b/packages/slice-machine/test/src/normalizers/customType.test.ts @@ -62,7 +62,7 @@ describe("Normalizer - CustomType", () => { ]; expect( - normalizeFrontendCustomTypes(localCustomTypes, remoteCustomTypes) + normalizeFrontendCustomTypes(localCustomTypes, remoteCustomTypes), ).toEqual({ id1: { local: { @@ -137,12 +137,12 @@ describe("Normalizer - CustomType", () => { const normalizedCustomTypes = normalizeFrontendCustomTypes( localCustomTypes, - [] + [], ); expect(Object.values(normalizedCustomTypes["id1"]).length).toEqual(1); expect(Object.values(normalizedCustomTypes["id1"])).not.toEqual( - expect.arrayContaining([undefined]) + expect.arrayContaining([undefined]), ); }); }); @@ -176,7 +176,7 @@ describe("Normalizer - CustomType", () => { }; expect( - normalizeFrontendCustomType(localCustomType, remoteCustomType) + normalizeFrontendCustomType(localCustomType, remoteCustomType), ).toEqual({ id1: { local: { @@ -225,7 +225,7 @@ describe("Normalizer - CustomType", () => { expect(Object.values(normalizedCustomType["id1"]).length).toEqual(1); expect(Object.values(normalizedCustomType["id1"])).not.toEqual( - expect.arrayContaining([undefined]) + expect.arrayContaining([undefined]), ); }); }); diff --git a/packages/slice-machine/test/src/utils/fieldNameCreator.test.ts b/packages/slice-machine/test/src/utils/fieldNameCreator.test.ts index cf13b449cf..afcffa98ac 100644 --- a/packages/slice-machine/test/src/utils/fieldNameCreator.test.ts +++ b/packages/slice-machine/test/src/utils/fieldNameCreator.test.ts @@ -49,5 +49,5 @@ describe.each(dataProvider)( expect(fieldName).toBe(expectedResult); expect(createFriendlyFieldNameWithId(fieldName)).toBe(fieldName); }); - } + }, );