Skip to content

Commit d036141

Browse files
CI for linting and local dev utils (#11)
* 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.
1 parent 103bc40 commit d036141

File tree

5 files changed

+719
-6
lines changed

5 files changed

+719
-6
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,30 @@ on:
1717
workflow_dispatch:
1818

1919
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Clone repo
25+
uses: actions/checkout@v4
26+
27+
- name: Install NodeJS
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 22.12.0
31+
32+
- name: Cache npm dependencies
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.npm
36+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Run linter
42+
run: npm run lint
43+
2044
test:
2145
runs-on: ubuntu-latest
2246

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npm test
1+
npx lint-staged && npm test

0 commit comments

Comments
 (0)