Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency prettier to v3 #3137

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changeset/shiny-seahorses-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@commercetools-applications/merchant-center-custom-view-template-starter-typescript': patch
'@commercetools-applications/merchant-center-template-starter-typescript': patch
'@commercetools-frontend/application-shell-connectors': patch
'@commercetools-backend/eslint-config-node': patch
'@commercetools-frontend/application-components': patch
'@commercetools-applications/merchant-center-custom-view-template-starter': patch
'@commercetools-applications/merchant-center-template-starter': patch
'@commercetools-frontend/eslint-config-mc-app': patch
'@commercetools-frontend/application-config': patch
'@commercetools-frontend/application-shell': patch
'@commercetools-backend/express': patch
'@commercetools-frontend/actions-global': patch
'@commercetools-frontend/create-mc-app': patch
'@commercetools-frontend/permissions': patch
'@commercetools-frontend/mc-scripts': patch
'@commercetools-frontend/constants': patch
'@commercetools-local/visual-testing-app': patch
'@commercetools-frontend/codemod': patch
'@commercetools-frontend/l10n': patch
'@commercetools-local/playground': patch
---

Ugrade prettier to v3
2 changes: 1 addition & 1 deletion application-templates/starter-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"moment": "^2.29.4",
"msw": "0.49.3",
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"prettier": "3.3.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^6.4.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ describe('rendering', () => {
useMockServerHandlers([fetchChannelDetailsQueryHandler]);
renderApp();

const keyInput: HTMLInputElement = await screen.findByLabelText(
/channel key/i
);
const keyInput: HTMLInputElement =
await screen.findByLabelText(/channel key/i);
expect(keyInput.value).toBe(TEST_CHANNEL_KEY);

screen.getByRole('combobox', { name: /channel roles/i });
Expand All @@ -184,9 +183,8 @@ describe('rendering', () => {
});
expect(resetButton).toBeDisabled();

const keyInput: HTMLInputElement = await screen.findByLabelText(
/channel key/i
);
const keyInput: HTMLInputElement =
await screen.findByLabelText(/channel key/i);
expect(keyInput.value).toBe(TEST_CHANNEL_KEY);

fireEvent.change(keyInput, {
Expand Down Expand Up @@ -238,9 +236,8 @@ describe('rendering', () => {
]);
renderApp();

const keyInput: HTMLInputElement = await screen.findByLabelText(
/channel key/i
);
const keyInput: HTMLInputElement =
await screen.findByLabelText(/channel key/i);

fireEvent.change(keyInput, {
target: { value: TEST_CHANNEL_NEW_KEY },
Expand All @@ -262,9 +259,8 @@ describe('notifications', () => {
]);
renderApp();

const keyInput: HTMLInputElement = await screen.findByLabelText(
/channel key/i
);
const keyInput: HTMLInputElement =
await screen.findByLabelText(/channel key/i);
expect(keyInput.value).toBe(TEST_CHANNEL_KEY);

fireEvent.change(keyInput, {
Expand Down
2 changes: 1 addition & 1 deletion application-templates/starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"moment": "^2.29.4",
"msw": "0.49.3",
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"prettier": "3.3.3",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { lazy } from 'react';

const ChannelDetails = lazy(() =>
import('./channel-details' /* webpackChunkName: "channel-details" */)
const ChannelDetails = lazy(
() => import('./channel-details' /* webpackChunkName: "channel-details" */)
);

export default ChannelDetails;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { lazy } from 'react';

const Channels = lazy(() =>
import('./channels' /* webpackChunkName: "channels" */)
const Channels = lazy(
() => import('./channels' /* webpackChunkName: "channels" */)
);

export default Channels;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { lazy } from 'react';

const Welcome = lazy(() =>
import('./welcome' /* webpackChunkName: "welcome" */)
const Welcome = lazy(
() => import('./welcome' /* webpackChunkName: "welcome" */)
);

export default Welcome;
2 changes: 1 addition & 1 deletion custom-views-templates/starter-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"moment": "^2.29.4",
"msw": "0.49.3",
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"prettier": "3.3.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^6.4.7",
Expand Down
2 changes: 1 addition & 1 deletion custom-views-templates/starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"moment": "^2.29.4",
"msw": "0.49.3",
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"prettier": "3.3.3",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { lazy } from 'react';

const Channels = lazy(() =>
import('./channels' /* webpackChunkName: "channels" */)
const Channels = lazy(
() => import('./channels' /* webpackChunkName: "channels" */)
);

export default Channels;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"lint-staged": "11.2.6",
"postcss": "8.4.38",
"postcss-load-config": "3.1.4",
"prettier": "2.8.8",
"prettier": "3.3.3",
"puppeteer": "20.9.0",
"qss": "2.0.3",
"react": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages-backend/eslint-config-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"@rushstack/eslint-patch": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-n": "^17.1.0",
"eslint-plugin-prettier": "^4.2.1"
"eslint-plugin-prettier": "^5.2.1"
},
"peerDependencies": {
"eslint": "8.x"
Expand Down
6 changes: 3 additions & 3 deletions packages-backend/express/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ function createSessionAuthVerifier<Request extends TBaseRequest>(

let issuer =
options.inferIssuer && cloudIdentifierHeader
? mapCloudIdentifierToIssuer<Request>(cloudIdentifierHeader) ??
configuredDefaultIssuer
? (mapCloudIdentifierToIssuer<Request>(cloudIdentifierHeader) ??
configuredDefaultIssuer)
: configuredDefaultIssuer;

// Get the `Accept-version` header, forwarded by the `/proxy/forward-to` endpoint.
Expand All @@ -179,7 +179,7 @@ function createSessionAuthVerifier<Request extends TBaseRequest>(

const requestUrlPath = options.getRequestUrl
? options.getRequestUrl(request)
: request.originalUrl ?? request.url;
: (request.originalUrl ?? request.url);

if (!requestUrlPath || !requestUrlPath.startsWith('/')) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion packages/actions-global/src/actions/show-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { addNotification } from '@commercetools-frontend/notifications';
import type { TShowNotification } from '../types';

export default function showNotification<
Notification extends TShowNotification
Notification extends TShowNotification,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the latest version of prettier has the required trailing comma by default everywhere which makes this notation even for generics.

I tried to disable the default and go back to the previous one (es5) but I can't make it work.

Not sure if we want to keep the new styling rule (I personally don't like it for generics) or if we should avoid it.

@commercetools/shield-team-fe what do you think?

>(notification: Notification, meta: TNotificationMetaOptions = {}) {
if (process.env.NODE_ENV !== 'production')
if (notification.domain) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type TNotificationHook<Notification extends TShowNotification> = (
* });
*/
function useShowNotification<
Notification extends TShowNotification
Notification extends TShowNotification,
>(): TNotificationHook<Notification>;
/**
* Dispatch a notification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ type TWrapperProps = {
const Wrapper = styled.div<TWrapperProps>`
height: ${(props) => (props.shouldRender ? COMPONENT_HEIGHT : '0')};
overflow: hidden;
transition: margin 0.3s ease-in-out, height 0.3s ease-in-out;
transition:
margin 0.3s ease-in-out,
height 0.3s ease-in-out;
margin: ${(props) => (props.shouldRender ? props.margin : '0')};
`;

Expand Down
10 changes: 5 additions & 5 deletions packages/application-config/src/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/c
import type { CamelCase } from './types';

type TImplicitCustomApplicationResourceAccesses<
PermissionGroupName extends string = ''
PermissionGroupName extends string = '',
> = Record<
| `view`
| `manage`
Expand All @@ -13,11 +13,11 @@ type TImplicitCustomApplicationResourceAccesses<
>;

type TImplicitCustomViewResourceAccesses<
PermissionGroupName extends string = ''
PermissionGroupName extends string = '',
> = TImplicitCustomApplicationResourceAccesses<PermissionGroupName>;

type TImplicitCustomApplicationPermissionKeys<
PermissionGroupName extends string = ''
PermissionGroupName extends string = '',
> = Record<
| `View`
| `Manage`
Expand Down Expand Up @@ -82,13 +82,13 @@ function entryPointUriPathToResourceAccesses(
entryPointUriPath: string
): TImplicitCustomApplicationResourceAccesses<''>;
function entryPointUriPathToResourceAccesses<
PermissionGroupName extends string
PermissionGroupName extends string,
>(
entryPointUriPath: string,
permissionGroupNames: PermissionGroupName[]
): TImplicitCustomApplicationResourceAccesses<PermissionGroupName>;
function entryPointUriPathToResourceAccesses<
PermissionGroupName extends string
PermissionGroupName extends string,
>(
entryPointUriPath: string,
permissionGroupNames?: PermissionGroupName[]
Expand Down
21 changes: 12 additions & 9 deletions packages/application-config/src/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,18 @@ const getPermissions = (
) => {
const additionalResourceAccessKeyToOauthScopeMap = (
appConfig.additionalOAuthScopes || []
).reduce((previousOauthScope, { name, view, manage }) => {
const formattedResourceKey =
formatEntryPointUriPathToResourceAccessKey(name);
return {
...previousOauthScope,
[`view${formattedResourceKey}`]: view,
[`manage${formattedResourceKey}`]: manage,
};
}, {} as Record<string, string[]>);
).reduce(
(previousOauthScope, { name, view, manage }) => {
const formattedResourceKey =
formatEntryPointUriPathToResourceAccessKey(name);
return {
...previousOauthScope,
[`view${formattedResourceKey}`]: view,
[`manage${formattedResourceKey}`]: manage,
};
},
{} as Record<string, string[]>
);

const additionalPermissionNames =
appConfig.additionalOAuthScopes?.map(({ name }) => name) || [];
Expand Down
26 changes: 13 additions & 13 deletions packages/application-config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type CustomViewData = {

// The object result after processing the config file
export type ApplicationRuntimeConfig<
AdditionalEnvironmentProperties extends {} = {}
AdditionalEnvironmentProperties extends {} = {},
> = {
data: CustomApplicationData | CustomViewData;
env: AdditionalEnvironmentProperties & ApplicationWindow['app'];
Expand Down Expand Up @@ -93,12 +93,12 @@ array = split(items, ',');
*/
export type Split<
S extends string,
Delimiter extends string
Delimiter extends string,
> = S extends `${infer Head}${Delimiter}${infer Tail}`
? [Head, ...Split<Tail, Delimiter>]
: S extends Delimiter
? []
: [S];
? []
: [S];

/**
Step by step takes the first item in an array literal, formats it and adds it to a string literal, and then recursively appends the remainder.
Expand All @@ -108,18 +108,18 @@ source: https://github.com/sindresorhus/type-fest/blob/fedbc441a314c1f9f5f6225c9
*/
type InnerCamelCaseStringArray<
Parts extends readonly unknown[],
PreviousPart
PreviousPart,
> = Parts extends [`${infer FirstPart}`, ...infer RemainingParts]
? FirstPart extends undefined
? ''
: FirstPart extends ''
? InnerCamelCaseStringArray<RemainingParts, PreviousPart>
: `${PreviousPart extends ''
? FirstPart
: Capitalize<FirstPart>}${InnerCamelCaseStringArray<
RemainingParts,
FirstPart
>}`
? InnerCamelCaseStringArray<RemainingParts, PreviousPart>
: `${PreviousPart extends ''
? FirstPart
: Capitalize<FirstPart>}${InnerCamelCaseStringArray<
RemainingParts,
FirstPart
>}`
: '';

/**
Expand All @@ -130,7 +130,7 @@ source: https://github.com/sindresorhus/type-fest/blob/fedbc441a314c1f9f5f6225c9
*/
type CamelCaseStringArray<Parts extends readonly string[]> = Parts extends [
`${infer FirstPart}`,
...infer RemainingParts
...infer RemainingParts,
]
? Uncapitalize<`${FirstPart}${InnerCamelCaseStringArray<
RemainingParts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const mapUserToApplicationContextUser = (user?: TFetchedUser) => {

// Adjust certain fields which depend e.g. on the origin
export const mapEnvironmentToApplicationContextEnvironment = <
AdditionalEnvironmentProperties extends {}
AdditionalEnvironmentProperties extends {},
>(
environment: AdditionalEnvironmentProperties & TApplicationContextEnvironment,
origin?: string
Expand Down Expand Up @@ -235,7 +235,7 @@ function withApplicationContext<
AdditionalEnvironmentProperties extends {},
MappedProps extends {} = {
applicationContext?: TApplicationContext<AdditionalEnvironmentProperties>;
}
},
>(
mapApplicationContextToProps?: (
context: TApplicationContext<AdditionalEnvironmentProperties>
Expand Down Expand Up @@ -264,11 +264,11 @@ function withApplicationContext<
// Use function overloading to declare two possible signatures with two
// distict return types, based on the selector function argument.
function useApplicationContextHook<
AdditionalEnvironmentProperties extends {} = {}
AdditionalEnvironmentProperties extends {} = {},
>(): TApplicationContext<AdditionalEnvironmentProperties>;
function useApplicationContextHook<
SelectedContext,
AdditionalEnvironmentProperties extends {} = {}
AdditionalEnvironmentProperties extends {} = {},
>(
selector: (
context: TApplicationContext<AdditionalEnvironmentProperties>
Expand All @@ -279,7 +279,7 @@ function useApplicationContextHook<
// based on the function arguments.
function useApplicationContextHook<
SelectedContext,
AdditionalEnvironmentProperties extends {} = {}
AdditionalEnvironmentProperties extends {} = {},
>(
selector?: (
context: TApplicationContext<AdditionalEnvironmentProperties>
Expand Down
Loading
Loading