Merged in chore/eslint-curly-braces (pull request #3304)

Chore/eslint curly braces

* Add eslint rule for curly braces

* run eslint --fix for all files


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-12-08 07:56:21 +00:00
parent 5986828580
commit de4b3c1c3c
54 changed files with 139 additions and 104 deletions

View File

@@ -38,7 +38,7 @@ export default async function Home(props: PageArgs<LangParams>) {
<section className={styles.mainContent}>
<div className={styles.contentContainer}>
<section className={styles.bookingWidgetWrapper}>
<Typography variant={"Title/lg"}>
<Typography variant="Title/lg">
<h1 className={styles.heading}>
{intl.formatMessage({
id: "partnerSas.startPage.heading",
@@ -64,7 +64,7 @@ export default async function Home(props: PageArgs<LangParams>) {
defaultMessage:
"Collect new SAS EuroBonus points with your bookings.",
})}
theme={"SAS-Blue"}
theme="SAS-Blue"
icon={IconName.Diamond}
/>
<InfoBox
@@ -77,7 +77,7 @@ export default async function Home(props: PageArgs<LangParams>) {
defaultMessage:
"Then use your points to pay for your next Scandic stay!",
})}
theme={"SAS-Blue"}
theme="SAS-Blue"
icon={IconName.CreditCard}
/>
</section>

View File

@@ -64,9 +64,8 @@ export default function GlobalError({
<p>
<strong>
{
"While we're working hard to fix it, you can always give us a call:"
}
While we&apos;re working hard to fix it, you can always give us a
call:
</strong>
</p>

View File

@@ -61,12 +61,12 @@ export function LanguageSwitcher({
return (
<div className={classNames}>
<DialogTrigger>
<Button className={styles.triggerButton} variant={"Text"} wrapping>
<Button className={styles.triggerButton} variant="Text" wrapping>
{isMobile && !isFooter ? null : (
<MaterialIcon
icon="globe"
size={16}
color={"Icon/Inverted"}
color="Icon/Inverted"
className={styles.globeIcon}
/>
)}
@@ -109,7 +109,7 @@ export function LanguageSwitcher({
<Popover
offset={isFooter ? 0 : 21}
className={styles.languageSwitcherPopover}
placement={"bottom right"}
placement="bottom right"
>
<Dialog>
{({ close }) => (
@@ -158,8 +158,8 @@ function LanguageSwitcherContent({
<>
<div className={styles.closeModalWrapper}>
<Button
variant={"Text"}
size={"Medium"}
variant="Text"
size="Medium"
onPress={closeModal}
className={styles.closeModal}
>
@@ -167,17 +167,17 @@ function LanguageSwitcherContent({
icon="chevron_left"
size={28}
className={styles.arrowBackIcon}
color={"CurrentColor"}
color="CurrentColor"
/>
<MaterialIcon
icon="close"
size={32}
className={styles.closeIcon}
color={"CurrentColor"}
color="CurrentColor"
/>
</Button>
</div>
<Typography variant={"Title/Subtitle/md"}>
<Typography variant="Title/Subtitle/md">
<h3 className={styles.title}>
{intl.formatMessage({
id: "common.selectYourLanguage",

View File

@@ -35,7 +35,7 @@ export function MobileMenu({ children }: React.PropsWithChildren) {
/>
<div id="close-menu-container" style={{ position: "relative" }}>
<Button
variant={"Text"}
variant="Text"
type="button"
className={`${styles.hamburger} ${isOpen ? styles.isExpanded : ""}`}
aria-label={isOpen ? closeMsg : openMsg}

View File

@@ -36,7 +36,7 @@ export function NavigationMenu({ isMobile = false }: { isMobile?: boolean }) {
className={`${styles.menuItem} ${styles.contactLink}`}
>
{isMobile ? null : (
<MaterialIcon icon="call" size={16} color={"CurrentColor"} />
<MaterialIcon icon="call" size={16} color="CurrentColor" />
)}
{intl.formatMessage({
id: "common.contactUs",

View File

@@ -58,9 +58,9 @@ export function UserMenu({
<div className={styles.userMenu}>
{(session.status === "loading" || isLoading) &&
(isMobile ? (
<SkeletonShimmer width={"4ch"} height={"4ch"} />
<SkeletonShimmer width="4ch" height="4ch" />
) : (
<SkeletonShimmer width={"12ch"} height={"1ch"} />
<SkeletonShimmer width="12ch" height="1ch" />
))}
{(session.status === "unauthenticated" || isError) && (
<a href={loginLink} className={styles.loginLink}>
@@ -86,7 +86,7 @@ export function UserMenu({
{session.status === "authenticated" && isSuccess && profileData && (
<div>
<DialogTrigger onOpenChange={onOpenChange} isOpen={isOpen}>
<Button className={styles.userName} variant={"Text"}>
<Button className={styles.userName} variant="Text">
<Avatar
className={styles.avatar}
initials={getInitials(
@@ -153,7 +153,7 @@ function UserMenuContent({
<>
<div>
{isMobile && (
<Typography variant={"Title/Subtitle/md"}>
<Typography variant="Title/Subtitle/md">
<h3 data-hj-suppress>
{intl.formatMessage(
{
@@ -176,7 +176,7 @@ function UserMenuContent({
</Typography>
<Typography variant="Title/Overline/sm">
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<span>{"·"}</span>
<span>·</span>
</Typography>
<Typography variant="Body/Paragraph/mdRegular">
<span>
@@ -194,7 +194,7 @@ function UserMenuContent({
</p>
</div>
<Divider className={styles.menuDivider} />
<Typography variant={"Link/md"} className={styles.logoutLink}>
<Typography variant="Link/md" className={styles.logoutLink}>
{/* Link triggers rsc which doesn't reload complete page and shows logged in even after logout */}
<a href={`/${lang}/logout`}>
{intl.formatMessage({

View File

@@ -47,6 +47,14 @@ export default defineConfig([
"no-console": "warn",
"no-unused-vars": "off",
"react/function-component-definition": "error",
"react/jsx-curly-brace-presence": [
"error",
{
props: "never",
children: "never",
propElementValues: "always",
},
],
"import/no-relative-packages": "error",
"simple-import-sort/imports": [
"warn",

View File

@@ -7,8 +7,8 @@
"dev": "NODE_OPTIONS=--openssl-legacy-provider PORT=3001 NEXT_PUBLIC_PORT=3001 next dev --turbo",
"build": "next build",
"start": "node .next/standalone/server.js",
"lint": "eslint --max-warnings 0 . && tsgo --noEmit",
"lint:fix": "eslint --fix . && tsgo --noEmit",
"lint": "eslint --max-warnings 0 .",
"lint:fix": "eslint --fix .",
"check-types": "tsgo --noEmit",
"typegen": "next typegen",
"clean": "rm -rf .next",

View File

@@ -6,8 +6,8 @@
"scripts": {
"dev": "bun --watch src/index.ts | pino-pretty -o '{if module}[{module}] {end}{msg}' -i pid,hostname",
"check-types": "tsgo --noEmit",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 && tsgo --noEmit",
"lint:fix": "eslint . --ext ts,tsx --fix --report-unused-disable-directives --max-warnings 0 && tsgo --noEmit",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --ext ts,tsx --fix --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write ."
},
"dependencies": {

View File

@@ -18,7 +18,7 @@ export function AlreadyLinkedError() {
<SASModal>
<MaterialIcon
icon="check_circle"
color={"Icon/Feedback/Success"}
color="Icon/Feedback/Success"
isFilled
size={64}
/>
@@ -43,9 +43,9 @@ export function AlreadyLinkedError() {
<Typography variant="Body/Paragraph/mdBold">
<ButtonLink
href={partnerSas[lang]}
variant={"Tertiary"}
color={"Primary"}
size={"Large"}
variant="Tertiary"
color="Primary"
size="Large"
>
{intl.formatMessage({
id: "linkEuroBonusAccount.viewLinkedAccountsButton",

View File

@@ -54,7 +54,7 @@ export function LinkAccountForm({
<form onSubmit={handleSubmit} className={styles.form}>
<div className={styles.titles}>
<Image
alt={"Scandic ❤️ SAS"}
alt="Scandic ❤️ SAS"
height={25}
width={182}
src="/_static/img/partner/sas/sas-campaign-logo.png"

View File

@@ -78,9 +78,8 @@ export default function GlobalError({
<p>
<strong>
{
"While we're working hard to fix it, you can always give us a call:"
}
While we&apos;re working hard to fix it, you can always give us a
call:
</strong>
</p>

View File

@@ -32,7 +32,7 @@ export default function Filter({
<form className={styles.filterForm}>
<DeprecatedSelect
items={countryFilters}
defaultSelectedKey={""}
defaultSelectedKey=""
label={intl.formatMessage({
id: "common.country",
defaultMessage: "Country",
@@ -46,7 +46,7 @@ export default function Filter({
/>
<DeprecatedSelect
items={cityFilters}
defaultSelectedKey={""}
defaultSelectedKey=""
label={intl.formatMessage({
id: "jobylonFeed.cityFilterLabel",
defaultMessage: "Location (shown in local language)",
@@ -60,7 +60,7 @@ export default function Filter({
/>
<DeprecatedSelect
items={departmentFilters}
defaultSelectedKey={""}
defaultSelectedKey=""
label={intl.formatMessage({
id: "jobylonFeed.departmentFilterLabel",
defaultMessage: "Hotel or office",
@@ -74,7 +74,7 @@ export default function Filter({
/>
<DeprecatedSelect
items={categoryFilters}
defaultSelectedKey={""}
defaultSelectedKey=""
label={intl.formatMessage({
id: "jobylonFeed.categoryFilterLabel",
defaultMessage: "Category",

View File

@@ -157,8 +157,8 @@ export default function OverviewTableClient({
<div>
<div className={styles.mobileColumns}>
<div className={styles.columnHeaderContainer}>
<MobileColumnHeader column={"A"} />
<MobileColumnHeader column={"B"} />
<MobileColumnHeader column="A" />
<MobileColumnHeader column="B" />
</div>
<RewardList
levels={[

View File

@@ -40,7 +40,7 @@ export default function LargeTable({
return (
<tr key={key + idx} className={styles.tr}>
<th scope={"row"} className={styles.rewardTh}>
<th scope="row" className={styles.rewardTh}>
<RewardTableHeader name={label} description={description} />
</th>
{levels.map((level, idx) => {
@@ -71,7 +71,7 @@ function RewardTableHeader({ name, description }: RewardTableHeaderProps) {
<details className={styles.details}>
<summary className={styles.summary}>
<hgroup className={styles.rewardHeader}>
<Title as="h4" level="h2" textTransform={"regular"}>
<Title as="h4" level="h2" textTransform="regular">
{name}
</Title>
<span className={styles.chevron}>

View File

@@ -19,7 +19,7 @@ export default function RewardCard({
<details className={styles.details}>
<summary className={styles.summary}>
<hgroup className={styles.rewardCardHeader}>
<Title as="h4" level="h2" textTransform={"regular"}>
<Title as="h4" level="h2" textTransform="regular">
{title}
</Title>
<span className={styles.chevron}>

View File

@@ -11,7 +11,7 @@ export default function YourLevel() {
className={styles.script}
color="peach80"
type="two"
textAlign={"center"}
textAlign="center"
>
{intl.formatMessage({
id: "overviewTable.yourLevel",

View File

@@ -27,8 +27,8 @@ export default async function PointsOverview({
link={link}
preamble={subtitle}
title={title}
headingAs={"h3"}
headingLevel={"h1"}
headingAs="h3"
headingLevel="h1"
/>
<div className={styles.membershipCardsContainer}>
<PointsToSpendCard user={user} />

View File

@@ -43,7 +43,7 @@ export function DestinationSearchForm({
handlePressEnter={() => {
void 0
}}
inputName={"destinationSearch"}
inputName="destinationSearch"
onSelect={(item) => {
if (!item.url) {
Sentry.captureMessage(

View File

@@ -210,7 +210,7 @@ export default function ConfirmationStep({
onChange={(method) => {
trackUpdatePaymentMethod({ method })
}}
formName={"paymentMethod"}
formName="paymentMethod"
/>
</>
)}

View File

@@ -28,7 +28,7 @@ export default function DeliveryMethodStep() {
</Typography>
<Select
name="deliveryTime"
label={""}
label=""
items={deliveryTimeOptions}
registerOptions={{ required: true }}
isNestedInModal

View File

@@ -124,7 +124,7 @@ export default function Room({ booking, roomNr, user }: RoomProps) {
<div className={styles.roomHeader}>
{isCancelled ? (
<IconChip
color={"red"}
color="red"
icon={
<MaterialIcon
icon="cancel"

View File

@@ -40,7 +40,7 @@ export default function SingleRoom({ user }: RoomProps) {
if (!roomNumber) {
return (
<div className={styles.room}>
<SkeletonShimmer width={"200px"} height="30px" />
<SkeletonShimmer width="200px" height="30px" />
<SkeletonShimmer width="100%" height="750px" />
</div>
)

View File

@@ -8,15 +8,15 @@ export function MyStaySkeleton() {
return (
<div className={styles.content}>
<div className={styles.headerSkeleton}>
<SkeletonShimmer width={"100px"} height="20px" />
<SkeletonShimmer width={"450px"} height="50px" />
<SkeletonShimmer width={"200px"} height="30px" />
<SkeletonShimmer width="100px" height="20px" />
<SkeletonShimmer width="450px" height="50px" />
<SkeletonShimmer width="200px" height="30px" />
</div>
<div className={styles.cardSkeleton}>
<SkeletonShimmer width="590px" height="380px" />
</div>
<div className={styles.section}>
<SkeletonShimmer width={"200px"} height="30px" />
<SkeletonShimmer width="200px" height="30px" />
<div className={styles.ancillariesSkeleton}>
<SkeletonShimmer width="280px" height="200px" />
<SkeletonShimmer width="280px" height="200px" />
@@ -26,7 +26,7 @@ export function MyStaySkeleton() {
</div>
</div>
<div className={styles.section}>
<SkeletonShimmer width={"200px"} height="30px" />
<SkeletonShimmer width="200px" height="30px" />
<div>
<SkeletonShimmer width="100%" height="700px" />
</div>

View File

@@ -41,7 +41,7 @@ export default function LevelProgressModal({
<Modal
className={styles.dialog}
trigger={
<IconButton theme={"Black"}>
<IconButton theme="Black">
<MaterialIcon
className={styles.infoButton}
icon="info"

View File

@@ -15,7 +15,7 @@ function PaginationButton({
}: React.PropsWithChildren<PaginationButtonProps>) {
return (
<button
type={"button"}
type="button"
disabled={disabled}
onClick={handleClick}
className={`${styles.paginationButton} ${isActive ? styles.paginationButtonActive : ""}`}

View File

@@ -171,7 +171,7 @@ export default function BookedRoomSidePeekContent({
<div className={styles.roomHeader}>
{isCancelled ? (
<IconChip
color={"red"}
color="red"
icon={
<MaterialIcon
icon="cancel"

View File

@@ -26,21 +26,21 @@ export default async function JoinLoyaltyContact({
<section className={styles.joinLoyaltyContainer}>
<article className={styles.wrapper}>
{block.title ? (
<Typography variant={"Title/Subtitle/md"}>
<Typography variant="Title/Subtitle/md">
<h4 className={styles.title}>{block.title}</h4>
</Typography>
) : null}
<ScandicFriends color="red" />
{block.preamble ? (
<Typography variant={"Body/Paragraph/mdRegular"}>
<Typography variant="Body/Paragraph/mdRegular">
<p className={styles.preamble}>{block.preamble}</p>
</Typography>
) : null}
{block.button ? (
<Typography variant={"Body/Paragraph/mdBold"}>
<Typography variant="Body/Paragraph/mdBold">
<ButtonLink
className={styles.button}
size={"Small"}
size="Small"
wrapping
href={block.button.href}
target={block.button.openInNewTab ? "_blank" : "_self"}
@@ -50,7 +50,7 @@ export default async function JoinLoyaltyContact({
</Typography>
) : null}
<section className={styles.loginContainer}>
<Typography variant={"Body/Paragraph/mdRegular"}>
<Typography variant="Body/Paragraph/mdRegular">
<p>
{intl.formatMessage({
id: "loyalty.alreadyFriend",

View File

@@ -48,6 +48,14 @@ export default defineConfig([
"no-console": "warn",
"no-unused-vars": "off",
"react/function-component-definition": "error",
"react/jsx-curly-brace-presence": [
"error",
{
props: "never",
children: "ignore",
propElementValues: "always",
},
],
"import/no-relative-packages": "error",
"simple-import-sort/imports": [
"warn",

View File

@@ -6,8 +6,8 @@
"scripts": {
"build": "next build",
"dev": "NODE_OPTIONS=--openssl-legacy-provider PORT=3000 NEXT_PUBLIC_PORT=3000 next dev --turbo",
"lint": "next typegen && eslint --max-warnings 0 . && tsgo --noEmit",
"lint:fix": "next typegen && eslint --fix --max-warnings 0 . && tsgo --noEmit",
"lint": "next typegen && eslint --max-warnings 0 .",
"lint:fix": "next typegen && eslint --fix --max-warnings 0 .",
"start": "node .next/standalone/server.js",
"test:setup": "yarn build && yarn start",
"test:e2e": "playwright test",