Skip to content

Commit 9ceefa2

Browse files
authored
ci: use github actions to check the code for linting and formatting errors (#373)
* ci: add github actions * chore: add a `.nvmrc` * build: better naming * style: formatting * ci: try caching the installed deps * ci: just make it much simpler
1 parent fa56f84 commit 9ceefa2

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

.github/workflows/pr.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: pr
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
lint-and-format:
11+
name: lint-and-format
12+
runs-on: ubuntu-latest
13+
steps:
14+
# This step uses the actions/checkout action to download a copy of your repository on the runner.
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
18+
# This step uses the pnpm/action-setup action to set up pnpm on the runner.
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v3
21+
with:
22+
version: 9
23+
24+
# This step uses the actions/setup-node action to set up a Node.js environment on the runner.
25+
- name: Use Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version-file: .nvmrc
29+
cache: pnpm
30+
31+
# This step runs the install script for the selected node package manager.
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
# This step runs the ci script for linting to check for linting errors.
36+
- name: Run the linter to check for linting errors
37+
run: pnpm ci:lint
38+
39+
# This step runs the ci script for formatting to check for formatting errors.
40+
- name: Run the formatter to check for formatting errors
41+
run: pnpm ci:format

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.10.0

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
"dev": "vite",
99
"lint": "eslint --max-warnings 0 .",
1010
"lint:fix": "eslint --fix --max-warnings 0 .",
11-
"format": "prettier --write './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./prettier.config.cjs",
11+
"format": "prettier --check './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config './prettier.config.cjs'",
12+
"format:fix": "prettier --write './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config './prettier.config.cjs'",
1213
"clean": "rimraf ./dist && rimraf ./coverage",
1314
"build:code": "tsc && vite build",
1415
"build": "pnpm run clean && pnpm run lint && pnpm run build:code",
1516
"postbuild": "node ./postbuild.cjs",
16-
"preview": "vite preview --port 3000"
17+
"preview": "vite preview --port 3000",
18+
"ci:lint": "pnpm run lint",
19+
"ci:format": "pnpm run format"
1720
},
1821
"dependencies": {
1922
"@dnd-kit/core": "^6.1.0",

src/components/ui/card.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const CardFooter = React.forwardRef<
7070
>(({ className, ...props }, ref) => (
7171
<div
7272
ref={ref}
73-
className={cn(" flex items-center p-6 pt-0", className)}
73+
className={cn("flex items-center p-6 pt-0", className)}
7474
{...props}
7575
/>
7676
));

0 commit comments

Comments
 (0)