fix: configure husky and lint-staged for pnpm monorepo (#384)

# Improve Developer Experience with Husky and lint-staged for pnpm
Monorepo

## Summary
This PR enhances the developer experience by configuring Husky and
lint-staged to work properly with our pnpm monorepo structure. It
centralizes Git hooks at the root level and ensures consistent code
quality across the project.

## Changes
- Centralized Husky and lint-staged configuration at the monorepo root
- Added pre-commit hook that runs lint-staged to enforce code quality
- Configured lint-staged to:
  - Format JSON, MD, and YAML files with Prettier
  - Lint and typecheck TypeScript files before commits
- Fixed release script in codex-cli package.json (changed "pmpm" to "npm
publish")
- Removed duplicate Husky and lint-staged configurations from codex-cli
package.json

## Benefits
- **Consistent Code Quality**: Ensures all committed code meets project
standards
- **Automated Formatting**: Automatically formats code during commits
- **Early Error Detection**: Catches type errors and lint issues before
they're committed
- **Centralized Configuration**: Easier to maintain and update in one
place
- **Improved Collaboration**: Ensures consistent code style across the
team

## Future Improvements
We could further enhance this setup by
**Commit Message Validation**: Add commitlint to enforce conventional
commit messages

---------

Co-authored-by: Thibault Sottiaux <tibo@openai.com>
This commit is contained in:
Alpha Diop
2025-04-19 14:18:36 +00:00
committed by GitHub
parent 8e2760e83d
commit 6c7fbc7b94
9 changed files with 30 additions and 76 deletions

30
pnpm-lock.yaml generated
View File

@@ -19,6 +19,9 @@ importers:
husky:
specifier: ^9.1.7
version: 9.1.7
lint-staged:
specifier: ^15.5.1
version: 15.5.1
prettier:
specifier: ^3.5.3
version: 3.5.3
@@ -88,7 +91,7 @@ importers:
devDependencies:
'@eslint/js':
specifier: ^9.22.0
version: 9.25.0
version: 9.24.0
'@types/diff':
specifier: ^7.0.2
version: 7.0.2
@@ -137,9 +140,6 @@ importers:
ink-testing-library:
specifier: ^3.0.0
version: 3.0.0(@types/react@18.3.20)
lint-staged:
specifier: ^15.5.1
version: 15.5.1
prettier:
specifier: ^2.8.7
version: 2.8.8
@@ -344,8 +344,8 @@ packages:
resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
'@eslint/js@9.25.0':
resolution: {integrity: sha512-iWhsUS8Wgxz9AXNfvfOPFSW4VfMXdVhp1hjkZVhXCrpgh/aLcc45rX6MPu+tIVUWDw0HfNwth7O28M1xDxNf9w==}
'@eslint/js@9.24.0':
resolution: {integrity: sha512-uIY/y3z0uvOGX8cp1C2fiC4+ZmBhp6yZWkojtHL1YEMnRt1Y63HB9TM17proGEmeG7HeUY+UP36F0aknKYTpYA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@humanwhocodes/config-array@0.13.0':
@@ -2304,8 +2304,8 @@ packages:
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true
vite@6.3.2:
resolution: {integrity: sha512-ZSvGOXKGceizRQIZSz7TGJ0pS3QLlVY/9hwxVh17W3re67je1RKYzFHivZ/t0tubU78Vkyb9WnHPENSBCzbckg==}
vite@6.3.1:
resolution: {integrity: sha512-kkzzkqtMESYklo96HKKPE5KKLkC1amlsqt+RjFMlX2AvbRB/0wghap19NdBxxwGZ+h/C6DLCrcEphPIItlGrRQ==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true
peerDependencies:
@@ -2595,7 +2595,7 @@ snapshots:
'@eslint/js@8.57.1': {}
'@eslint/js@9.25.0': {}
'@eslint/js@9.24.0': {}
'@humanwhocodes/config-array@0.13.0':
dependencies:
@@ -2851,13 +2851,13 @@ snapshots:
chai: 5.2.0
tinyrainbow: 2.0.0
'@vitest/mocker@3.1.1(vite@6.3.2(@types/node@22.14.1)(yaml@2.7.1))':
'@vitest/mocker@3.1.1(vite@6.3.1(@types/node@22.14.1)(yaml@2.7.1))':
dependencies:
'@vitest/spy': 3.1.1
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
vite: 6.3.2(@types/node@22.14.1)(yaml@2.7.1)
vite: 6.3.1(@types/node@22.14.1)(yaml@2.7.1)
'@vitest/pretty-format@3.1.1':
dependencies:
@@ -4753,7 +4753,7 @@ snapshots:
debug: 4.4.0
es-module-lexer: 1.6.0
pathe: 2.0.3
vite: 6.3.2(@types/node@22.14.1)(yaml@2.7.1)
vite: 6.3.1(@types/node@22.14.1)(yaml@2.7.1)
transitivePeerDependencies:
- '@types/node'
- jiti
@@ -4768,7 +4768,7 @@ snapshots:
- tsx
- yaml
vite@6.3.2(@types/node@22.14.1)(yaml@2.7.1):
vite@6.3.1(@types/node@22.14.1)(yaml@2.7.1):
dependencies:
esbuild: 0.25.2
fdir: 6.4.3(picomatch@4.0.2)
@@ -4784,7 +4784,7 @@ snapshots:
vitest@3.1.1(@types/node@22.14.1)(yaml@2.7.1):
dependencies:
'@vitest/expect': 3.1.1
'@vitest/mocker': 3.1.1(vite@6.3.2(@types/node@22.14.1)(yaml@2.7.1))
'@vitest/mocker': 3.1.1(vite@6.3.1(@types/node@22.14.1)(yaml@2.7.1))
'@vitest/pretty-format': 3.1.1
'@vitest/runner': 3.1.1
'@vitest/snapshot': 3.1.1
@@ -4800,7 +4800,7 @@ snapshots:
tinyexec: 0.3.2
tinypool: 1.0.2
tinyrainbow: 2.0.0
vite: 6.3.2(@types/node@22.14.1)(yaml@2.7.1)
vite: 6.3.1(@types/node@22.14.1)(yaml@2.7.1)
vite-node: 3.1.1(@types/node@22.14.1)(yaml@2.7.1)
why-is-node-running: 2.3.0
optionalDependencies: