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/e2e-projects/sveltekit/package.json b/e2e-projects/sveltekit/package.json index c119b0e7b7..bc217f3ee4 100644 --- a/e2e-projects/sveltekit/package.json +++ b/e2e-projects/sveltekit/package.json @@ -20,10 +20,10 @@ "@typescript-eslint/eslint-plugin": "^5.45.0", "@typescript-eslint/parser": "^5.45.0", "eslint": "^8.28.0", - "eslint-config-prettier": "8.7.0", + "eslint-config-prettier": "^9.0.0", "eslint-plugin-svelte": "^2.30.0", - "prettier": "2.8.4", - "prettier-plugin-svelte": "^2.10.1", + "prettier": "^3.0.3", + "prettier-plugin-svelte": "^3.0.3", "slice-machine-ui": "workspace:*", "svelte": "^4.0.5", "svelte-check": "^3.4.3", diff --git a/package.json b/package.json index 0f62b82f38..77eb72601e 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "husky": "8.0.3", "lerna": "7.0.2", "lint-staged": "13.2.0", - "prettier": "2.8.4", + "prettier": "3.0.3", "start-server-and-test": "1.15.5" }, "lint-staged": { diff --git a/packages/adapter-next/.prettierrc b/packages/adapter-next/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/adapter-next/.prettierrc +++ b/packages/adapter-next/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/adapter-next/package.json b/packages/adapter-next/package.json index f164809440..6c3f875e46 100644 --- a/packages/adapter-next/package.json +++ b/packages/adapter-next/package.json @@ -76,7 +76,6 @@ "@prismicio/mock": "0.2.0", "@size-limit/preset-small-lib": "8.2.4", "@types/common-tags": "1.8.1", - "@types/prettier": "2.7.2", "@types/react": "18.0.28", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", @@ -84,11 +83,11 @@ "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", - "prettier": "2.8.4", - "prettier-plugin-jsdoc": "0.4.2", + "prettier": "3.0.3", + "prettier-plugin-jsdoc": "1.1.1", "react": "18.2.0", "rollup-plugin-preserve-directives": "0.1.1", "size-limit": "8.2.4", diff --git a/packages/adapter-next/test/__testutils__/testGlobalContentTypes.ts b/packages/adapter-next/test/__testutils__/testGlobalContentTypes.ts index 022c513352..8258d8f3dc 100644 --- a/packages/adapter-next/test/__testutils__/testGlobalContentTypes.ts +++ b/packages/adapter-next/test/__testutils__/testGlobalContentTypes.ts @@ -61,7 +61,7 @@ export const expectGlobalContentTypes = async ( if (args.format ?? true) { expect(contents).toBe( - prettier.format(generatedTypes, { parser: "typescript" }), + await prettier.format(generatedTypes, { parser: "typescript" }), ); } else { expect(contents).toBe(generatedTypes); diff --git a/packages/adapter-next/test/plugin-customType-create.test.ts b/packages/adapter-next/test/plugin-customType-create.test.ts index 98d4537194..67c367743c 100644 --- a/packages/adapter-next/test/plugin-customType-create.test.ts +++ b/packages/adapter-next/test/plugin-customType-create.test.ts @@ -50,7 +50,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -78,7 +78,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), diff --git a/packages/adapter-next/test/plugin-project-init.test.ts b/packages/adapter-next/test/plugin-project-init.test.ts index 8bad159657..6e8d332ac5 100644 --- a/packages/adapter-next/test/plugin-project-init.test.ts +++ b/packages/adapter-next/test/plugin-project-init.test.ts @@ -190,7 +190,9 @@ describe("prismicio.js file", () => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "typescript" })); + expect(contents).toBe( + await prettier.format(contents, { parser: "typescript" }), + ); }); test("prismicio file is not formatted if formatting is disabled", async (ctx) => { @@ -221,7 +223,7 @@ describe("prismicio.js file", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "typescript", }), @@ -252,12 +254,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"./slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} * @@ -280,8 +283,7 @@ describe("prismicio.js file", () => { * Creates a Prismic client for the project's repository. The client is used to * query content from the Prismic API. * - * @param {prismicNext.CreateClientConfig} config - Configuration for the - * Prismic client. + * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client. */ export const createClient = (config = {}) => { const client = prismic.createClient(repositoryName, { @@ -326,12 +328,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"../slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} * @@ -354,8 +357,7 @@ describe("prismicio.js file", () => { * Creates a Prismic client for the project's repository. The client is used to * query content from the Prismic API. * - * @param {prismicNext.CreateClientConfig} config - Configuration for the - * Prismic client. + * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client. */ export const createClient = (config = {}) => { const client = prismic.createClient(repositoryName, { @@ -400,12 +402,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"./slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} */ @@ -474,12 +477,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"./slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} */ @@ -545,12 +549,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"./slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} * @@ -573,8 +578,7 @@ describe("prismicio.js file", () => { * Creates a Prismic client for the project's repository. The client is used to * query content from the Prismic API. * - * @param {prismicNext.CreateClientConfig} config - Configuration for the - * Prismic client. + * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client. */ export const createClient = (config = {}) => { const client = prismic.createClient(repositoryName, { @@ -615,12 +619,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"../slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} * @@ -643,8 +648,7 @@ describe("prismicio.js file", () => { * Creates a Prismic client for the project's repository. The client is used to * query content from the Prismic API. * - * @param {prismicNext.CreateClientConfig} config - Configuration for the - * Prismic client. + * @param {prismicNext.CreateClientConfig} config - Configuration for the Prismic client. */ export const createClient = (config = {}) => { const client = prismic.createClient(repositoryName, { @@ -689,12 +693,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"./slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} */ @@ -759,12 +764,13 @@ describe("prismicio.js file", () => { import * as prismicNext from \\"@prismicio/next\\"; import config from \\"./slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} */ @@ -923,7 +929,7 @@ describe("Slice Simulator route", () => { ); expect(contents).toBe( - prettier.format(contents, { parser: "typescript" }), + await prettier.format(contents, { parser: "typescript" }), ); }); @@ -955,7 +961,7 @@ describe("Slice Simulator route", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "typescript", }), @@ -1110,7 +1116,7 @@ describe("Slice Simulator route", () => { ); expect(contents).toBe( - prettier.format(contents, { parser: "typescript" }), + await prettier.format(contents, { parser: "typescript" }), ); }); @@ -1142,7 +1148,7 @@ describe("Slice Simulator route", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "typescript", }), @@ -1383,7 +1389,7 @@ describe("/api/preview route", () => { export default async function handler( req: NextApiRequest, - res: NextApiResponse + res: NextApiResponse, ) { const client = createClient({ req }); diff --git a/packages/adapter-next/test/plugin-slice-create.test.ts b/packages/adapter-next/test/plugin-slice-create.test.ts index b74a2f6c0b..ee92768c80 100644 --- a/packages/adapter-next/test/plugin-slice-create.test.ts +++ b/packages/adapter-next/test/plugin-slice-create.test.ts @@ -186,7 +186,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -214,7 +214,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), @@ -351,7 +351,9 @@ test("component file is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "typescript" })); + expect(contents).toBe( + await prettier.format(contents, { parser: "typescript" }), + ); }); test("component file is not formatted if formatting is disabled", async (ctx) => { @@ -379,7 +381,7 @@ test("component file is not formatted if formatting is disabled", async (ctx) => ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "typescript", }), diff --git a/packages/adapter-next/test/plugin-snippet-read.test.ts b/packages/adapter-next/test/plugin-snippet-read.test.ts index 79cd4427b3..b61af13b53 100644 --- a/packages/adapter-next/test/plugin-snippet-read.test.ts +++ b/packages/adapter-next/test/plugin-snippet-read.test.ts @@ -50,20 +50,22 @@ const testSnippet = ( if (Array.isArray(expected)) { expect(res).toStrictEqual( - expected.map((descriptor) => ({ - ...descriptor, - code: prettier - .format(descriptor.code, { parser: "typescript" }) - .replace(/[\r\n]+$/, "") - .replace(/;$/, ""), - })), + await Promise.all( + expected.map(async (descriptor) => ({ + ...descriptor, + code: ( + await prettier.format(descriptor.code, { parser: "typescript" }) + ) + .replace(/[\r\n]+$/, "") + .replace(/;$/, ""), + })), + ), ); } else { expect(res).toStrictEqual({ label: "React", language: "tsx", - code: prettier - .format(expected, { parser: "typescript" }) + code: (await prettier.format(expected, { parser: "typescript" })) .replace(/[\r\n]+$/, "") .replace(/;$/, ""), }); diff --git a/packages/adapter-nuxt/.prettierrc b/packages/adapter-nuxt/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/adapter-nuxt/.prettierrc +++ b/packages/adapter-nuxt/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/adapter-nuxt/package.json b/packages/adapter-nuxt/package.json index 03948a110e..c86e7ea9f4 100644 --- a/packages/adapter-nuxt/package.json +++ b/packages/adapter-nuxt/package.json @@ -77,18 +77,17 @@ "@prismicio/mock": "0.2.0", "@size-limit/preset-small-lib": "8.2.4", "@types/common-tags": "1.8.1", - "@types/prettier": "2.7.2", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", "nuxt": "3.3.3", - "prettier": "2.8.4", - "prettier-plugin-jsdoc": "0.4.2", + "prettier": "3.0.3", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "ts-morph": "17.0.1", "typescript": "4.9.5", diff --git a/packages/adapter-nuxt/src/hooks/documentation-read.ts b/packages/adapter-nuxt/src/hooks/documentation-read.ts index 4451b59d5d..caac637b93 100644 --- a/packages/adapter-nuxt/src/hooks/documentation-read.ts +++ b/packages/adapter-nuxt/src/hooks/documentation-read.ts @@ -35,8 +35,8 @@ export const documentationRead: DocumentationReadHook = async ( model.id }-uid-\${route.params.uid}]\`, () => prismic.client.getByUID("${model.id}", route.params.uid${ - isTypeScriptProject ? " as string" : "" - }) + isTypeScriptProject ? " as string" : "" + }) ); useHead({ diff --git a/packages/adapter-nuxt/test/__testutils__/testGlobalContentTypes.ts b/packages/adapter-nuxt/test/__testutils__/testGlobalContentTypes.ts index 022c513352..8258d8f3dc 100644 --- a/packages/adapter-nuxt/test/__testutils__/testGlobalContentTypes.ts +++ b/packages/adapter-nuxt/test/__testutils__/testGlobalContentTypes.ts @@ -61,7 +61,7 @@ export const expectGlobalContentTypes = async ( if (args.format ?? true) { expect(contents).toBe( - prettier.format(generatedTypes, { parser: "typescript" }), + await prettier.format(generatedTypes, { parser: "typescript" }), ); } else { expect(contents).toBe(generatedTypes); diff --git a/packages/adapter-nuxt/test/plugin-customType-create.test.ts b/packages/adapter-nuxt/test/plugin-customType-create.test.ts index 98d4537194..67c367743c 100644 --- a/packages/adapter-nuxt/test/plugin-customType-create.test.ts +++ b/packages/adapter-nuxt/test/plugin-customType-create.test.ts @@ -50,7 +50,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -78,7 +78,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), diff --git a/packages/adapter-nuxt/test/plugin-project-init.test.ts b/packages/adapter-nuxt/test/plugin-project-init.test.ts index 4950ea2471..7bcd90473b 100644 --- a/packages/adapter-nuxt/test/plugin-project-init.test.ts +++ b/packages/adapter-nuxt/test/plugin-project-init.test.ts @@ -193,7 +193,7 @@ describe("Slice Simulator page", () => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "vue" })); + expect(contents).toBe(await prettier.format(contents, { parser: "vue" })); }); test("Slice Simulator page file is not formatted if formatting is disabled", async (ctx) => { @@ -224,7 +224,7 @@ describe("Slice Simulator page", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "vue", }), diff --git a/packages/adapter-nuxt/test/plugin-slice-create.test.ts b/packages/adapter-nuxt/test/plugin-slice-create.test.ts index f866fafd00..f628ecb22b 100644 --- a/packages/adapter-nuxt/test/plugin-slice-create.test.ts +++ b/packages/adapter-nuxt/test/plugin-slice-create.test.ts @@ -156,7 +156,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -184,7 +184,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), @@ -202,7 +202,7 @@ test("component file is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "vue" })); + expect(contents).toBe(await prettier.format(contents, { parser: "vue" })); }); test("component file is not formatted if formatting is disabled", async (ctx) => { @@ -230,7 +230,7 @@ test("component file is not formatted if formatting is disabled", async (ctx) => ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "vue", }), diff --git a/packages/adapter-nuxt/test/plugin-snippet-read.test.ts b/packages/adapter-nuxt/test/plugin-snippet-read.test.ts index 4c0a3e04e0..c8a4bcd61d 100644 --- a/packages/adapter-nuxt/test/plugin-snippet-read.test.ts +++ b/packages/adapter-nuxt/test/plugin-snippet-read.test.ts @@ -50,20 +50,20 @@ const testSnippet = ( if (Array.isArray(expected)) { expect(res).toStrictEqual( - expected.map((descriptor) => ({ - ...descriptor, - code: prettier - .format(descriptor.code, { parser: "vue" }) - .replace(/[\r\n]+$/, "") - .replace(/;$/, ""), - })), + await Promise.all( + expected.map(async (descriptor) => ({ + ...descriptor, + code: (await prettier.format(descriptor.code, { parser: "vue" })) + .replace(/[\r\n]+$/, "") + .replace(/;$/, ""), + })), + ), ); } else { expect(res).toStrictEqual({ label: "Vue", language: "vue", - code: prettier - .format(expected, { parser: "vue" }) + code: (await prettier.format(expected, { parser: "vue" })) .replace(/[\r\n]+$/, "") .replace(/;$/, ""), }); diff --git a/packages/adapter-nuxt2/.prettierrc b/packages/adapter-nuxt2/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/adapter-nuxt2/.prettierrc +++ b/packages/adapter-nuxt2/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/adapter-nuxt2/package.json b/packages/adapter-nuxt2/package.json index 953e5f3fb0..bee91251e1 100644 --- a/packages/adapter-nuxt2/package.json +++ b/packages/adapter-nuxt2/package.json @@ -76,18 +76,17 @@ "devDependencies": { "@prismicio/mock": "0.2.0", "@size-limit/preset-small-lib": "8.2.4", - "@types/prettier": "2.7.2", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", "nuxt": "2.16.3", - "prettier": "2.8.4", - "prettier-plugin-jsdoc": "0.4.2", + "prettier": "3.0.3", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "ts-morph": "17.0.1", "typescript": "4.9.5", diff --git a/packages/adapter-nuxt2/test/__testutils__/testGlobalContentTypes.ts b/packages/adapter-nuxt2/test/__testutils__/testGlobalContentTypes.ts index 167515541e..ea1ab59764 100644 --- a/packages/adapter-nuxt2/test/__testutils__/testGlobalContentTypes.ts +++ b/packages/adapter-nuxt2/test/__testutils__/testGlobalContentTypes.ts @@ -61,7 +61,7 @@ export const expectGlobalContentTypes = async ( if (args.format ?? true) { expect(contents).toBe( - prettier.format(generatedTypes, { parser: "typescript" }), + await prettier.format(generatedTypes, { parser: "typescript" }), ); } else { expect(contents).toBe(generatedTypes); diff --git a/packages/adapter-nuxt2/test/plugin-customType-create.test.ts b/packages/adapter-nuxt2/test/plugin-customType-create.test.ts index 98d4537194..67c367743c 100644 --- a/packages/adapter-nuxt2/test/plugin-customType-create.test.ts +++ b/packages/adapter-nuxt2/test/plugin-customType-create.test.ts @@ -50,7 +50,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -78,7 +78,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), diff --git a/packages/adapter-nuxt2/test/plugin-project-init.test.ts b/packages/adapter-nuxt2/test/plugin-project-init.test.ts index 2821d00c54..f340492c04 100644 --- a/packages/adapter-nuxt2/test/plugin-project-init.test.ts +++ b/packages/adapter-nuxt2/test/plugin-project-init.test.ts @@ -207,7 +207,7 @@ describe("Slice Simulator page", () => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "vue" })); + expect(contents).toBe(await prettier.format(contents, { parser: "vue" })); }); test("Slice Simulator page file is not formatted if formatting is disabled", async (ctx) => { @@ -238,7 +238,7 @@ describe("Slice Simulator page", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "vue", }), diff --git a/packages/adapter-nuxt2/test/plugin-slice-create.test.ts b/packages/adapter-nuxt2/test/plugin-slice-create.test.ts index 3ab04d151d..b32e47770a 100644 --- a/packages/adapter-nuxt2/test/plugin-slice-create.test.ts +++ b/packages/adapter-nuxt2/test/plugin-slice-create.test.ts @@ -153,7 +153,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -181,7 +181,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), @@ -199,7 +199,7 @@ test("component file is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "vue" })); + expect(contents).toBe(await prettier.format(contents, { parser: "vue" })); }); test("component file is not formatted if formatting is disabled", async (ctx) => { @@ -227,7 +227,7 @@ test("component file is not formatted if formatting is disabled", async (ctx) => ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "vue", }), diff --git a/packages/adapter-nuxt2/test/plugin-snippet-read.test.ts b/packages/adapter-nuxt2/test/plugin-snippet-read.test.ts index 4c0a3e04e0..c8a4bcd61d 100644 --- a/packages/adapter-nuxt2/test/plugin-snippet-read.test.ts +++ b/packages/adapter-nuxt2/test/plugin-snippet-read.test.ts @@ -50,20 +50,20 @@ const testSnippet = ( if (Array.isArray(expected)) { expect(res).toStrictEqual( - expected.map((descriptor) => ({ - ...descriptor, - code: prettier - .format(descriptor.code, { parser: "vue" }) - .replace(/[\r\n]+$/, "") - .replace(/;$/, ""), - })), + await Promise.all( + expected.map(async (descriptor) => ({ + ...descriptor, + code: (await prettier.format(descriptor.code, { parser: "vue" })) + .replace(/[\r\n]+$/, "") + .replace(/;$/, ""), + })), + ), ); } else { expect(res).toStrictEqual({ label: "Vue", language: "vue", - code: prettier - .format(expected, { parser: "vue" }) + code: (await prettier.format(expected, { parser: "vue" })) .replace(/[\r\n]+$/, "") .replace(/;$/, ""), }); diff --git a/packages/adapter-sveltekit/.prettierrc b/packages/adapter-sveltekit/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/adapter-sveltekit/.prettierrc +++ b/packages/adapter-sveltekit/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/adapter-sveltekit/package.json b/packages/adapter-sveltekit/package.json index e51ee469f0..4dc12bf70f 100644 --- a/packages/adapter-sveltekit/package.json +++ b/packages/adapter-sveltekit/package.json @@ -73,7 +73,7 @@ "newtype-ts": "^0.3.5", "node-fetch": "^3.3.1", "pascal-case": "^3.1.2", - "prettier-plugin-svelte": "^2.10.1", + "prettier-plugin-svelte": "^3.0.3", "prismic-ts-codegen": "^0.1.17" }, "devDependencies": { @@ -89,12 +89,12 @@ "concurrently": "8.2.1", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-svelte": "2.33.0", "eslint-plugin-tsdoc": "0.2.17", - "prettier": "2.8.4", - "prettier-plugin-jsdoc": "0.4.2", + "prettier": "3.0.3", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "svelte": "4.2.0", "typescript": "4.9.5", diff --git a/packages/adapter-sveltekit/test/__testutils__/testGlobalContentTypes.ts b/packages/adapter-sveltekit/test/__testutils__/testGlobalContentTypes.ts index 934f747a85..5bf4184147 100644 --- a/packages/adapter-sveltekit/test/__testutils__/testGlobalContentTypes.ts +++ b/packages/adapter-sveltekit/test/__testutils__/testGlobalContentTypes.ts @@ -61,7 +61,7 @@ export const expectGlobalContentTypes = async ( if (args.format ?? true) { expect(contents).toBe( - prettier.format(generatedTypes, { parser: "typescript" }), + await prettier.format(generatedTypes, { parser: "typescript" }), ); } else { expect(contents).toBe(generatedTypes); diff --git a/packages/adapter-sveltekit/test/plugin-customType-create.test.ts b/packages/adapter-sveltekit/test/plugin-customType-create.test.ts index 8f0bd80e22..642cebcdcd 100644 --- a/packages/adapter-sveltekit/test/plugin-customType-create.test.ts +++ b/packages/adapter-sveltekit/test/plugin-customType-create.test.ts @@ -52,7 +52,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -80,7 +80,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), diff --git a/packages/adapter-sveltekit/test/plugin-project-init.test.ts b/packages/adapter-sveltekit/test/plugin-project-init.test.ts index 701c1628c3..752a35852e 100644 --- a/packages/adapter-sveltekit/test/plugin-project-init.test.ts +++ b/packages/adapter-sveltekit/test/plugin-project-init.test.ts @@ -202,7 +202,9 @@ describe("prismicio.js file", () => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "typescript" })); + expect(contents).toBe( + await prettier.format(contents, { parser: "typescript" }), + ); }); it("prismicio file is not formatted if formatting is disabled", async (ctx) => { @@ -233,7 +235,7 @@ describe("prismicio.js file", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "typescript", }), @@ -258,12 +260,13 @@ describe("prismicio.js file", () => { "import * as prismic from \\"@prismicio/client\\"; import config from \\"../../slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} * @@ -323,12 +326,13 @@ describe("prismicio.js file", () => { "import * as prismic from \\"@prismicio/client\\"; import config from \\"../../slicemachine.config.json\\"; - /** The project's Prismic repository name. */ + /** + * The project's Prismic repository name. + */ export const repositoryName = config.repositoryName; /** - * A list of Route Resolver objects that define how a document's \`url\` field is - * resolved. + * A list of Route Resolver objects that define how a document's \`url\` field is resolved. * * {@link https://prismic.io/docs/route-resolver#route-resolver} */ @@ -445,7 +449,7 @@ describe("Slice Simulator route", () => { ); expect(contents).toBe( - prettier.format(contents, { + await prettier.format(contents, { plugins: ["prettier-plugin-svelte"], parser: "svelte", }), @@ -486,7 +490,7 @@ describe("Slice Simulator route", () => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, plugins: ["prettier-plugin-svelte"], parser: "svelte", diff --git a/packages/adapter-sveltekit/test/plugin-slice-create.test.ts b/packages/adapter-sveltekit/test/plugin-slice-create.test.ts index 0881cce9dd..9ea0176d39 100644 --- a/packages/adapter-sveltekit/test/plugin-slice-create.test.ts +++ b/packages/adapter-sveltekit/test/plugin-slice-create.test.ts @@ -152,7 +152,7 @@ test("model.json is formatted by default", async (ctx) => { "utf8", ); - expect(contents).toBe(prettier.format(contents, { parser: "json" })); + expect(contents).toBe(await prettier.format(contents, { parser: "json" })); }); test("model.json is not formatted if formatting is disabled", async (ctx) => { @@ -180,7 +180,7 @@ test("model.json is not formatted if formatting is disabled", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, parser: "json", }), @@ -264,7 +264,7 @@ test("component file is formatted by default", async (ctx) => { ); expect(contents).toBe( - prettier.format(contents, { + await prettier.format(contents, { plugins: ["prettier-plugin-svelte"], parser: "svelte", }), @@ -296,7 +296,7 @@ test("component file is not formatted if formatting is disabled", async (ctx) => ); expect(contents).not.toBe( - prettier.format(contents, { + await prettier.format(contents, { ...prettierOptions, plugins: ["prettier-plugin-svelte"], parser: "svelte", diff --git a/packages/adapter-sveltekit/test/plugin-snippet-read.test.ts b/packages/adapter-sveltekit/test/plugin-snippet-read.test.ts index febdb9528e..6504347c77 100644 --- a/packages/adapter-sveltekit/test/plugin-snippet-read.test.ts +++ b/packages/adapter-sveltekit/test/plugin-snippet-read.test.ts @@ -55,20 +55,20 @@ const testSnippet = ( if (Array.isArray(expected)) { expect(res).toStrictEqual( - expected.map((descriptor) => ({ - ...descriptor, - code: prettier - .format(descriptor.code, prettierConfig) - .replace(/[\r\n]+$/, "") - .replace(/;$/, ""), - })), + await Promise.all( + expected.map(async (descriptor) => ({ + ...descriptor, + code: (await prettier.format(descriptor.code, prettierConfig)) + .replace(/[\r\n]+$/, "") + .replace(/;$/, ""), + })), + ), ); } else { expect(res).toStrictEqual({ label: "Svelte", language: "svelte", - code: prettier - .format(expected, prettierConfig) + code: (await prettier.format(expected, prettierConfig)) .replace(/[\r\n]+$/, "") .replace(/;$/, ""), }); diff --git a/packages/init/.prettierrc b/packages/init/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/init/.prettierrc +++ b/packages/init/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/init/package.json b/packages/init/package.json index 7081ac68eb..13c9e424be 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -76,8 +76,8 @@ "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", "execa": "7.1.1", "hook-std": "3.0.0", @@ -85,8 +85,8 @@ "mock-stdin": "1.0.0", "msw": "1.1.0", "parse-multipart-data": "1.5.0", - "prettier": "2.8.4", - "prettier-plugin-jsdoc": "0.4.2", + "prettier": "3.0.3", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "typescript": "4.9.5", "vite": "4.3.9", diff --git a/packages/init/src/lib/prompt.ts b/packages/init/src/lib/prompt.ts index 0433eadd0b..33adca87d4 100644 --- a/packages/init/src/lib/prompt.ts +++ b/packages/init/src/lib/prompt.ts @@ -11,9 +11,8 @@ type promptArgs< export const prompt = async ( question: promptArgs, ): Promise> => { - const answers: Record = await prompts( - question, - ); + const answers: Record = + await prompts(question); if (!Object.keys(answers).length) { process.exit(130); diff --git a/packages/manager/.prettierrc b/packages/manager/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/manager/.prettierrc +++ b/packages/manager/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/manager/package.json b/packages/manager/package.json index 083880efc5..da9385ed4e 100644 --- a/packages/manager/package.json +++ b/packages/manager/package.json @@ -86,7 +86,7 @@ "newtype-ts": "^0.3.5", "node-fetch": "^3.3.1", "p-limit": "^4.0.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "r19": "^0.1.7", "rc9": "^2.0.1", "rehype-stringify": "^9.0.3", @@ -108,15 +108,15 @@ "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", "express": "4.18.2", "hook-std": "3.0.0", "memfs": "3.4.13", "msw": "1.1.0", "parse-multipart-data": "1.5.0", - "prettier-plugin-jsdoc": "0.4.2", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "typescript": "4.9.5", "vite": "4.3.9", diff --git a/packages/manager/src/lib/format.ts b/packages/manager/src/lib/format.ts index 8b63a645c2..ab6e08f90b 100644 --- a/packages/manager/src/lib/format.ts +++ b/packages/manager/src/lib/format.ts @@ -20,7 +20,7 @@ export const format = async ( const prettierOptions = await prettier.resolveConfig(filePath); - formatted = prettier.format(formatted, { + formatted = await prettier.format(formatted, { ...prettierOptions, filepath: filePath, ...(options?.prettier ?? {}), diff --git a/packages/manager/src/managers/slices/SlicesManager.ts b/packages/manager/src/managers/slices/SlicesManager.ts index a4a115b4d7..b0546d71ff 100644 --- a/packages/manager/src/managers/slices/SlicesManager.ts +++ b/packages/manager/src/managers/slices/SlicesManager.ts @@ -304,9 +304,8 @@ export class SlicesManager extends BaseManager { mocks: mockSlice({ model: args.model }), }; - const { errors: updateSliceHookErrors } = await this.updateSliceMocks( - updateSliceMocksArgs, - ); + const { errors: updateSliceHookErrors } = + await this.updateSliceMocks(updateSliceMocksArgs); return { errors: [...hookResult.errors, ...updateSliceHookErrors], @@ -368,9 +367,8 @@ export class SlicesManager extends BaseManager { mocks: updatedMocks, }; - const { errors: updateSliceMocksHookResult } = await this.updateSliceMocks( - updateSliceMocksArgs, - ); + const { errors: updateSliceMocksHookResult } = + await this.updateSliceMocks(updateSliceMocksArgs); return { errors: [...hookResult.errors, ...updateSliceMocksHookResult], diff --git a/packages/manager/src/types.ts b/packages/manager/src/types.ts index 3ee2dbce1e..cafd7b62ca 100644 --- a/packages/manager/src/types.ts +++ b/packages/manager/src/types.ts @@ -10,7 +10,8 @@ export type { APIEndpoints } from "./constants/API_ENDPOINTS"; * @typeParam TSliceMachinePluginOptions - User-provided options for the plugin. */ export type SliceMachineConfigPluginRegistration< - TSliceMachinePluginOptions extends SliceMachinePluginOptions = SliceMachinePluginOptions, + TSliceMachinePluginOptions extends + SliceMachinePluginOptions = SliceMachinePluginOptions, > = | string | { diff --git a/packages/manager/test/__setup__.ts b/packages/manager/test/__setup__.ts index df48493260..75040b5b5c 100644 --- a/packages/manager/test/__setup__.ts +++ b/packages/manager/test/__setup__.ts @@ -74,9 +74,8 @@ vi.mock("fs/promises", async () => { }; const memfs: typeof import("memfs") = await vi.importActual("memfs"); - const _fs: typeof import("node:fs/promises") = await vi.importActual( - "node:fs/promises", - ); + const _fs: typeof import("node:fs/promises") = + await vi.importActual("node:fs/promises"); const readFile = escapeOnigurumaMethod( _fs.readFile, @@ -111,6 +110,10 @@ vi.mock("module", async () => { createRequire: (...args) => { const actualCreateRequire = actual.createRequire(...args); + if (args[0].toString().includes("prettier")) { + return actualCreateRequire; + } + return { ...actualCreateRequire, resolve: (id: string) => { @@ -120,7 +123,7 @@ vi.mock("module", async () => { return `${MOCK_BASE_DIRECTORY}/${id}`; } - return actualCreateRequire(id); + return actualCreateRequire.resolve(id); }, }; }, diff --git a/packages/plugin-kit/.prettierrc b/packages/plugin-kit/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/plugin-kit/.prettierrc +++ b/packages/plugin-kit/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/plugin-kit/package.json b/packages/plugin-kit/package.json index 2a52a974cf..abb55d7dbd 100644 --- a/packages/plugin-kit/package.json +++ b/packages/plugin-kit/package.json @@ -68,8 +68,8 @@ "fs-extra": "11.1.1", "io-ts": "^2.2.20", "io-ts-reporters": "^2.0.1", - "prettier": "^2.8.4", - "prismic-ts-codegen": "^0.1.17" + "prettier": "^3.0.3", + "prismic-ts-codegen": "^0.1.19" }, "devDependencies": { "@prismicio/mock": "0.2.0", @@ -77,19 +77,18 @@ "@size-limit/preset-small-lib": "8.2.4", "@types/common-tags": "1.8.1", "@types/fs-extra": "11.0.1", - "@types/prettier": "2.7.2", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", "io-ts-types": "0.5.19", "monocle-ts": "2.3.13", "newtype-ts": "0.3.5", - "prettier-plugin-jsdoc": "0.4.2", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "typescript": "4.9.5", "vite": "4.3.9", diff --git a/packages/plugin-kit/src/createSliceMachineHelpers.ts b/packages/plugin-kit/src/createSliceMachineHelpers.ts index 2409e197f2..7514726139 100644 --- a/packages/plugin-kit/src/createSliceMachineHelpers.ts +++ b/packages/plugin-kit/src/createSliceMachineHelpers.ts @@ -111,7 +111,7 @@ export class SliceMachineHelpers { filePath || this._project.root, ); - formatted = prettier.format(formatted, { + formatted = await prettier.format(formatted, { ...prettierOptions, filepath: filePath, ...(options?.prettier ?? {}), diff --git a/packages/plugin-kit/test/SliceMachinePluginRunner-loadPlugin.test.ts b/packages/plugin-kit/test/SliceMachinePluginRunner-loadPlugin.test.ts index 029f1fd86b..232eaece1c 100644 --- a/packages/plugin-kit/test/SliceMachinePluginRunner-loadPlugin.test.ts +++ b/packages/plugin-kit/test/SliceMachinePluginRunner-loadPlugin.test.ts @@ -4,12 +4,11 @@ import * as path from "node:path"; import * as plugin from "./__fixtures__/plugin"; const createRequireMock = - vi.fn>(); + vi.fn>(); vi.mock("module", async () => { - const actual: typeof import("node:module") = await vi.importActual( - "node:module", - ); + const actual: typeof import("node:module") = + await vi.importActual("node:module"); return { ...actual, diff --git a/packages/plugin-kit/test/fs/upsertGlobalTypeScriptTypes.test.ts b/packages/plugin-kit/test/fs/upsertGlobalTypeScriptTypes.test.ts index 4d8f2ff6e3..a6b9ed93f8 100644 --- a/packages/plugin-kit/test/fs/upsertGlobalTypeScriptTypes.test.ts +++ b/packages/plugin-kit/test/fs/upsertGlobalTypeScriptTypes.test.ts @@ -53,7 +53,7 @@ const expectGlobalTypeScriptTypes = async ( if (args.format) { expect(contents).toBe( - prettier.format(generatedTypes, { parser: "typescript" }), + await prettier.format(generatedTypes, { parser: "typescript" }), ); } else { expect(contents).toBe(generatedTypes); diff --git a/packages/plugin-kit/test/fs/writeCustomTypeModel.test.ts b/packages/plugin-kit/test/fs/writeCustomTypeModel.test.ts index 58a5f2fdc1..1ee2ae131b 100644 --- a/packages/plugin-kit/test/fs/writeCustomTypeModel.test.ts +++ b/packages/plugin-kit/test/fs/writeCustomTypeModel.test.ts @@ -50,7 +50,7 @@ it("formats contents if `format` is true", async (ctx) => { ); expect(contents).toBe( - prettier.format(JSON.stringify(model, null, 2), { + await prettier.format(JSON.stringify(model, null, 2), { ...prettierConfig, parser: "json", }), @@ -75,7 +75,7 @@ it("accepts format options", async (ctx) => { ); expect(contents).toBe( - prettier.format(JSON.stringify(model, null, 2), { + await prettier.format(JSON.stringify(model, null, 2), { ...prettierConfig, parser: "json", }), @@ -101,7 +101,7 @@ it("does not format contents by default", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(JSON.stringify(model, null, 2), { + await prettier.format(JSON.stringify(model, null, 2), { ...prettierConfig, parser: "json", }), diff --git a/packages/plugin-kit/test/fs/writeSliceModel.test.ts b/packages/plugin-kit/test/fs/writeSliceModel.test.ts index 911c262792..487fec226e 100644 --- a/packages/plugin-kit/test/fs/writeSliceModel.test.ts +++ b/packages/plugin-kit/test/fs/writeSliceModel.test.ts @@ -62,7 +62,7 @@ it("formats contents if `format` is true", async (ctx) => { ); expect(contents).toBe( - prettier.format(JSON.stringify(model, null, 2), { + await prettier.format(JSON.stringify(model, null, 2), { ...prettierConfig, parser: "json", }), @@ -93,7 +93,7 @@ it("accepts format options", async (ctx) => { ); expect(contents).toBe( - prettier.format(JSON.stringify(model, null, 2), { + await prettier.format(JSON.stringify(model, null, 2), { ...prettierConfig, parser: "json", }), @@ -125,7 +125,7 @@ it("does not format contents by default", async (ctx) => { ); expect(contents).not.toBe( - prettier.format(JSON.stringify(model, null, 2), { + await prettier.format(JSON.stringify(model, null, 2), { ...prettierConfig, parser: "json", }), 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 1245d3bcdf..a9e6354c40 100644 --- a/packages/slice-machine/components/Simulator/components/IframeRenderer/index.tsx +++ b/packages/slice-machine/components/Simulator/components/IframeRenderer/index.tsx @@ -9,7 +9,7 @@ import { ScreenDimensions } from "@lib/models/common/Screenshots"; function useSimulatorClient(): readonly [ SimulatorClient | undefined, - RefCallback + RefCallback, ] { const [client, setClient] = useState(); const clientRef = useRef(); @@ -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 a88767090d..6488df77ef 100644 --- a/packages/slice-machine/lib/models/common/ErrorWithStatus.ts +++ b/packages/slice-machine/lib/models/common/ErrorWithStatus.ts @@ -1,5 +1,8 @@ export default class ErrorWithStatus extends Error { - constructor(readonly reason: string, readonly status: number) { + constructor( + readonly reason: string, + 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 f61a7f68fc..b309a28809 100644 --- a/packages/slice-machine/lib/utils/poll.ts +++ b/packages/slice-machine/lib/utils/poll.ts @@ -1,16 +1,16 @@ export async function startPolling< Result, - ValidatedResult extends Result = Result + ValidatedResult extends Result = Result, >( 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/package.json b/packages/slice-machine/package.json index ca8c81a2af..cfc102f483 100644 --- a/packages/slice-machine/package.json +++ b/packages/slice-machine/package.json @@ -76,7 +76,7 @@ "cross-env": "7.0.3", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", + "eslint-config-prettier": "9.0.0", "eslint-import-resolver-typescript": "3.5.3", "eslint-plugin-import": "2.27.5", "eslint-plugin-react-hooks": "4.6.0", 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/labs/labsList/useLab.tsx b/packages/slice-machine/src/features/labs/labsList/useLab.tsx index 8617fdfa82..737bd4fa01 100644 --- a/packages/slice-machine/src/features/labs/labsList/useLab.tsx +++ b/packages/slice-machine/src/features/labs/labsList/useLab.tsx @@ -6,7 +6,7 @@ export type UseLabArgs = keyof Required["labs"]; export type UseLabReturnType = [ lab: { enabled: boolean }, - setLab: (enabled: boolean) => Promise + setLab: (enabled: boolean) => Promise, ]; export function useLab(key: UseLabArgs): UseLabReturnType { 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 ce9eb7012f..6037417d4f 100644 --- a/packages/slice-machine/src/hooks/useModelStatus.ts +++ b/packages/slice-machine/src/hooks/useModelStatus.ts @@ -26,24 +26,27 @@ 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) => { - const { status } = computeModelStatus(model, userHasAccessToModels); + return models.reduce<{ [id: string]: ModelStatus }>( + (acc, model) => { + const { status } = computeModelStatus(model, userHasAccessToModels); - return { - ...acc, - [hasLocal(model) ? model.local.id : model.remote.id]: status, - }; - }, {} as { [sliceId: string]: ModelStatus }); + return { + ...acc, + [hasLocal(model) ? model.local.id : model.remote.id]: status, + }; + }, + {} as { [sliceId: string]: ModelStatus }, + ); } export const useModelStatus = ({ 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/useSliceMachineConfig.ts b/packages/slice-machine/src/hooks/useSliceMachineConfig.ts index 3a4663c021..0331ebe717 100644 --- a/packages/slice-machine/src/hooks/useSliceMachineConfig.ts +++ b/packages/slice-machine/src/hooks/useSliceMachineConfig.ts @@ -5,7 +5,7 @@ import { managerClient } from "@src/managerClient"; type UseSliceMachineConfigReturnType = [ config: SliceMachineConfig, - setConfig: (config: SliceMachineConfig) => Promise + setConfig: (config: SliceMachineConfig) => Promise, ]; export function useSliceMachineConfig(): UseSliceMachineConfigReturnType { diff --git a/packages/slice-machine/src/hooks/useThrottle.ts b/packages/slice-machine/src/hooks/useThrottle.ts index 2fdd6cc69b..1202326599 100644 --- a/packages/slice-machine/src/hooks/useThrottle.ts +++ b/packages/slice-machine/src/hooks/useThrottle.ts @@ -3,18 +3,21 @@ 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()); useEffect(() => { - const handler = setTimeout(function () { - if (Date.now() - lastRan.current >= limit) { - setThrottledValue(cb()); - lastRan.current = Date.now(); - } - }, limit - (Date.now() - lastRan.current)); + const handler = setTimeout( + function () { + if (Date.now() - lastRan.current >= limit) { + setThrottledValue(cb()); + lastRan.current = Date.now(); + } + }, + limit - (Date.now() - lastRan.current), + ); return () => { clearTimeout(handler); 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 c271994095..033aa2d4e6 100644 --- a/packages/slice-machine/src/modules/useSliceMachineActions.ts +++ b/packages/slice-machine/src/modules/useSliceMachineActions.ts @@ -112,13 +112,15 @@ const useSliceMachineActions = () => { dispatch(modalOpenCreator({ modalKey: ModalKeysEnum.DELETE_SLICE })); const openDeleteDocumentsDrawer = () => dispatch( - modalOpenCreator({ modalKey: ModalKeysEnum.SOFT_DELETE_DOCUMENTS_DRAWER }) + 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 })); @@ -138,13 +140,13 @@ const useSliceMachineActions = () => { dispatch( skipReviewCreator({ reviewType, - }) + }), ); const sendAReview = (reviewType: UserReviewType) => dispatch( sendAReviewCreator({ reviewType, - }) + }), ); const setUpdatesViewed = (versions: UserContextStoreType["updatesViewed"]) => dispatch(updatesViewedCreator(versions)); @@ -159,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()); @@ -183,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 */ @@ -211,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 })); @@ -223,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 })); @@ -238,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({ @@ -265,7 +267,7 @@ const useSliceMachineActions = () => { previousFieldId, newFieldId, value, - }) + }), ); // Slice module @@ -276,7 +278,7 @@ const useSliceMachineActions = () => { variationId: string, widgetsArea: WidgetsArea, key: string, - value: NestableWidget + value: NestableWidget, ) => { dispatch(addSliceWidgetCreator({ variationId, widgetsArea, key, value })); }; @@ -286,7 +288,7 @@ const useSliceMachineActions = () => { widgetsArea: WidgetsArea, previousKey: string, newKey: string, - value: NestableWidget + value: NestableWidget, ) => { dispatch( replaceSliceWidgetCreator({ @@ -295,7 +297,7 @@ const useSliceMachineActions = () => { previousKey, newKey, value, - }) + }), ); }; @@ -303,7 +305,7 @@ const useSliceMachineActions = () => { variationId: string, widgetsArea: WidgetsArea, start: number, - end: number | undefined + end: number | undefined, ) => { dispatch( reorderSliceWidgetCreator({ @@ -311,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, - }) + }), ); }; @@ -349,7 +351,7 @@ const useSliceMachineActions = () => { previousKey: string, newKey: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any - mockValue: any + mockValue: any, ) => { dispatch( updateSliceWidgetMockCreator({ @@ -359,7 +361,7 @@ const useSliceMachineActions = () => { newKey, // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment mockValue, - }) + }), ); }; @@ -367,7 +369,7 @@ const useSliceMachineActions = () => { variationId: string, component: ComponentUI, screenDimensions: ScreenDimensions, - method: ScreenshotGenerationMethod + method: ScreenshotGenerationMethod, ) => { dispatch( generateSliceScreenshotCreator.request({ @@ -375,7 +377,7 @@ const useSliceMachineActions = () => { component, screenDimensions, method, - }) + }), ); }; @@ -383,7 +385,7 @@ const useSliceMachineActions = () => { variationId: string, component: ComponentUI, file: Blob, - method: ScreenshotGenerationMethod + method: ScreenshotGenerationMethod, ) => { dispatch( generateSliceCustomScreenshotCreator.request({ @@ -391,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 })); }; @@ -422,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) => @@ -438,7 +440,7 @@ const useSliceMachineActions = () => { sliceId, sliceName, libName, - }) + }), ); const pushChanges = (payload: ChangesPushSagaPayload) => @@ -447,7 +449,7 @@ const useSliceMachineActions = () => { // Toaster store const openToaster = ( content: string | React.ReactNode, - type: GenericToastTypes + type: GenericToastTypes, ) => dispatch(openToasterCreator({ content, type })); // Simulator @@ -464,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/theme.ts b/packages/slice-machine/src/theme.ts index 1ac57dffcc..3d02eb5e3a 100644 --- a/packages/slice-machine/src/theme.ts +++ b/packages/slice-machine/src/theme.ts @@ -993,6 +993,6 @@ const AppTheme = (): Theme => bg: "muted", }, }, - } as Theme); + }) as Theme; export default AppTheme; 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 27c6c95960..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 }); @@ -84,6 +84,17 @@ vi.mock("fs/promises", async () => { }; }); +// jsdom environment removes Node native modules which is desired. +// However, because we create a plugin before each tests and that +// they rely on Prettier, which relies on `node:url`, we need to +// bypass jsdom restricted browser environment by mocking `node:url` +// to itself. +vi.mock("url", async () => { + const actual: typeof import("node:url") = await vi.importActual("node:url"); + + return actual; +}); + vi.mock("analytics-node", () => { const MockSegmentClient = vi.fn(); @@ -93,7 +104,7 @@ vi.mock("analytics-node", () => { if (callback) { callback(); } - } + }, ); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access @@ -102,7 +113,7 @@ vi.mock("analytics-node", () => { if (callback) { callback(); } - } + }, ); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access @@ -111,7 +122,7 @@ vi.mock("analytics-node", () => { if (callback) { callback(); } - } + }, ); return { @@ -148,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.", ); } @@ -174,7 +185,7 @@ vi.stubGlobal( } else { return res; } - }) + }), ); vi.stubGlobal( @@ -185,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__/createTestPlugin.ts b/packages/slice-machine/test/__testutils__/createTestPlugin.ts index b952219019..e606e71d93 100644 --- a/packages/slice-machine/test/__testutils__/createTestPlugin.ts +++ b/packages/slice-machine/test/__testutils__/createTestPlugin.ts @@ -39,7 +39,7 @@ type CreateTestPluginArgs = }; export const createTestPlugin = < - TPluginOptions extends SliceMachinePluginOptions + TPluginOptions extends SliceMachinePluginOptions, >({ setup, __autofillRequiredAdapterHooks = true, 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/hooks/useModelStatus.test.ts b/packages/slice-machine/test/src/hooks/useModelStatus.test.ts index 31fb6a1e8a..158a71e77d 100644 --- a/packages/slice-machine/test/src/hooks/useModelStatus.test.ts +++ b/packages/slice-machine/test/src/hooks/useModelStatus.test.ts @@ -12,9 +12,8 @@ import { ModelStatus } from "@lib/models/common/ModelStatus"; const mockSelector = vi.fn(); vi.mock("react-redux", async () => { - const actual: typeof import("react-redux") = await vi.importActual( - "react-redux" - ); + const actual: typeof import("react-redux") = + await vi.importActual("react-redux"); return { ...actual, 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 e615e90218..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,14 +25,16 @@ 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, ); }); 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 - availableCustomTypesReducer(dummyCustomTypesState, { type: "NO.MATCH" }) + 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); }); @@ -47,7 +49,7 @@ describe("[Available Custom types module]", () => { }); expect( - availableCustomTypesReducer(dummyCustomTypesState, action) + availableCustomTypesReducer(dummyCustomTypesState, action), ).toEqual({ ...dummyCustomTypesState, about: { @@ -75,7 +77,7 @@ describe("[Available Custom types module]", () => { }); expect( - availableCustomTypesReducer(dummyCustomTypesState, action) + availableCustomTypesReducer(dummyCustomTypesState, action), ).toEqual({ ...dummyCustomTypesState, [createdCustomType.id]: { @@ -167,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({ @@ -221,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() @@ -250,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(); }); @@ -269,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); @@ -282,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); }); - } + }, ); diff --git a/packages/start-slicemachine/.prettierrc b/packages/start-slicemachine/.prettierrc index 815c6788fa..a3bf3ac165 100644 --- a/packages/start-slicemachine/.prettierrc +++ b/packages/start-slicemachine/.prettierrc @@ -2,7 +2,7 @@ "plugins": ["prettier-plugin-jsdoc"], "jsdocSeparateReturnsFromParam": true, "jsdocSeparateTagGroups": true, - "jsdocSingleLineComment": false, + "jsdocCommentLineStrategy": "keep", "tsdoc": true, "printWidth": 80, "useTabs": true, diff --git a/packages/start-slicemachine/package.json b/packages/start-slicemachine/package.json index 160224b417..5ce0619e10 100644 --- a/packages/start-slicemachine/package.json +++ b/packages/start-slicemachine/package.json @@ -85,12 +85,12 @@ "@vitest/coverage-v8": "0.32.0", "depcheck": "1.4.3", "eslint": "8.37.0", - "eslint-config-prettier": "8.7.0", - "eslint-plugin-prettier": "4.2.1", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.1", "eslint-plugin-tsdoc": "0.2.17", "nodemon": "2.0.22", - "prettier": "2.8.4", - "prettier-plugin-jsdoc": "0.4.2", + "prettier": "3.0.3", + "prettier-plugin-jsdoc": "1.1.1", "size-limit": "8.2.4", "typescript": "4.9.5", "vite": "4.3.9", diff --git a/yarn.lock b/yarn.lock index 5daab1a4fa..6c6e336883 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8097,7 +8097,6 @@ __metadata: "@size-limit/preset-small-lib": 8.2.4 "@slicemachine/plugin-kit": "workspace:^" "@types/common-tags": 1.8.1 - "@types/prettier": 2.7.2 "@types/react": 18.0.28 "@typescript-eslint/eslint-plugin": 5.55.0 "@typescript-eslint/parser": 5.55.0 @@ -8106,8 +8105,8 @@ __metadata: common-tags: ^1.8.2 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 fp-ts: ^2.13.1 io-ts: ^2.2.20 @@ -8116,8 +8115,8 @@ __metadata: newtype-ts: ^0.3.5 node-fetch: ^3.3.1 pascal-case: ^3.1.2 - prettier: 2.8.4 - prettier-plugin-jsdoc: 0.4.2 + prettier: 3.0.3 + prettier-plugin-jsdoc: 1.1.1 prismic-ts-codegen: ^0.1.17 react: 18.2.0 rollup-plugin-preserve-directives: 0.1.1 @@ -8141,15 +8140,14 @@ __metadata: "@prismicio/types-internal": ^2.2.0 "@size-limit/preset-small-lib": 8.2.4 "@slicemachine/plugin-kit": "workspace:^" - "@types/prettier": 2.7.2 "@typescript-eslint/eslint-plugin": 5.55.0 "@typescript-eslint/parser": 5.55.0 "@vitest/coverage-v8": 0.32.0 common-tags: ^1.8.2 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 fp-ts: ^2.13.1 io-ts: ^2.2.20 @@ -8160,8 +8158,8 @@ __metadata: node-fetch: ^3.3.1 nuxt: 2.16.3 pascal-case: ^3.1.2 - prettier: 2.8.4 - prettier-plugin-jsdoc: 0.4.2 + prettier: 3.0.3 + prettier-plugin-jsdoc: 1.1.1 prismic-ts-codegen: ^0.1.17 size-limit: 8.2.4 ts-morph: 17.0.1 @@ -8185,15 +8183,14 @@ __metadata: "@size-limit/preset-small-lib": 8.2.4 "@slicemachine/plugin-kit": "workspace:^" "@types/common-tags": 1.8.1 - "@types/prettier": 2.7.2 "@typescript-eslint/eslint-plugin": 5.55.0 "@typescript-eslint/parser": 5.55.0 "@vitest/coverage-v8": 0.32.0 common-tags: ^1.8.2 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 fp-ts: ^2.13.1 io-ts: ^2.2.20 @@ -8204,8 +8201,8 @@ __metadata: node-fetch: ^3.3.1 nuxt: 3.3.3 pascal-case: ^3.1.2 - prettier: 2.8.4 - prettier-plugin-jsdoc: 0.4.2 + prettier: 3.0.3 + prettier-plugin-jsdoc: 1.1.1 prismic-ts-codegen: ^0.1.17 size-limit: 8.2.4 ts-morph: 17.0.1 @@ -8239,8 +8236,8 @@ __metadata: concurrently: 8.2.1 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-svelte: 2.33.0 eslint-plugin-tsdoc: 0.2.17 fp-ts: ^2.13.1 @@ -8250,9 +8247,9 @@ __metadata: newtype-ts: ^0.3.5 node-fetch: ^3.3.1 pascal-case: ^3.1.2 - prettier: 2.8.4 - prettier-plugin-jsdoc: 0.4.2 - prettier-plugin-svelte: ^2.10.1 + prettier: 3.0.3 + prettier-plugin-jsdoc: 1.1.1 + prettier-plugin-svelte: ^3.0.3 prismic-ts-codegen: ^0.1.17 size-limit: 8.2.4 svelte: 4.2.0 @@ -8285,8 +8282,8 @@ __metadata: chalk: ^4.1.2 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 execa: 7.1.1 giget: ^1.1.2 @@ -8300,8 +8297,8 @@ __metadata: msw: 1.1.0 open: ^8.4.2 parse-multipart-data: 1.5.0 - prettier: 2.8.4 - prettier-plugin-jsdoc: 0.4.2 + prettier: 3.0.3 + prettier-plugin-jsdoc: 1.1.1 prompts: ^2.4.2 semver: ^7.3.8 size-limit: 8.2.4 @@ -8338,8 +8335,8 @@ __metadata: cors: ^2.8.5 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 execa: ^7.1.1 express: 4.18.2 @@ -8359,8 +8356,8 @@ __metadata: node-fetch: ^3.3.1 p-limit: ^4.0.0 parse-multipart-data: 1.5.0 - prettier: ^2.8.4 - prettier-plugin-jsdoc: 0.4.2 + prettier: ^3.0.3 + prettier-plugin-jsdoc: 1.1.1 r19: ^0.1.7 rc9: ^2.0.1 rehype-stringify: ^9.0.3 @@ -8391,7 +8388,6 @@ __metadata: "@size-limit/preset-small-lib": 8.2.4 "@types/common-tags": 1.8.1 "@types/fs-extra": 11.0.1 - "@types/prettier": 2.7.2 "@typescript-eslint/eslint-plugin": 5.55.0 "@typescript-eslint/parser": 5.55.0 "@vitest/coverage-v8": 0.32.0 @@ -8399,8 +8395,8 @@ __metadata: defu: ^6.1.2 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 fp-ts: ^2.13.1 fs-extra: 11.1.1 @@ -8409,9 +8405,9 @@ __metadata: io-ts-types: 0.5.19 monocle-ts: 2.3.13 newtype-ts: 0.3.5 - prettier: ^2.8.4 - prettier-plugin-jsdoc: 0.4.2 - prismic-ts-codegen: ^0.1.17 + prettier: ^3.0.3 + prettier-plugin-jsdoc: 1.1.1 + prismic-ts-codegen: ^0.1.19 size-limit: 8.2.4 typescript: 4.9.5 vite: 4.3.9 @@ -10400,6 +10396,15 @@ __metadata: languageName: node linkType: hard +"@types/mdast@npm:^4.0.0": + version: 4.0.2 + resolution: "@types/mdast@npm:4.0.2" + dependencies: + "@types/unist": "*" + checksum: d13c161b698614d55ef6f85acedee1cab15515555e507cebb828db2fbbdec49a5db6481918e4acd5f466805024007a53106aa4f9eaed9c6be6e3b9eb4edb1730 + languageName: node + linkType: hard + "@types/mdx@npm:^2.0.0": version: 2.0.5 resolution: "@types/mdx@npm:2.0.5" @@ -10545,13 +10550,6 @@ __metadata: languageName: node linkType: hard -"@types/prettier@npm:2.7.2": - version: 2.7.2 - resolution: "@types/prettier@npm:2.7.2" - checksum: b47d76a5252265f8d25dd2fe2a5a61dc43ba0e6a96ffdd00c594cb4fd74c1982c2e346497e3472805d97915407a09423804cc2110a0b8e1b22cffcab246479b7 - languageName: node - linkType: hard - "@types/pretty-hrtime@npm:^1.0.0": version: 1.0.1 resolution: "@types/pretty-hrtime@npm:1.0.1" @@ -10836,6 +10834,13 @@ __metadata: languageName: node linkType: hard +"@types/unist@npm:^3.0.0": + version: 3.0.1 + resolution: "@types/unist@npm:3.0.1" + checksum: 5692b9b271724d4ab6434f125350436bb35eb8ffdaeb5b762c7282870be9562f364bc49016e4b25afb442b68ad9ee042a262c093af07738af6b8a9b858335e37 + languageName: node + linkType: hard + "@types/use-sync-external-store@npm:^0.0.3": version: 0.0.3 resolution: "@types/use-sync-external-store@npm:0.0.3" @@ -14773,10 +14778,10 @@ __metadata: languageName: node linkType: hard -"comment-parser@npm:^1.3.1": - version: 1.3.1 - resolution: "comment-parser@npm:1.3.1" - checksum: 421e6a113a3afd548500e7174ab46a2049dccf92e82bbaa3b209031b1bdf97552aabfa1ae2a120c0b62df17e1ba70e0d8b05d68504fee78e1ef974c59bcfe718 +"comment-parser@npm:^1.4.0": + version: 1.4.0 + resolution: "comment-parser@npm:1.4.0" + checksum: e086da3b14af9455177f1ab801bc54de9139a77fcef55dbfb751ae68d687ac83b0effb83d113ccf8cd217d9d93ce2b472002953cac342092a3fadfb9f5cd8e38 languageName: node linkType: hard @@ -16479,6 +16484,15 @@ __metadata: languageName: node linkType: hard +"devlop@npm:^1.0.0": + version: 1.1.0 + resolution: "devlop@npm:1.1.0" + dependencies: + dequal: ^2.0.0 + checksum: d2ff650bac0bb6ef08c48f3ba98640bb5fec5cce81e9957eb620408d1bab1204d382a45b785c6b3314dc867bb0684936b84c6867820da6db97cbb5d3c15dd185 + languageName: node + linkType: hard + "didyoumean@npm:^1.2.2": version: 1.2.2 resolution: "didyoumean@npm:1.2.2" @@ -17387,14 +17401,14 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:8.7.0": - version: 8.7.0 - resolution: "eslint-config-prettier@npm:8.7.0" +"eslint-config-prettier@npm:9.0.0, eslint-config-prettier@npm:^9.0.0": + version: 9.0.0 + resolution: "eslint-config-prettier@npm:9.0.0" peerDependencies: eslint: ">=7.0.0" bin: eslint-config-prettier: bin/cli.js - checksum: b05bc7f2296ce3e0925c14147849706544870e0382d38af2352d709a6cf8521bdaff2bd8e5021f1780e570775a8ffa1d2bac28b8065d90d43a3f1f98fd26ce52 + checksum: 362e991b6cb343f79362bada2d97c202e5303e6865888918a7445c555fb75e4c078b01278e90be98aa98ae22f8597d8e93d48314bec6824f540f7efcab3ce451 languageName: node linkType: hard @@ -17509,18 +17523,22 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-prettier@npm:4.2.1": - version: 4.2.1 - resolution: "eslint-plugin-prettier@npm:4.2.1" +"eslint-plugin-prettier@npm:5.0.1": + version: 5.0.1 + resolution: "eslint-plugin-prettier@npm:5.0.1" dependencies: prettier-linter-helpers: ^1.0.0 + synckit: ^0.8.5 peerDependencies: - eslint: ">=7.28.0" - prettier: ">=2.0.0" + "@types/eslint": ">=8.0.0" + eslint: ">=8.0.0" + prettier: ">=3.0.0" peerDependenciesMeta: + "@types/eslint": + optional: true eslint-config-prettier: optional: true - checksum: b9e839d2334ad8ec7a5589c5cb0f219bded260839a857d7a486997f9870e95106aa59b8756ff3f37202085ebab658de382b0267cae44c3a7f0eb0bcc03a4f6d6 + checksum: c2261033b97bafe99ccb7cc47c2fac6fa85b8bbc8b128042e52631f906b69e12afed2cdd9d7e3021cc892ee8dd4204a3574e1f32a0b718b4bb3b440944b6983b languageName: node linkType: hard @@ -23202,7 +23220,7 @@ __metadata: languageName: node linkType: hard -"mdast-util-from-markdown@npm:^1.0.0, mdast-util-from-markdown@npm:^1.2.0": +"mdast-util-from-markdown@npm:^1.0.0": version: 1.3.1 resolution: "mdast-util-from-markdown@npm:1.3.1" dependencies: @@ -23222,6 +23240,26 @@ __metadata: languageName: node linkType: hard +"mdast-util-from-markdown@npm:^2.0.0": + version: 2.0.0 + resolution: "mdast-util-from-markdown@npm:2.0.0" + dependencies: + "@types/mdast": ^4.0.0 + "@types/unist": ^3.0.0 + decode-named-character-reference: ^1.0.0 + devlop: ^1.0.0 + mdast-util-to-string: ^4.0.0 + micromark: ^4.0.0 + micromark-util-decode-numeric-character-reference: ^2.0.0 + micromark-util-decode-string: ^2.0.0 + micromark-util-normalize-identifier: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + unist-util-stringify-position: ^4.0.0 + checksum: 4e8d8a46b4b588486c41b80c39da333a91593bc8d60cd7421c6cd3c22003b8e5a62478292fb7bc97b9255b6301a2250cca32340ef43c309156e215453c5b92be + languageName: node + linkType: hard + "mdast-util-gfm-autolink-literal@npm:^1.0.0": version: 1.0.3 resolution: "mdast-util-gfm-autolink-literal@npm:1.0.3" @@ -23350,6 +23388,15 @@ __metadata: languageName: node linkType: hard +"mdast-util-to-string@npm:^4.0.0": + version: 4.0.0 + resolution: "mdast-util-to-string@npm:4.0.0" + dependencies: + "@types/mdast": ^4.0.0 + checksum: 35489fb5710d58cbc2d6c8b6547df161a3f81e0f28f320dfb3548a9393555daf07c310c0c497708e67ed4dfea4a06e5655799e7d631ca91420c288b4525d6c29 + languageName: node + linkType: hard + "mdn-data@npm:2.0.14": version: 2.0.14 resolution: "mdn-data@npm:2.0.14" @@ -23575,6 +23622,30 @@ __metadata: languageName: node linkType: hard +"micromark-core-commonmark@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-core-commonmark@npm:2.0.0" + dependencies: + decode-named-character-reference: ^1.0.0 + devlop: ^1.0.0 + micromark-factory-destination: ^2.0.0 + micromark-factory-label: ^2.0.0 + micromark-factory-space: ^2.0.0 + micromark-factory-title: ^2.0.0 + micromark-factory-whitespace: ^2.0.0 + micromark-util-character: ^2.0.0 + micromark-util-chunked: ^2.0.0 + micromark-util-classify-character: ^2.0.0 + micromark-util-html-tag-name: ^2.0.0 + micromark-util-normalize-identifier: ^2.0.0 + micromark-util-resolve-all: ^2.0.0 + micromark-util-subtokenize: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 9c12fb580cf4ce71f60872043bd2794efe129f44d7b2b73afa155bbc0a66b7bc35655ba8cef438a6bd068441837ed3b6dc6ad7e5a18f815462c1750793e03a42 + languageName: node + linkType: hard + "micromark-extension-gfm-autolink-literal@npm:^1.0.0": version: 1.0.5 resolution: "micromark-extension-gfm-autolink-literal@npm:1.0.5" @@ -23679,6 +23750,17 @@ __metadata: languageName: node linkType: hard +"micromark-factory-destination@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-factory-destination@npm:2.0.0" + dependencies: + micromark-util-character: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: d36e65ed1c072ff4148b016783148ba7c68a078991154625723e24bda3945160268fb91079fb28618e1613c2b6e70390a8ddc544c45410288aa27b413593071a + languageName: node + linkType: hard + "micromark-factory-label@npm:^1.0.0": version: 1.1.0 resolution: "micromark-factory-label@npm:1.1.0" @@ -23691,6 +23773,18 @@ __metadata: languageName: node linkType: hard +"micromark-factory-label@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-factory-label@npm:2.0.0" + dependencies: + devlop: ^1.0.0 + micromark-util-character: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: c021dbd0ed367610d35f2bae21209bc804d1a6d1286ffce458fd6a717f4d7fe581a7cba7d5c2d7a63757c44eb927c80d6a571d6ea7969fae1b48ab6461d109c4 + languageName: node + linkType: hard + "micromark-factory-space@npm:^1.0.0": version: 1.1.0 resolution: "micromark-factory-space@npm:1.1.0" @@ -23701,6 +23795,16 @@ __metadata: languageName: node linkType: hard +"micromark-factory-space@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-factory-space@npm:2.0.0" + dependencies: + micromark-util-character: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 4ffdcdc2f759887bbb356500cb460b3915ecddcb5d85c3618d7df68ad05d13ed02b1153ee1845677b7d8126df8f388288b84fcf0d943bd9c92bcc71cd7222e37 + languageName: node + linkType: hard + "micromark-factory-title@npm:^1.0.0": version: 1.1.0 resolution: "micromark-factory-title@npm:1.1.0" @@ -23713,6 +23817,18 @@ __metadata: languageName: node linkType: hard +"micromark-factory-title@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-factory-title@npm:2.0.0" + dependencies: + micromark-factory-space: ^2.0.0 + micromark-util-character: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 39e1ac23af3554e6e652e56065579bc7faf21ade7b8704b29c175871b4152b7109b790bb3cae0f7e088381139c6bac9553b8400772c3d322e4fa635f813a3578 + languageName: node + linkType: hard + "micromark-factory-whitespace@npm:^1.0.0": version: 1.1.0 resolution: "micromark-factory-whitespace@npm:1.1.0" @@ -23725,6 +23841,18 @@ __metadata: languageName: node linkType: hard +"micromark-factory-whitespace@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-factory-whitespace@npm:2.0.0" + dependencies: + micromark-factory-space: ^2.0.0 + micromark-util-character: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 9587c2546d1a58b4d5472b42adf05463f6212d0449455285662d63cd8eaed89c6b159ac82713fcee5f9dd88628c24307d9533cccd8971a2f3f4d48702f8f850a + languageName: node + linkType: hard + "micromark-util-character@npm:^1.0.0": version: 1.2.0 resolution: "micromark-util-character@npm:1.2.0" @@ -23735,6 +23863,16 @@ __metadata: languageName: node linkType: hard +"micromark-util-character@npm:^2.0.0": + version: 2.0.1 + resolution: "micromark-util-character@npm:2.0.1" + dependencies: + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 318d6e16fdcbe9d89e18b8e7796568d986abbb10a9f3037b7ac9b92a236bcc962f3cd380e26a7c49df40fd1d9ca33eb546268956345b662f4c4ca4962c7695f2 + languageName: node + linkType: hard + "micromark-util-chunked@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-chunked@npm:1.1.0" @@ -23744,6 +23882,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-chunked@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-chunked@npm:2.0.0" + dependencies: + micromark-util-symbol: ^2.0.0 + checksum: 324f95cccdae061332a8241936eaba6ef0782a1e355bac5c607ad2564fd3744929be7dc81651315a2921535747a33243e6a5606bcb64b7a56d49b6d74ea1a3d4 + languageName: node + linkType: hard + "micromark-util-classify-character@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-classify-character@npm:1.1.0" @@ -23755,6 +23902,17 @@ __metadata: languageName: node linkType: hard +"micromark-util-classify-character@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-classify-character@npm:2.0.0" + dependencies: + micromark-util-character: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 086e52904deffebb793fb1c08c94aabb8901f76958142dfc3a6282890ebaa983b285e69bd602b9d507f1b758ed38e75a994d2ad9fbbefa7de2584f67a16af405 + languageName: node + linkType: hard + "micromark-util-combine-extensions@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-combine-extensions@npm:1.1.0" @@ -23765,6 +23923,16 @@ __metadata: languageName: node linkType: hard +"micromark-util-combine-extensions@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-combine-extensions@npm:2.0.0" + dependencies: + micromark-util-chunked: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 107c47700343f365b4ed81551e18bc3458b573c500e56ac052b2490bd548adc475216e41d2271633a8867fac66fc22ba3e0a2d74a31ed79b9870ca947eb4e3ba + languageName: node + linkType: hard + "micromark-util-decode-numeric-character-reference@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-decode-numeric-character-reference@npm:1.1.0" @@ -23774,6 +23942,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-decode-numeric-character-reference@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-decode-numeric-character-reference@npm:2.0.0" + dependencies: + micromark-util-symbol: ^2.0.0 + checksum: 705715a2dd6f10d85c69371b4176a0b2fec5811a14f7d26f66f358ac5adebb12975f79597b1a1a184a6dcf6799319f7cf8eb91398e47c1faa2cab2c84f155b78 + languageName: node + linkType: hard + "micromark-util-decode-string@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-decode-string@npm:1.1.0" @@ -23786,6 +23963,18 @@ __metadata: languageName: node linkType: hard +"micromark-util-decode-string@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-decode-string@npm:2.0.0" + dependencies: + decode-named-character-reference: ^1.0.0 + micromark-util-character: ^2.0.0 + micromark-util-decode-numeric-character-reference: ^2.0.0 + micromark-util-symbol: ^2.0.0 + checksum: a75daf32a4a6b549e9f19b4d833ebfeb09a32a9a1f9ce50f35dec6b6a3e4f9f121f49024ba7f9c91c55ebe792f7c7a332fc9604795181b6a612637df0df5b959 + languageName: node + linkType: hard + "micromark-util-encode@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-encode@npm:1.1.0" @@ -23793,6 +23982,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-encode@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-encode@npm:2.0.0" + checksum: 853a3f33fce72aaf4ffa60b7f2b6fcfca40b270b3466e1b96561b02185d2bd8c01dd7948bc31a24ac014f4cc854e545ca9a8e9cf7ea46262f9d24c9e88551c66 + languageName: node + linkType: hard + "micromark-util-html-tag-name@npm:^1.0.0": version: 1.2.0 resolution: "micromark-util-html-tag-name@npm:1.2.0" @@ -23800,6 +23996,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-html-tag-name@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-html-tag-name@npm:2.0.0" + checksum: d786d4486f93eb0ac5b628779809ca97c5dc60f3c9fc03eb565809831db181cf8cb7f05f9ac76852f3eb35461af0f89fa407b46f3a03f4f97a96754d8dc540d8 + languageName: node + linkType: hard + "micromark-util-normalize-identifier@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-normalize-identifier@npm:1.1.0" @@ -23809,6 +24012,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-normalize-identifier@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-normalize-identifier@npm:2.0.0" + dependencies: + micromark-util-symbol: ^2.0.0 + checksum: b36da2d3fd102053dadd953ce5c558328df12a63a8ac0e5aad13d4dda8e43b6a5d4a661baafe0a1cd8a260bead4b4a8e6e0e74193dd651e8484225bd4f4e68aa + languageName: node + linkType: hard + "micromark-util-resolve-all@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-resolve-all@npm:1.1.0" @@ -23818,6 +24030,15 @@ __metadata: languageName: node linkType: hard +"micromark-util-resolve-all@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-resolve-all@npm:2.0.0" + dependencies: + micromark-util-types: ^2.0.0 + checksum: 31fe703b85572cb3f598ebe32750e59516925c7ff1f66cfe6afaebe0771a395a9eaa770787f2523d3c46082ea80e6c14f83643303740b3d650af7c96ebd30ccc + languageName: node + linkType: hard + "micromark-util-sanitize-uri@npm:^1.0.0, micromark-util-sanitize-uri@npm:^1.1.0": version: 1.2.0 resolution: "micromark-util-sanitize-uri@npm:1.2.0" @@ -23829,6 +24050,17 @@ __metadata: languageName: node linkType: hard +"micromark-util-sanitize-uri@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-sanitize-uri@npm:2.0.0" + dependencies: + micromark-util-character: ^2.0.0 + micromark-util-encode: ^2.0.0 + micromark-util-symbol: ^2.0.0 + checksum: ea4c28bbffcf2430e9aff2d18554296789a8b0a1f54ac24020d1dde76624a7f93e8f2a83e88cd5a846b6d2c4287b71b1142d1b89fa7f1b0363a9b33711a141fe + languageName: node + linkType: hard + "micromark-util-subtokenize@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-subtokenize@npm:1.1.0" @@ -23841,6 +24073,18 @@ __metadata: languageName: node linkType: hard +"micromark-util-subtokenize@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-subtokenize@npm:2.0.0" + dependencies: + devlop: ^1.0.0 + micromark-util-chunked: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: 77d9c7d59c05a20468d49ce2a3640e9cb268c083ccad02322f26c84e1094c25b44f4b8139ef0a247ca11a4fef7620c5bf82fbffd98acdb2989e79cbe7bd8f1db + languageName: node + linkType: hard + "micromark-util-symbol@npm:^1.0.0": version: 1.1.0 resolution: "micromark-util-symbol@npm:1.1.0" @@ -23848,6 +24092,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-symbol@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-symbol@npm:2.0.0" + checksum: fa4a05bff575d9fbf0ad96a1013003e3bb6087ed6b34b609a141b6c0d2137b57df594aca409a95f4c5fda199f227b56a7d8b1f82cea0768df161d8a3a3660764 + languageName: node + linkType: hard + "micromark-util-types@npm:^1.0.0, micromark-util-types@npm:^1.0.1": version: 1.1.0 resolution: "micromark-util-types@npm:1.1.0" @@ -23855,6 +24106,13 @@ __metadata: languageName: node linkType: hard +"micromark-util-types@npm:^2.0.0": + version: 2.0.0 + resolution: "micromark-util-types@npm:2.0.0" + checksum: 819fef3ab5770c37893d2a60381fb2694396c8d22803b6e103c830c3a1bc1490363c2b0470bb2acaaddad776dfbc2fc1fcfde39cb63c4f54d95121611672e3d0 + languageName: node + linkType: hard + "micromark@npm:^3.0.0": version: 3.2.0 resolution: "micromark@npm:3.2.0" @@ -23880,6 +24138,31 @@ __metadata: languageName: node linkType: hard +"micromark@npm:^4.0.0": + version: 4.0.0 + resolution: "micromark@npm:4.0.0" + dependencies: + "@types/debug": ^4.0.0 + debug: ^4.0.0 + decode-named-character-reference: ^1.0.0 + devlop: ^1.0.0 + micromark-core-commonmark: ^2.0.0 + micromark-factory-space: ^2.0.0 + micromark-util-character: ^2.0.0 + micromark-util-chunked: ^2.0.0 + micromark-util-combine-extensions: ^2.0.0 + micromark-util-decode-numeric-character-reference: ^2.0.0 + micromark-util-encode: ^2.0.0 + micromark-util-normalize-identifier: ^2.0.0 + micromark-util-resolve-all: ^2.0.0 + micromark-util-sanitize-uri: ^2.0.0 + micromark-util-subtokenize: ^2.0.0 + micromark-util-symbol: ^2.0.0 + micromark-util-types: ^2.0.0 + checksum: b84ab5ab1a0b28c063c52e9c2c9d7d44b954507235c10c9492d66e0b38f7de24bf298f914a1fbdf109f2a57a88cf0412de217c84cfac5fd60e3e42a74dbac085 + languageName: node + linkType: hard + "micromatch@npm:^3.1.10, micromatch@npm:^3.1.4": version: 3.1.10 resolution: "micromatch@npm:3.1.10" @@ -27836,39 +28119,39 @@ __metadata: languageName: node linkType: hard -"prettier-plugin-jsdoc@npm:0.4.2": - version: 0.4.2 - resolution: "prettier-plugin-jsdoc@npm:0.4.2" +"prettier-plugin-jsdoc@npm:1.1.1": + version: 1.1.1 + resolution: "prettier-plugin-jsdoc@npm:1.1.1" dependencies: binary-searching: ^2.0.5 - comment-parser: ^1.3.1 - mdast-util-from-markdown: ^1.2.0 + comment-parser: ^1.4.0 + mdast-util-from-markdown: ^2.0.0 peerDependencies: - prettier: ">=2.1.2" - checksum: 38a6cec56f49aa1572296c9247295103e13248643a28797269b17f9a4a463ffef110dee581137e0676aea5daa5e5862ce4049be4b0b0d74fe68a86fffa2c35af + prettier: ^3.0.0 + checksum: a4601863a3774caa1b964ad4539fcabf818145fb094ad2971664655cc1576c7858bbde026f114cd83672c953516cc6ac2c88bd498307c19cea9136e377c29e2d languageName: node linkType: hard -"prettier-plugin-svelte@npm:^2.10.1": - version: 2.10.1 - resolution: "prettier-plugin-svelte@npm:2.10.1" +"prettier-plugin-svelte@npm:^3.0.3": + version: 3.0.3 + resolution: "prettier-plugin-svelte@npm:3.0.3" peerDependencies: - prettier: ^1.16.4 || ^2.0.0 + prettier: ^3.0.0 svelte: ^3.2.0 || ^4.0.0-next.0 - checksum: 45f7993098d9f4be7b1c8f61ebce0161996bb6030dc4883ec3d6d9cff552f2cfb5da41ba20e01349709e793b83faaad2dfe81789cd7e17a610f0134df2743266 + checksum: 411e50afabb5925bd73e85d35f989f3ffbd9b96764aebe733ea03f0b0eeb8add5a7452d5c1e68a1dff20b8615f99fa2c92db62f2d8b7d892325bdb587284f46e languageName: node linkType: hard -"prettier@npm:2.8.4": - version: 2.8.4 - resolution: "prettier@npm:2.8.4" +"prettier@npm:3.0.3, prettier@npm:^3.0.3": + version: 3.0.3 + resolution: "prettier@npm:3.0.3" bin: - prettier: bin-prettier.js - checksum: c173064bf3df57b6d93d19aa98753b9b9dd7657212e33b41ada8e2e9f9884066bb9ca0b4005b89b3ab137efffdf8fbe0b462785aba20364798ff4303aadda57e + prettier: bin/prettier.cjs + checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0 languageName: node linkType: hard -"prettier@npm:^1.18.2 || ^2.0.0, prettier@npm:^2.8.0, prettier@npm:^2.8.4": +"prettier@npm:^1.18.2 || ^2.0.0, prettier@npm:^2.8.0": version: 2.8.8 resolution: "prettier@npm:2.8.8" bin: @@ -27964,6 +28247,33 @@ __metadata: languageName: node linkType: hard +"prismic-ts-codegen@npm:^0.1.19": + version: 0.1.19 + resolution: "prismic-ts-codegen@npm:0.1.19" + dependencies: + "@prismicio/custom-types-client": ^1.1.0 + common-tags: ^1.8.2 + fast-glob: ^3.2.12 + jiti: ^1.18.2 + joi: ^17.9.2 + meow: ^12.0.1 + node-fetch: ^3.3.1 + pascal-case: ^3.1.2 + quick-lru: ^6.1.1 + peerDependencies: + "@prismicio/client": ^6.6 || ^7 + "@prismicio/types": ^0.2.8 + peerDependenciesMeta: + "@prismicio/client": + optional: true + "@prismicio/types": + optional: true + bin: + prismic-ts-codegen: bin/prismic-ts-codegen.js + checksum: 18fdb161d276170786cf2a0300250f32a372810cb5fa8d2810e8c894249e162a8d918a4d0b61ba19196eab9e09c022b4a2a06fe33c0dd669c93f4b1cc12c19c8 + languageName: node + linkType: hard + "prismjs@npm:^1.27.0": version: 1.29.0 resolution: "prismjs@npm:1.29.0" @@ -30062,7 +30372,7 @@ __metadata: husky: 8.0.3 lerna: 7.0.2 lint-staged: 13.2.0 - prettier: 2.8.4 + prettier: 3.0.3 start-server-and-test: 1.15.5 dependenciesMeta: "@sentry/cli": @@ -30815,7 +31125,7 @@ __metadata: cross-env: 7.0.3 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 + eslint-config-prettier: 9.0.0 eslint-import-resolver-typescript: 3.5.3 eslint-plugin-import: 2.27.5 eslint-plugin-react-hooks: 4.6.0 @@ -31315,8 +31625,8 @@ __metadata: cors: ^2.8.5 depcheck: 1.4.3 eslint: 8.37.0 - eslint-config-prettier: 8.7.0 - eslint-plugin-prettier: 4.2.1 + eslint-config-prettier: 9.0.0 + eslint-plugin-prettier: 5.0.1 eslint-plugin-tsdoc: 0.2.17 express: ^4.18.2 fp-ts: ^2.13.1 @@ -31329,8 +31639,8 @@ __metadata: node-fetch: ^3.3.1 nodemon: 2.0.22 open: ^8.4.2 - prettier: 2.8.4 - prettier-plugin-jsdoc: 0.4.2 + prettier: 3.0.3 + prettier-plugin-jsdoc: 1.1.1 serve-static: ^1.15.0 size-limit: 8.2.4 typescript: 4.9.5 @@ -32038,10 +32348,10 @@ __metadata: "@typescript-eslint/eslint-plugin": ^5.45.0 "@typescript-eslint/parser": ^5.45.0 eslint: ^8.28.0 - eslint-config-prettier: 8.7.0 + eslint-config-prettier: ^9.0.0 eslint-plugin-svelte: ^2.30.0 - prettier: 2.8.4 - prettier-plugin-svelte: ^2.10.1 + prettier: ^3.0.3 + prettier-plugin-svelte: ^3.0.3 slice-machine-ui: "workspace:*" svelte: ^4.0.5 svelte-check: ^3.4.3 @@ -33354,6 +33664,15 @@ __metadata: languageName: node linkType: hard +"unist-util-stringify-position@npm:^4.0.0": + version: 4.0.0 + resolution: "unist-util-stringify-position@npm:4.0.0" + dependencies: + "@types/unist": ^3.0.0 + checksum: e2e7aee4b92ddb64d314b4ac89eef7a46e4c829cbd3ee4aee516d100772b490eb6b4974f653ba0717a0071ca6ea0770bf22b0a2ea62c65fcba1d071285e96324 + languageName: node + linkType: hard + "unist-util-visit-parents@npm:^3.0.0": version: 3.1.1 resolution: "unist-util-visit-parents@npm:3.1.1"