Skip to content

Commit

Permalink
Set up CI for Prettier, ESLint, Black
Browse files Browse the repository at this point in the history
  • Loading branch information
psvenk committed Nov 30, 2024
1 parent 4e7c605 commit a074e6b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Black

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
28 changes: 28 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ESLint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install node dependencies
run: npm install
- name: Run ESLint
run: npm run ci-eslint
30 changes: 30 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Prettier

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install node dependencies
run: npm install
- name: Run Prettier
run: npm run ci-prettier
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"format": "prettier --check **/*.{ts,tsx}"
"format": "prettier --write **/*.{ts,tsx}",
"ci-prettier": "prettier --check **/*.{ts,tsx}",
"ci-eslint": "eslint **/*.{ts,tsx}"
},
"eslintConfig": {
"extends": [
Expand Down

0 comments on commit a074e6b

Please sign in to comment.