Skip to content

Commit 1c6b807

Browse files
authored
Strengthen frontend Biome linting rules to enforce import and Tailwind sorting, naming conventions, etc. (platformplatform#703)
### Summary & Motivation Updated the Biome configuration to enforce **sorted imports** in TypeScript and `.tsx` files and **sorted Tailwind class names**. A full solution-wide cleanup has been performed to align with these changes. Biome's linting rules have been expanded to: - Enforce **naming conventions** while allowing PascalCased OpenAPI .NET parameters - Require explicit block statements (`{}`) where necessary - Strengthen formatting enforcement by **removing format scripts** from `package.json`, as formatting is now handled via `lint` Also, a generic cleanup in the frontend, including fixing most Sonar warnings. Including: - Import `React` wherever `React.ReactNode` is used to avoid warnings - Mark variables as **readonly** and **non-nullable** where applicable - Remove obsolete `avatar.png` - Update location of module federation types from `mf-types`to `module-federation-types` - Remove leftover configuration from React Canary usage - Remove workspace-biome workaround to make Biome work in VS Code ### Downstream projects 1. **Update `package.json` scripts** Update the `application/[your-self-contained system]/WebApp/package.json` to apply the new strict linting rules, and remove the `format` script which is now fully covered by the `lint` script: ```diff "scripts": { - "check": "biome check", - "lint": "biome lint --write", - "format": "biome format --write", + "check": "biome check --error-on-warnings", + "lint": "biome check --write --unsafe" } ``` 3. **Ignore Biome warning in bootstrap.tsx** Update `application/[your-self-contained system]/WebApp/bootstrap.tsx` to ignore incorrect casing of `ReactDOM`: ```diff + // biome-ignore lint/style/useNamingConvention: ReactDOM is a standard library name with consecutive uppercase letters import ReactDOM from "react-dom/client"; ``` 4. **Update rsbuild.config.ts** Rename the `MFPlugin` to `ModuleFederationPlugin` in `application/[your-self-contained system]/WebApp/rsbuild.config.ts`: ```diff +import { ModuleFederationPlugin } from "@repo/build/plugin/ModuleFederationPlugin"; -import { MFPlugin } from "@repo/build/plugin/MFPlugin"; + ModuleFederationPlugin({ - MFPlugin({ ``` 5. **Update react-env.d.ts** Update `application/[your-self-contained system]/WebApp/react-env.d.ts` to use the new `module-federation-types` folder: ```diff +/// <reference types="@repo/build/module-federation-types/account-management.d.ts" /> -/// <reference types="@repo/build/mf-types/account-management.d.ts" /> ``` 6. IMPORTANT: Restart CLI command before continuing Since `npm run format` has been removed, the build CLI command will fail if you continue. After making the above changes, please restart the process by running: `pp pull-platform-platform-changes --resume` (where pp is your CLI alias). ### Checklist - [x] I have added tests, or done manual regression tests - [x] I have updated the documentation, if necessary
2 parents 08f4bac + a1694b1 commit 1c6b807

File tree

127 files changed

+907
-830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+907
-830
lines changed

application/account-management/WebApp/bootstrap.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import "@repo/ui/tailwind.css";
22
import { router } from "@/shared/lib/router/router";
3+
import { ApplicationInsightsProvider } from "@repo/infrastructure/applicationInsights/ApplicationInsightsProvider";
4+
import { Translation } from "@repo/infrastructure/translations/Translation";
35
import { RouterProvider } from "@tanstack/react-router";
46
import React from "react";
7+
// biome-ignore lint/style/useNamingConvention: ReactDOM is a standard library name with consecutive uppercase letters
58
import ReactDOM from "react-dom/client";
6-
import { Translation } from "@repo/infrastructure/translations/Translation";
7-
import { ApplicationInsightsProvider } from "@repo/infrastructure/applicationInsights/ApplicationInsightsProvider";
89

910
const { TranslationProvider } = await Translation.create(
1011
(locale) => import(`@/shared/translations/locale/${locale}.ts`)

application/account-management/WebApp/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
"dev:setup": "npm run update-translations && npm run swagger",
88
"build": "npm run update-translations && npm run swagger && rsbuild build",
99
"update-translations": "lingui extract --clean && lingui compile --typescript",
10-
"check": "biome check",
11-
"lint": "biome lint --write",
12-
"format": "biome format --write",
10+
"check": "biome check --error-on-warnings",
11+
"lint": "biome check --write --unsafe",
1312
"swagger": "openapi-typescript shared/lib/api/AccountManagement.Api.json -o shared/lib/api/api.generated.d.ts --properties-required-by-default -t --enum --alphabetize",
1413
"publish": "npm run build && mkdir -p ../Api/publish/WebApp/dist/ && rsync -r ./dist/ ../Api/publish/WebApp/dist/"
1514
},

application/account-management/WebApp/routes/(index)/-components/CommunitySection.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { githubImageUrl, slackImageUrl, youtubeImageUrl } from "./cdnImages";
21
import { Link } from "@repo/ui/components/Link";
32
import { ArrowRight } from "lucide-react";
43
import type { LinkProps } from "react-aria-components";
4+
import { githubImageUrl, slackImageUrl, youtubeImageUrl } from "./cdnImages";
55

66
// Props for FeatureBlock component
77
interface FeatureBlockProps {
@@ -16,14 +16,14 @@ interface FeatureBlockProps {
1616
// Component to display a feature with an image, title, content, and a link
1717
function FeatureBlock({ title, content, image, href, linkText, arrow }: Readonly<FeatureBlockProps>) {
1818
return (
19-
<div className="flex flex-col gap-4 items-center justify-center">
20-
<div className="flex shadow rounded-lg w-12 h-12 justify-center p-1 items-center">
19+
<div className="flex flex-col items-center justify-center gap-4">
20+
<div className="flex h-12 w-12 items-center justify-center rounded-lg p-1 shadow">
2121
<img src={image} alt={title} />
2222
</div>
23-
<div className="text-foreground text-xl font-semibold text-center">{title}</div>
24-
<div className="text-muted-foreground text-base font-normal text-center">{content}</div>
23+
<div className="text-center font-semibold text-foreground text-xl">{title}</div>
24+
<div className="text-center font-normal text-base text-muted-foreground">{content}</div>
2525
<Link href={href}>
26-
{linkText} {arrow && <ArrowRight className="w-4 h-4" />}
26+
{linkText} {arrow && <ArrowRight className="h-4 w-4" />}
2727
</Link>
2828
</div>
2929
);
@@ -32,39 +32,39 @@ function FeatureBlock({ title, content, image, href, linkText, arrow }: Readonly
3232
// Component for the Community Section
3333
export function CommunitySection() {
3434
return (
35-
<div className="flex flex-col gap-8 items-center bg-background py-48">
36-
<div className="flex flex-col gap-8 text-center items-center md:px-32 lg:px-64 px-8 max-w-7xl">
37-
<h1 className="text-amber-600 text-base font-semibold">COMMUNITY</h1>
38-
<h2 className="text-foreground text-4xl md:text-6xl font-semibold">Join builders on PlatformPlatform</h2>
39-
<p className="text-muted-foreground text-xl font-normal">
35+
<div className="flex flex-col items-center gap-8 bg-background py-48">
36+
<div className="flex max-w-7xl flex-col items-center gap-8 px-8 text-center md:px-32 lg:px-64">
37+
<h1 className="font-semibold text-amber-600 text-base">COMMUNITY</h1>
38+
<h2 className="font-semibold text-4xl text-foreground md:text-6xl">Join builders on PlatformPlatform</h2>
39+
<p className="font-normal text-muted-foreground text-xl">
4040
Our community is full of developers, designers and founders - just like you, to get your going, sharing ideas
4141
and experiences. Join us now.
4242
</p>
4343
</div>
44-
<div className="grid grid-row-3 md:grid-cols-3 px-32 gap-16">
44+
<div className="grid-row-3 grid gap-16 px-32 md:grid-cols-3">
4545
<FeatureBlock
4646
title="YouTube"
4747
content="Subscribe to our YouTube channel to get quickly started, and stay informed of new features."
4848
image={youtubeImageUrl}
4949
href="https://www.youtube.com"
5050
linkText="View training videos"
51-
arrow
51+
arrow={true}
5252
/>
5353
<FeatureBlock
5454
title="Slack"
5555
content="Chat with our team or other members of the PlatformPlatform community."
5656
image={slackImageUrl}
5757
href="https://slack.com"
5858
linkText="Join our Slack channel"
59-
arrow
59+
arrow={true}
6060
/>
6161
<FeatureBlock
6262
title="GitHub"
6363
content="View our GitHub repository and collaborate with thousands of developers like you."
6464
image={githubImageUrl}
6565
href="https://github.com"
6666
linkText="Check GitHub"
67-
arrow
67+
arrow={true}
6868
/>
6969
</div>
7070
</div>

application/account-management/WebApp/routes/(index)/-components/CtaSection.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { Button } from "@repo/ui/components/Button";
33
// CtaSection: A functional component that displays a call to action
44
export function CtaSection() {
55
return (
6-
<div className="flex flex-col gap-4 text-center bg-muted px-8 md:px-48 py-24">
7-
<div className="flex flex-col gap-8 text-center px-8">
8-
<h2 className="text-foreground text-4xl font-semibold">A single solution for you to build on</h2>
9-
<p className="text-muted-foreground text-xl font-normal">
6+
<div className="flex flex-col gap-4 bg-muted px-8 py-24 text-center md:px-48">
7+
<div className="flex flex-col gap-8 px-8 text-center">
8+
<h2 className="font-semibold text-4xl text-foreground">A single solution for you to build on</h2>
9+
<p className="font-normal text-muted-foreground text-xl">
1010
Join Startups and Enterprises already building on PlatformPlatform
1111
</p>
12-
<div className="flex flex-col md:gap-8 items-center">
12+
<div className="flex flex-col items-center md:gap-8">
1313
<Button variant="secondary">Get started today - it&apos;s free</Button>
1414
</div>
1515
</div>

application/account-management/WebApp/routes/(index)/-components/CtaSection2.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { calenderMockupUrl } from "./cdnImages";
21
import { Button } from "@repo/ui/components/Button";
2+
import { calenderMockupUrl } from "./cdnImages";
33

44
// CtaSection2: A functional component that displays the second call to action section
55
export function CtaSection2() {
66
return (
7-
<div className="flex bg-background justify-center pb-12 pt-24 px-8 md:px-24 shadow-lg">
8-
<div className="flex bg-gray-800 justify-between items-center rounded-3xl pt-16 p-4 md:py-16 md:px-8 gap-16 md:flex-row flex-col">
9-
<div className="flex flex-col items-center md:items-start gap-8 px-8 w-1/3">
10-
<div className="text-white text-4xl font-semibold">
7+
<div className="flex justify-center bg-background px-8 pt-24 pb-12 shadow-lg md:px-24">
8+
<div className="flex flex-col items-center justify-between gap-16 rounded-3xl bg-gray-800 p-4 pt-16 md:flex-row md:px-8 md:py-16">
9+
<div className="flex w-1/3 flex-col items-center gap-8 px-8 md:items-start">
10+
<div className="font-semibold text-4xl text-white">
1111
Get lightyears ahead and get your product in the hands of your customers
1212
</div>
13-
<div className="text-slate-200 text-xl font-normal">No credit cards or hidden fees. Just Open Source.</div>
13+
<div className="font-normal text-slate-200 text-xl">No credit cards or hidden fees. Just Open Source.</div>
1414
<Button variant="secondary">Get started today - it’s free</Button>
1515
</div>
1616
<div className="w-min-6xl">

application/account-management/WebApp/routes/(index)/-components/CtaSection3.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { SignUpButton } from "@repo/infrastructure/auth/SignUpButton";
33
// CtaSection3: A functional component that displays a call to action
44
export function CtaSection3() {
55
return (
6-
<div className="flex flex-col gap-4 items-center text-center bg-background px-8 md:px-24 pt-12 pb-24">
7-
<div className="bg-muted py-16 md:py-32 rounded-xl w-full">
6+
<div className="flex flex-col items-center gap-4 bg-background px-8 pt-12 pb-24 text-center md:px-24">
7+
<div className="w-full rounded-xl bg-muted py-16 md:py-32">
88
<div className="flex flex-col gap-8 text-center">
9-
<h2 className="text-foreground text-4xl md:text-6xl font-semibold">Start scaling your business today</h2>
10-
<p className="text-muted-foreground text-xl font-normal">
9+
<h2 className="font-semibold text-4xl text-foreground md:text-6xl">Start scaling your business today</h2>
10+
<p className="font-normal text-muted-foreground text-xl">
1111
Join Startups and Enterprises already building on PlatformPlatform
1212
</p>
13-
<div className="flex flex-col md:gap-8 items-center">
13+
<div className="flex flex-col items-center md:gap-8">
1414
{/* Button component is used to display a call to action */}
1515
<SignUpButton variant="primary">Get started for free</SignUpButton>
1616
</div>

application/account-management/WebApp/routes/(index)/-components/FeatureSection.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ import {
1313
// FeatureSection: A functional component that displays the feature section
1414
export function FeatureSection() {
1515
return (
16-
<div className="flex flex-col gap-8 text-center bg-background pb-12">
17-
<div className="flex flex-col gap-8 self-center md:w-1/2 px-8 pt-24">
18-
<h1 className="text-amber-600 text-base font-semibold">FEATURES</h1>
19-
<h2 className="text-foreground text-2xl md:text-6xl font-semibold">
16+
<div className="flex flex-col gap-8 bg-background pb-12 text-center">
17+
<div className="flex flex-col gap-8 self-center px-8 pt-24 md:w-1/2">
18+
<h1 className="font-semibold text-amber-600 text-base">FEATURES</h1>
19+
<h2 className="font-semibold text-2xl text-foreground md:text-6xl">
2020
All-in-one Infrastructure for any business
2121
</h2>
22-
<p className="text-muted-foreground text-md md:text-xl font-normal">
22+
<p className="font-normal text-md text-muted-foreground md:text-xl">
2323
Get a full enterprise grade production environment running within 1 hour. From development, infrastructure as
2424
code to fully deployed production application with a security score of 100%.
2525
</p>
2626
</div>
2727
<div className="flex flex-row justify-center gap-4 px-16 md:pr-0">
2828
<div className="flex flex-col gap-4">
2929
<img
30-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
30+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
3131
src={createAccountUrl}
3232
alt="Create Account"
3333
loading="lazy"
3434
/>
3535
<img
36-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
36+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
3737
src={enterCodeUrl}
3838
alt="Enter Code"
3939
loading="lazy"
@@ -42,52 +42,52 @@ export function FeatureSection() {
4242
<div className="flex flex-col gap-4">
4343
<div className="flex flex-row gap-2">
4444
<img
45-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
45+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
4646
src={profileEditDarkUrl}
4747
alt="Profile Edit Dark"
4848
loading="lazy"
4949
/>
5050
<div>
5151
<img
52-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
52+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
5353
src={darkModeUrl}
5454
alt="Dark Mode"
5555
loading="lazy"
5656
/>
5757
</div>
5858
<div>
5959
<img
60-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
60+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
6161
src={lightModeUrl}
6262
alt="Light Mode"
6363
loading="lazy"
6464
/>
6565
</div>
6666
</div>
6767
<img
68-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
68+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
6969
src={editProfileUrl}
7070
alt="Edit Profile"
7171
loading="lazy"
7272
/>
7373
</div>
74-
<div className="flex-col gap-4 hidden md:flex">
74+
<div className="hidden flex-col gap-4 md:flex">
7575
<img
76-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
76+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
7777
src={accountSettingsUrl}
7878
alt="Account Settings"
7979
loading="lazy"
8080
/>
8181
<img
82-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
82+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
8383
src={profileEditLightUrl}
8484
alt="Edit Profile Light"
8585
loading="lazy"
8686
/>
8787
</div>
88-
<div className="flex-col gap-4 hidden md:flex">
88+
<div className="hidden flex-col gap-4 md:flex">
8989
<img
90-
className="shadow-xl shadow-gray-400 dark:shadow-gray-800 rounded-lg"
90+
className="rounded-lg shadow-gray-400 shadow-xl dark:shadow-gray-800"
9191
src={usersUrl}
9292
alt="Users"
9393
loading="lazy"

application/account-management/WebApp/routes/(index)/-components/FeatureSection2.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// FeatureSection2: Displays a section with features
22
export function FeatureSection2() {
33
return (
4-
<div className="flex flex-col md:flex-row gap-8 bg-background py-24 px-8 md:px-32">
5-
<div className="flex flex-col md:w-1/3 grow gap-4 text-foreground text-4xl font-semibold text-start pr-8">
6-
<h1 className="text-amber-600 text-base font-semibold text-start">FEATURES</h1>
4+
<div className="flex flex-col gap-8 bg-background px-8 py-24 md:flex-row md:px-32">
5+
<div className="flex grow flex-col gap-4 pr-8 text-start font-semibold text-4xl text-foreground md:w-1/3">
6+
<h1 className="text-start font-semibold text-amber-600 text-base">FEATURES</h1>
77
All the features you need to build anything you want
88
</div>
9-
<div className="flex md:flex-row flex-col gap-16 w-2/3">
10-
<div className="grid gap-x-16 gap-y-8 grid-cols-1 md:grid-cols-2 grid-rows-3 text-black md:max-w-full">
9+
<div className="flex w-2/3 flex-col gap-16 md:flex-row">
10+
<div className="grid grid-cols-1 grid-rows-3 gap-x-16 gap-y-8 text-black md:max-w-full md:grid-cols-2">
1111
<FeatureBlock
1212
title="Authentication and authorisation"
1313
content="Authentication and authorisation of your users are built right in using best practice and most secure industry standards."
@@ -46,9 +46,9 @@ interface FeatureBlockProps {
4646
// FeatureBlock: Displays a single feature
4747
function FeatureBlock({ title, content }: Readonly<FeatureBlockProps>) {
4848
return (
49-
<div className="flex flex-col gap-4 h-1/3">
50-
<div className="text-foreground text-xl font-semibold text-start">{title}</div>
51-
<div className="text-muted-foreground text-base font-normal text-start">{content}</div>
49+
<div className="flex h-1/3 flex-col gap-4">
50+
<div className="text-start font-semibold text-foreground text-xl">{title}</div>
51+
<div className="text-start font-normal text-base text-muted-foreground">{content}</div>
5252
</div>
5353
);
5454
}

0 commit comments

Comments
 (0)