Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Upgrade to prettier v3 (#1973)

Bogdan Chadkin886f839951ff
diff --git a/.prettierignore b/.prettierignore
index e2738673d8..a8a54fd998 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,2 +1,3 @@
pnpm-lock.yaml
packages/prisma-client/prisma/migrations/*/client
+*.d.ts
diff --git a/apps/builder/app/builder/features/style-panel/sections/shared/keyboard.ts b/apps/builder/app/builder/features/style-panel/sections/shared/keyboard.ts
index c902676a79..bbf5cecb99 100644
--- a/apps/builder/app/builder/features/style-panel/sections/shared/keyboard.ts
+++ b/apps/builder/app/builder/features/style-panel/sections/shared/keyboard.ts
@@ -76,9 +76,9 @@ export const useKeyboardNavigation = <
ArrowUp: P,
ArrowRight: P,
ArrowDown: P,
- ArrowLeft: P
+ ArrowLeft: P,
];
- }
+ },
>({
onOpen,
movementMap,
diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
index 170e99e353..f5ff740cb4 100644
--- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -54,7 +54,7 @@ const useScrub = ({
shouldHandleEvent?: (node: Node) => boolean;
}): [
React.MutableRefObject<HTMLDivElement | null>,
- React.MutableRefObject<HTMLInputElement | null>
+ React.MutableRefObject<HTMLInputElement | null>,
] => {
const scrubRef = useRef<HTMLDivElement | null>(null);
const inputRef = useRef<HTMLInputElement | null>(null);
diff --git a/apps/builder/app/shared/breakpoints/group-breakpoints.ts b/apps/builder/app/shared/breakpoints/group-breakpoints.ts
index 50b88e4ddf..28c5f245a0 100644
--- a/apps/builder/app/shared/breakpoints/group-breakpoints.ts
+++ b/apps/builder/app/shared/breakpoints/group-breakpoints.ts
@@ -3,7 +3,7 @@ import { isBaseBreakpoint } from "./is-base-breakpoint";
// We group in 3 groups: min-width, base (no min/max), max-width conditions
export const groupBreakpoints = <
- Breakpoint extends { minWidth?: number; maxWidth?: number }
+ Breakpoint extends { minWidth?: number; maxWidth?: number },
>(
breakpoints: Array<Breakpoint>
) => {
diff --git a/apps/builder/app/shared/store-utils.ts b/apps/builder/app/shared/store-utils.ts
index b6ac845e38..b0d1670596 100644
--- a/apps/builder/app/shared/store-utils.ts
+++ b/apps/builder/app/shared/store-utils.ts
@@ -12,7 +12,7 @@ type Comparable = Record<string, any> | any[] | null | undefined;
export const shallowComputed = <
Value extends Comparable,
- OriginStores extends AnyStore[]
+ OriginStores extends AnyStore[],
>(
stores: [...OriginStores],
cb: (...values: StoreValues<OriginStores>) => Value
diff --git a/package.json b/package.json
index dd00b0b108..b6fbabe696 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"@types/css-tree": "^2.3.1",
"@webstudio-is/eslint-config-custom": "workspace:^",
"nano-staged": "^0.8.0",
- "prettier": "2.8.7",
+ "prettier": "3.0.0",
"simple-git-hooks": "^2.8.1",
"storybook": "^7.1.0",
"tsx": "^3.12.6",
@@ -46,6 +46,7 @@
"*.{ts,tsx,js,json,css,md}": "prettier --write"
},
"prettier": {
+ "trailingComma": "es5",
"overrides": [
{
"files": [
diff --git a/packages/design-system/src/components/__DEPRECATED__/text-field.tsx b/packages/design-system/src/components/__DEPRECATED__/text-field.tsx
index da8c8200ca..9045937d61 100644
--- a/packages/design-system/src/components/__DEPRECATED__/text-field.tsx
+++ b/packages/design-system/src/components/__DEPRECATED__/text-field.tsx
@@ -222,7 +222,7 @@ export const useDeprecatedTextFieldFocus = ({
onBlur?: FocusEventHandler<HTMLInputElement>;
}): [
RefObject<HTMLInputElement>,
- ComponentProps<typeof DeprecatedTextFieldContainer>
+ ComponentProps<typeof DeprecatedTextFieldContainer>,
] => {
const ref = useRef<HTMLInputElement>(null);
diff --git a/packages/generate-arg-types/src/arg-types.ts b/packages/generate-arg-types/src/arg-types.ts
index ac7c2dbb05..fba41e0897 100644
--- a/packages/generate-arg-types/src/arg-types.ts
+++ b/packages/generate-arg-types/src/arg-types.ts
@@ -12,15 +12,18 @@ export const propsToArgTypes = (props: Record<string, PropItem>) => {
})
// Exclude webstudio builder props see react-sdk/src/tree/webstudio-component.tsx
.filter(([propName]) => propName.startsWith("data-ws-") === false)
- .reduce((result, current) => {
- const [propName, prop] = current;
+ .reduce(
+ (result, current) => {
+ const [propName, prop] = current;
- const argType = getArgType(prop);
- if (argType != null) {
- result[propName] = argType;
- }
- return result;
- }, {} as Record<string, PropMeta>)
+ const argType = getArgType(prop);
+ if (argType != null) {
+ result[propName] = argType;
+ }
+ return result;
+ },
+ {} as Record<string, PropMeta>
+ )
);
};
diff --git a/packages/generate-arg-types/src/cli.ts b/packages/generate-arg-types/src/cli.ts
index 2291a551ee..87aa6e7e80 100755
--- a/packages/generate-arg-types/src/cli.ts
+++ b/packages/generate-arg-types/src/cli.ts
@@ -69,8 +69,8 @@ for (const filePath of componentFiles) {
fileContent = `${fileContent}
export const props${componentName}: Record<string, PropMeta> = ${JSON.stringify(
- argTypes
- )}`;
+ argTypes
+ )}`;
}
}
diff --git a/packages/project-build/src/db/breakpoints.ts b/packages/project-build/src/db/breakpoints.ts
index 29a8822ddb..c0cdc0e7f8 100644
--- a/packages/project-build/src/db/breakpoints.ts
+++ b/packages/project-build/src/db/breakpoints.ts
@@ -25,7 +25,7 @@ export const serializeBreakpoints = (breakpointssMap: Breakpoints) => {
export const createInitialBreakpoints = (): [
Breakpoint["id"],
- Breakpoint
+ Breakpoint,
][] => {
return initialBreakpoints.map((breakpoint) => {
const id = nanoid();
diff --git a/packages/react-sdk/src/tree/webstudio-component.tsx b/packages/react-sdk/src/tree/webstudio-component.tsx
index a01d388c39..072914b4df 100644
--- a/packages/react-sdk/src/tree/webstudio-component.tsx
+++ b/packages/react-sdk/src/tree/webstudio-component.tsx
@@ -76,7 +76,7 @@ export type WebstudioAttributes = {
};
export const splitPropsWithWebstudioAttributes = <
- P extends WebstudioAttributes
+ P extends WebstudioAttributes,
>({
[idAttribute]: idAttributeValue,
[componentAttribute]: componentAttributeValue,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 82498c095f..d1a2837907 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -28,8 +28,8 @@ importers:
specifier: ^0.8.0
version: 0.8.0
prettier:
- specifier: 2.8.7
- version: 2.8.7
+ specifier: 3.0.0
+ version: 3.0.0
simple-git-hooks:
specifier: ^2.8.1
version: 2.8.1
@@ -13811,6 +13811,12 @@ packages:
engines: {node: '>=10.13.0'}
hasBin: true
+ resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==}
+ engines: {node: '>=14'}
+ hasBin: true
+ dev: true
+
resolution: {integrity: sha512-Rk753HI8f4uivXi4ZCIYdhmG1V+WKzvRMg/X+M42a6t7D07RcmopXJMDNk6N++7Bl75URRGsb40ruvg7Hcp2wQ==}
engines: {node: ^14.13.1 || >=16.0.0}