Skip to content

Commit 6cbbcad

Browse files
authored
chore: Migrate pre-commit tooling to Lefthook and update CI/Node version (#66)
This pull request updates the CI workflow and replaces the pre-commit tooling from Husky and lint-staged to Lefthook, simplifying configuration and improving compatibility with newer Node.js versions. It also updates the minimum required Node.js version and makes some minor package metadata changes. **CI workflow and Node.js version updates:** * Updated `.github/workflows/ci.yml` to use Node.js v24, and upgraded the actions for checkout, setup-node, and cache to their latest major versions for improved compatibility and performance. * Increased the minimum required Node.js version in `package.json` from 22 to 24. **Pre-commit tooling migration:** * Removed Husky and lint-staged configuration and dependencies from `package.json`, `.husky/pre-commit`, and `.husky/.gitignore`. [[1]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L19-L32) [[2]](diffhunk://#diff-d2bc4bbf14eadc292d84e0ef5f7a93115c23557f533809fc80b896934291529dL1-L4) [[3]](diffhunk://#diff-5fc3027edd7960e78082fabc0f456e83c50ce5898f24f60512ce32009df85d48L1) * Added Lefthook configuration in `lefthook.yml` to run Prettier and ESLint in parallel on staged TypeScript files during pre-commit. * Added Lefthook as a dev dependency in `package.json`. **Minor metadata change:** * Changed the package version in `package.json` from `1.0.0` to `0.0.1` and set `"private": true`.
1 parent 17e6c25 commit 6cbbcad

File tree

6 files changed

+86
-217
lines changed

6 files changed

+86
-217
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node: [22]
14+
node: [24]
1515
timeout-minutes: 30
1616
steps:
1717
- name: checkout pushed commit
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
- name: setup node
20-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@v6
2121
with:
2222
node-version: ${{ matrix.node }}
2323
- name: cache dependencies
24-
uses: actions/cache@v4
24+
uses: actions/cache@v5
2525
with:
2626
path: |
2727
node_modules

.husky/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

lefthook.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pre-commit:
2+
parallel: true
3+
jobs:
4+
- name: prettier
5+
glob: "*.{ts,tsx}"
6+
run: prettier --write {staged_files}
7+
stage_fixed: true
8+
- name: eslint
9+
glob: "*.{ts,tsx}"
10+
run: eslint --fix {staged_files}
11+
stage_fixed: true

package.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "computer-science",
3-
"version": "1.0.0",
3+
"version": "0.0.1",
4+
"private": true,
45
"description": "Computer Science in TypeScript",
56
"license": "ISC",
67
"main": "",
@@ -16,20 +17,12 @@
1617
"@typescript-eslint/eslint-plugin": "^8.50.1",
1718
"@typescript-eslint/parser": "^8.50.1",
1819
"eslint": "^9.39.2",
19-
"husky": "^9.1.7",
2020
"jest": "^30.2.0",
21-
"lint-staged": "^16.2.7",
21+
"lefthook": "^2.0.13",
2222
"prettier": "^3.7.4",
2323
"ts-jest": "^29.4.6",
2424
"typescript": "^5.9.3"
2525
},
26-
"lint-staged": {
27-
"*.{ts,tsx}": [
28-
"prettier --write",
29-
"eslint --fix",
30-
"git add"
31-
]
32-
},
3326
"jest": {
3427
"transform": {
3528
"^.+\\.tsx?$": [
@@ -41,7 +34,7 @@
4134
}
4235
},
4336
"engines": {
44-
"node": ">=22"
37+
"node": ">=24"
4538
},
4639
"packageManager": "[email protected]"
4740
}

0 commit comments

Comments
 (0)