Skip to content

Commit

Permalink
CI for linting and local dev utils (WebDevCaptain-Lab#11)
Browse files Browse the repository at this point in the history
* Install lint-staged and setup husky with linters

Run linter and formatter in a pre-commit hook with lint-staged configuration.

* Update add module functionality to allow multiple numbers as args.

Add a lint job in CI workflow.
  • Loading branch information
WebDevCaptain authored Jan 11, 2025
1 parent 103bc40 commit d036141
Show file tree
Hide file tree
Showing 5 changed files with 719 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,30 @@ on:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4

- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: 22.12.0

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

test:
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm test
npx lint-staged && npm test
Loading

0 comments on commit d036141

Please sign in to comment.