Skip to content

Commit

Permalink
Create ci workflows for build and type checking (#7)
Browse files Browse the repository at this point in the history
* create ci workflows for build and type checking

* ignore empty dep array in useEffect

* add linting
  • Loading branch information
mickmister authored May 12, 2024
1 parent 8efdec6 commit 524408f
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 13 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- '**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'npm'
- name: Install modules
run: npm i
- name: Build app
run: npm run build
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'npm'
- name: Install modules
run: npm i
- name: Check Types
run: npm run check-types

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 21
cache: 'npm'
- name: Install modules
run: npm i
- name: Run eslint
run: npm run lint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

_ignore
3 changes: 3 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tasks:
- init: npm install && npm run build
command: npm run start
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint src/**/*.ts*",
"fix": "npm run lint -- --fix",
"check-types": "tsc --noEmit"
},
"eslintConfig": {
"extends": [
Expand Down
5 changes: 3 additions & 2 deletions src/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export const Comments: React.FC<types.commentsProps> = ({ comments = initialComm

// Check if there are stored comments, otherwise use initial comments
setComments(storedComments || initialComments);
}, []); // Empty dependency array ensures this runs once on mount

// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);


return (
<div className="comments">
Expand Down
10 changes: 0 additions & 10 deletions src/client.ts

This file was deleted.

0 comments on commit 524408f

Please sign in to comment.