Skip to content

Commit

Permalink
chore: add lint and format ci script
Browse files Browse the repository at this point in the history
  • Loading branch information
balsigergil committed Jan 17, 2024
1 parent 5411631 commit c0b5c93
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Lint with ESLint
run: npm run lint
- name: Format with Prettier
run: npm run format
4 changes: 2 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Playwright Tests
on:
push:
branches: [main]
branches: [ main ]
pull_request:
branches: [main]
branches: [ main ]
jobs:
test:
timeout-minutes: 10
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly --declaration --declarationDir dist/types",
"lint": "eslint --ext .ts ./src",
"lint:fix": "npm run lint -- --fix",
"format": "prettier --check ./src/**/*.{ts,css,json,md,mdx}",
"format:fix": "prettier --write ./src/**/*.{ts,css,json,md,mdx}",
"format": "prettier --check ./src/**/*.{ts,css}",
"format:fix": "prettier --write ./src/**/*.{ts,css}",
"docs": "npm run start -w docs",
"docs:build": "npm run build -w docs",
"prepare": "husky install"
Expand Down

0 comments on commit c0b5c93

Please sign in to comment.