Merged in fix/3697-prettier-configs (pull request #3396)

fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Rasmus Langvad
2026-01-07 12:45:50 +00:00
parent 932413412b
commit d0546926a9
500 changed files with 18367 additions and 18419 deletions

View File

@@ -1,27 +1,27 @@
import { Toast } from './Toast'
import { Toast } from "./Toast"
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import { expect } from 'storybook/test'
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
import { expect } from "storybook/test"
import { config } from './variants.ts'
import { config } from "./variants.ts"
const meta: Meta<typeof Toast> = {
title: 'Core Components/Toast/Toast',
title: "Core Components/Toast/Toast",
component: Toast,
argTypes: {
variant: {
control: 'select',
type: 'string',
control: "select",
type: "string",
options: Object.keys(config.variants.variant),
table: {
defaultValue: { summary: 'info' },
defaultValue: { summary: "info" },
},
},
message: {
control: 'text',
type: 'string',
control: "text",
type: "string",
table: {
defaultValue: { summary: 'Toast message' },
defaultValue: { summary: "Toast message" },
},
},
},
@@ -33,36 +33,36 @@ type Story = StoryObj<typeof Toast>
export const Default: Story = {
args: {
variant: 'info',
message: 'This is a toast',
variant: "info",
message: "This is a toast",
},
play: async ({ canvas }) => {
const toast = await canvas.findByRole('status')
const toast = await canvas.findByRole("status")
expect(toast).toBeVisible()
},
}
export const DefaultWithCustomContent: Story = {
args: {
variant: 'info',
variant: "info",
children: (
<p style={{ fontStyle: 'italic' }}>This is a custom info toast</p>
<p style={{ fontStyle: "italic" }}>This is a custom info toast</p>
),
},
play: async ({ canvas }) => {
const toast = await canvas.findByRole('status')
const toast = await canvas.findByRole("status")
expect(toast).toBeVisible()
expect(canvas.getByText('This is a custom info toast')).toBeVisible()
expect(canvas.getByText("This is a custom info toast")).toBeVisible()
},
}
export const Success: Story = {
args: {
variant: 'success',
message: 'This is a success toast',
variant: "success",
message: "This is a success toast",
},
play: async ({ canvas, args }) => {
const toast = await canvas.findByRole('status')
const toast = await canvas.findByRole("status")
expect(toast).toBeVisible()
expect(canvas.getByText(args.message as string)).toBeVisible()
},
@@ -70,11 +70,11 @@ export const Success: Story = {
export const Error: Story = {
args: {
variant: 'error',
message: 'This is an error toast',
variant: "error",
message: "This is an error toast",
},
play: async ({ canvas, args }) => {
const toast = await canvas.findByRole('alert')
const toast = await canvas.findByRole("alert")
expect(toast).toBeVisible()
expect(canvas.getByText(args.message as string)).toBeVisible()
},
@@ -82,11 +82,11 @@ export const Error: Story = {
export const Warning: Story = {
args: {
variant: 'warning',
message: 'This is a warning toast',
variant: "warning",
message: "This is a warning toast",
},
play: async ({ canvas, args }) => {
const toast = await canvas.findByRole('alert')
const toast = await canvas.findByRole("alert")
expect(toast).toBeVisible()
expect(canvas.getByText(args.message as string)).toBeVisible()
},

View File

@@ -1,15 +1,15 @@
import type { VariantProps } from 'class-variance-authority'
import type { VariantProps } from "class-variance-authority"
import { MaterialIcon, MaterialIconSetIconProps } from '../Icons/MaterialIcon'
import { toastVariants } from './variants'
import { MaterialIcon, MaterialIconSetIconProps } from "../Icons/MaterialIcon"
import { toastVariants } from "./variants"
import { useIntl } from 'react-intl'
import { IconButton } from '../IconButton'
import { Typography } from '../Typography'
import styles from './toasts.module.css'
import { useIntl } from "react-intl"
import { IconButton } from "../IconButton"
import { Typography } from "../Typography"
import styles from "./toasts.module.css"
export type ToastsProps = VariantProps<typeof toastVariants> & {
variant: NonNullable<VariantProps<typeof toastVariants>['variant']>
variant: NonNullable<VariantProps<typeof toastVariants>["variant"]>
onClose?: () => void
} & (
| {
@@ -41,8 +41,8 @@ export function Toast({ children, message, onClose, variant }: ToastsProps) {
<IconButton
onPress={onClose}
aria-label={intl.formatMessage({
id: 'toast.dismissNotification',
defaultMessage: 'Dismiss notification',
id: "toast.dismissNotification",
defaultMessage: "Dismiss notification",
})}
variant="Muted"
emphasis
@@ -54,32 +54,32 @@ export function Toast({ children, message, onClose, variant }: ToastsProps) {
}
interface AlertIconProps {
variant: ToastsProps['variant']
variant: ToastsProps["variant"]
}
function AlertIcon({
variant,
...props
}: AlertIconProps & MaterialIconSetIconProps) {
switch (variant) {
case 'error':
case "error":
return <MaterialIcon icon="cancel" {...props} />
case 'info':
case "info":
return <MaterialIcon icon="info" {...props} />
case 'success':
case "success":
return <MaterialIcon icon="check_circle" {...props} />
case 'warning':
case "warning":
return <MaterialIcon icon="warning" {...props} />
}
}
function getRole(variant: ToastsProps['variant']) {
function getRole(variant: ToastsProps["variant"]) {
switch (variant) {
case 'error':
case 'warning':
return 'alert'
case 'info':
case 'success':
case "error":
case "warning":
return "alert"
case "info":
case "success":
default:
return 'status'
return "status"
}
}

View File

@@ -1,30 +1,30 @@
import { toast } from './index.tsx'
import { Toast } from './Toast.tsx'
import { toast } from "./index.tsx"
import { Toast } from "./Toast.tsx"
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
import { config } from './variants.ts'
import { ToastHandler } from './ToastHandler.tsx'
import { Button } from '../Button/Button.tsx'
import { expect, waitFor } from 'storybook/test'
import { config } from "./variants.ts"
import { ToastHandler } from "./ToastHandler.tsx"
import { Button } from "../Button/Button.tsx"
import { expect, waitFor } from "storybook/test"
const meta: Meta<typeof Toast> = {
title: 'Core Components/Toast/ToastHandler',
title: "Core Components/Toast/ToastHandler",
component: Toast,
argTypes: {
variant: {
control: 'select',
type: 'string',
control: "select",
type: "string",
options: Object.keys(config.variants.variant),
table: {
defaultValue: { summary: 'info' },
defaultValue: { summary: "info" },
},
},
message: {
control: 'text',
type: 'string',
control: "text",
type: "string",
table: {
defaultValue: { summary: 'Toast message' },
defaultValue: { summary: "Toast message" },
},
},
},
@@ -36,26 +36,26 @@ type Story = StoryObj<typeof Toast>
export const Default: Story = {
args: {
variant: 'info',
message: 'This is a toast',
variant: "info",
message: "This is a toast",
},
render: (args) => {
return <Renderer variant={args.variant} message={args.message as string} />
},
play: async ({ canvas, userEvent, args }) => {
let toast = canvas.queryByRole('status')
let toast = canvas.queryByRole("status")
expect(toast).not.toBeInTheDocument()
const showToastButton = await canvas.findByRole('button')
const showToastButton = await canvas.findByRole("button")
await userEvent.click(showToastButton)
toast = await canvas.findByRole(
['info', 'success'].indexOf(args.variant) !== -1 ? 'status' : 'alert'
["info", "success"].indexOf(args.variant) !== -1 ? "status" : "alert"
)
await waitFor(async () => await expect(toast).toBeVisible())
const closeButton = await canvas.findByLabelText('Dismiss notification')
const closeButton = await canvas.findByLabelText("Dismiss notification")
await userEvent.click(closeButton)
await waitFor(async () => await expect(toast).not.toBeVisible())
@@ -67,10 +67,10 @@ const Renderer = ({
variant,
}: {
message: string
variant: 'info' | 'success' | 'warning' | 'error'
variant: "info" | "success" | "warning" | "error"
onDismiss?: () => void
}) => {
const text = 'Show Toast'
const text = "Show Toast"
return (
<>
<Button

View File

@@ -1,4 +1,4 @@
import { Toaster } from 'sonner'
import { Toaster } from "sonner"
export function ToastHandler() {
return <Toaster position="bottom-right" duration={5000} />

View File

@@ -1,5 +1,5 @@
import { type ExternalToast, toast as sonnerToast } from 'sonner'
import { Toast } from './Toast'
import { type ExternalToast, toast as sonnerToast } from "sonner"
import { Toast } from "./Toast"
export const toast = {
success: (message: React.ReactNode, options?: ExternalToast) =>

View File

@@ -1,6 +1,6 @@
import { cva } from 'class-variance-authority'
import { cva } from "class-variance-authority"
import styles from './toasts.module.css'
import styles from "./toasts.module.css"
export const config = {
variants: {