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

Chore: Adding lint workflow and fixing format issues #545

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
51 changes: 51 additions & 0 deletions .github/workflows/typescript_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Typescript Lint, Format and Type check workflow

on:
pull_request:
paths:
- "website/**"

jobs:
linting_and_type-checking:
name: Typescript Linting, Formatting and Type checking
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: website

- name: Linting and Formatting checks
run: yarn run lint
working-directory: website

- name: Type checking
run: yarn run typecheck

build:
name: Build check
runs-on: ubuntu-latest
needs: linting_and_type-checking
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn run build
2 changes: 1 addition & 1 deletion website/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"components": "@/components",
"utils": "@/library/utils"
}
}
}
2 changes: 1 addition & 1 deletion website/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
6 changes: 5 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"start": "serve -s dist",
"build": "vite --mode prod build",
"lint": "eslint src --ext js,ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"lint:fix": "eslint . --ext .tsx --ext .ts --fix --max-warnings 0",
"typecheck": "tsc --pretty --noEmit",
"format:fix": "prettier --write \"**/*.{ts,tsx,json,css}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,css}\""
},
"dependencies": {
"@nivo/core": "^0.83.0",
Expand Down
2 changes: 1 addition & 1 deletion website/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export default {
tailwindcss: {},
autoprefixer: {},
},
}
};
4 changes: 2 additions & 2 deletions website/src/assets/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

@import url('./tailwind.css');
@import url('./directives.css');
@import url("./tailwind.css");
@import url("./directives.css");

/* Raleway font */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,1;0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;0,1000;1,1;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900;1,1000&display=swap");
11 changes: 4 additions & 7 deletions website/src/assets/styles/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ limitations under the License.
@tailwind components;
@tailwind utilities;


@layer base {
:root {
--background: 0 0% 100%;
Expand Down Expand Up @@ -47,13 +46,13 @@ limitations under the License.

--warning: 38 92% 50%;
--warning-foreground: 48 96% 89%;

--success: 120, 100%, 25%;
--success-foreground: 60 9.1% 97.8%;

--progress: 240, 83%, 58%;
--progress-foreground: 60 9.1% 97.8%;

--border: 20 5.9% 90%;
--input: 20 5.9% 90%;
--ring: 24.6 95% 53.1%;
Expand Down Expand Up @@ -105,7 +104,7 @@ limitations under the License.

--warning: 38 92% 50%;
--warning-foreground: 48 96% 89%;

--border: 12 6.5% 15.1%;
--input: 12 6.5% 15.1%;
--ring: 20.5 90.2% 48.2%;
Expand All @@ -131,7 +130,6 @@ limitations under the License.
}
}


@layer base {
/* setting default background, text color and font */
html {
Expand Down Expand Up @@ -165,7 +163,6 @@ limitations under the License.
}

@keyframes translateUpDown {

0%,
100% {
transform: translateY(0);
Expand All @@ -174,4 +171,4 @@ limitations under the License.
50% {
transform: translateY(-0.7cm);
}
}
}
2 changes: 1 addition & 1 deletion website/src/common/CommandMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function CommandMenu() {
<Button
variant="outline"
className={cn(
"relative h-8 w-full justify-start rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-12 md:w-40 lg:w-64"
"relative h-8 w-full justify-start rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-12 md:w-40 lg:w-64",
)}
onClick={() => setOpen(true)}
>
Expand Down
2 changes: 1 addition & 1 deletion website/src/common/DailySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function DailySummary(props: DailySummaryProps) {
<Card
className={twMerge(
"w-[310px] h-[124px] md:w-[316px] md:h-[124px] hover:scale-105 duration-300 hover:bg-muted border-border",
workload === data.name && "border-2 border-front"
workload === data.name && "border-2 border-front",
)}
onClick={() => getWorkload()}
>
Expand Down
8 changes: 6 additions & 2 deletions website/src/common/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ const Footer: React.FC = () => {
<h5 className="font-bold md:text-lg text-base">{item.title}</h5>
<div className="my-4 md:my-7 flex flex-col gap-y-2">
{item.links.map((link, key) => (
<Link className="md:text-base text-xs text-foreground/80 hover:text-primary/80" key={key} to={link.to}>
<Link
className="md:text-base text-xs text-foreground/80 hover:text-primary/80"
key={key}
to={link.to}
>
{link.title}
</Link>
))}
Expand All @@ -109,4 +113,4 @@ const Footer: React.FC = () => {
);
};

export default Footer;
export default Footer;
6 changes: 4 additions & 2 deletions website/src/common/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ export default function Hero({ title, description, children }: HeroProps) {
return (
<section className="flex flex-col items-center p-12">
<div className="flex flex-col items-center gap-4 max-w-screen-lg">
<h2 className="text-4xl md:text-6xl font-semibold text-primary mb-4">{title}</h2>
<h2 className="text-4xl md:text-6xl font-semibold text-primary mb-4">
{title}
</h2>
<p className="md:my-6 leading-loose text-foreground/80">
{description}
</p>
{children}
</div>
</section>
);
}
}
14 changes: 7 additions & 7 deletions website/src/common/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function Navbar(): JSX.Element {
<nav className="flex flex-col relative">
<div
className={twMerge(
"w-full bg-background z-[49] flex justify-between lg:justify-center p-4 border-b border-border"
"w-full bg-background z-[49] flex justify-between lg:justify-center p-4 border-b border-border",
)}
>
<Link to="/" className="flex flex-1 gap-x-2 items-center">
Expand All @@ -77,8 +77,8 @@ export default function Navbar(): JSX.Element {
isPending
? "pointer-events-none opacity-50"
: isActive
? "text-primary"
: ""
? "text-primary"
: "",
)
}
>
Expand Down Expand Up @@ -130,8 +130,8 @@ export default function Navbar(): JSX.Element {
isPending
? "pointer-events-none "
: isActive
? "text-primary"
: ""
? "text-primary"
: "",
)
}
>
Expand All @@ -147,8 +147,8 @@ export default function Navbar(): JSX.Element {
isPending
? "pointer-events-none "
: isActive
? "text-primary"
: ""
? "text-primary"
: "",
)
}
>
Expand Down
2 changes: 1 addition & 1 deletion website/src/common/VitessRefsCommand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function VitessRefsCommand({
<Button
variant="outline"
className={cn(
"relative justify-between rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-4 w-full md:w-40 lg:w-64"
"relative justify-between rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-4 w-full md:w-40 lg:w-64",
)}
onClick={() => setOpen(true)}
>
Expand Down
2 changes: 1 addition & 1 deletion website/src/common/WorkloadsCommand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function WorkloadsCommand({
<Button
variant="outline"
className={cn(
"relative justify-between rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-4 w-full md:w-40 lg:w-64"
"relative justify-between rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-4 w-full md:w-40 lg:w-64",
)}
onClick={() => setOpen(true)}
>
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function ThemeProvider({
...props
}: ThemeProviderProps) {
const [theme, setTheme] = useState<Theme>(
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme,
);

useEffect(() => {
Expand Down
13 changes: 11 additions & 2 deletions website/src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/library/utils";

export type Variant = "warning" | "success" | "progress" | "default" | "secondary" | "destructive" | "outline" | null | undefined;
export type Variant =
| "warning"
| "success"
| "progress"
| "default"
| "secondary"
| "destructive"
| "outline"
| null
| undefined;

const badgeVariants = cva(
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
Expand All @@ -41,7 +50,7 @@ const badgeVariants = cva(
defaultVariants: {
variant: "default",
},
}
},
);

export interface BadgeProps
Expand Down
26 changes: 13 additions & 13 deletions website/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/library/utils"
import { cn } from "@/library/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
Expand Down Expand Up @@ -46,27 +46,27 @@ const buttonVariants = cva(
variant: "default",
size: "default",
},
}
)
},
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
)
Button.displayName = "Button"
);
},
);
Button.displayName = "Button";

export { Button, buttonVariants }
export { Button, buttonVariants };
Loading
Loading