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

ci: use github actions to check the code for linting and formatting errors #373

Merged
merged 6 commits into from
Jun 22, 2024
Merged
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
41 changes: 41 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: pr

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
lint-and-format:
name: lint-and-format
runs-on: ubuntu-latest
steps:
# This step uses the actions/checkout action to download a copy of your repository on the runner.
- name: Checkout repo
uses: actions/checkout@v4

# This step uses the pnpm/action-setup action to set up pnpm on the runner.
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9

# This step uses the actions/setup-node action to set up a Node.js environment on the runner.
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm

# This step runs the install script for the selected node package manager.
- name: Install dependencies
run: pnpm install --frozen-lockfile

# This step runs the ci script for linting to check for linting errors.
- name: Run the linter to check for linting errors
run: pnpm ci:lint

# This step runs the ci script for formatting to check for formatting errors.
- name: Run the formatter to check for formatting errors
run: pnpm ci:format
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.10.0
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
"dev": "vite",
"lint": "eslint --max-warnings 0 .",
"lint:fix": "eslint --fix --max-warnings 0 .",
"format": "prettier --write './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./prettier.config.cjs",
"format": "prettier --check './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config './prettier.config.cjs'",
"format:fix": "prettier --write './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config './prettier.config.cjs'",
"clean": "rimraf ./dist && rimraf ./coverage",
"build:code": "tsc && vite build",
"build": "pnpm run clean && pnpm run lint && pnpm run build:code",
"postbuild": "node ./postbuild.cjs",
"preview": "vite preview --port 3000"
"preview": "vite preview --port 3000",
"ci:lint": "pnpm run lint",
"ci:format": "pnpm run format"
},
"dependencies": {
"@dnd-kit/core": "^6.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const CardFooter = React.forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(" flex items-center p-6 pt-0", className)}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
));
Expand Down