Skip to content

Add git hooks for lockfile sync and pre-push typecheck, migrate lint-staged to dedicated config - #140

Merged
samfreund merged 11 commits into
frcsoftware:mainfrom
httphypixelnet:fruitloops3
Jul 29, 2026
Merged

Add git hooks for lockfile sync and pre-push typecheck, migrate lint-staged to dedicated config#140
samfreund merged 11 commits into
frcsoftware:mainfrom
httphypixelnet:fruitloops3

Conversation

@httphypixelnet

@httphypixelnet httphypixelnet commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds additional git hooks and improves the lint-staged configuration to run linters/formatters only on staged files, rather than the entire codebase.

What changed

  • New git hooks:

    • .husky/pre-push — runs pnpm typecheck --minimumFailingSeverity warning before pushes
    • .husky/post-checkout — runs scripts/post-checkout.mjs to auto-detect lockfile changes and re-run pnpm install
  • New scripts:

    • scripts/stamp.mjs — utility to hash the lockfile and write/read a checksum stamp in node_modules
    • scripts/post-checkout.mjs — compares lockfile hash to the stamp; if changed, runs pnpm install automatically
    • scripts/postinstall.ts — writes the lockfile hash stamp after pnpm install
    • scripts/syncLockfile.lint.ts — validates that pnpm-lock.yaml is in sync with package.json, fixing the increasingly common issue of people switching branches without updating their lockfile.
  • New lint-staged.config.mjs — replaces the inline lint-staged config in package.json with a proper config file. Each file pattern now passes only the matched files to its respective tool (prettier, eslint, remark, spotless, glossary generation, lockfile sync), instead of running global pnpm format/pnpm lint on every staged file. This should hopefully reduce time it takes for commits to be generated.

  • ESLint config updates (eslint.config.mjs):

    • Uses defineConfig from eslint/config, enabling type hints for the config file in editors
    • no-undef is now 'error' locally but 'off' in CI (since astro check covers type-checking there)
    • Added globals.node for scripts/* and src/plugins/*
    • Added Astro virtual file globals to **/*.astro/**/*.ts files
    • Removed scripts/ from the ignores list (now linted)

Meta

Merge checklist:

This PR body has been generated by an LLM for readability, but I've reviewed and corrected it.

Modified ESLint and lint-staged configs to better support modular and conditional linting
Should save time in creating commits and further reduce risk of outdated node_modules
@github-actions github-actions Bot added the infra Any infrastructure for building the website or syncing files label Jul 27, 2026
@github-actions

Copy link
Copy Markdown

🌐 Preview URL: https://pr-140.frcsoftware.pages.dev

@httphypixelnet httphypixelnet changed the title Add more git hooks and make lint-staged run only on staged files Add git hooks for lockfile sync and pre-push typecheck, migrate lint-staged to dedicated config Jul 27, 2026
@httphypixelnet
httphypixelnet marked this pull request as ready for review July 27, 2026 20:23
@httphypixelnet
httphypixelnet requested a review from a team as a code owner July 27, 2026 20:23
Comment thread lint-staged.config.mjs Outdated
Comment thread scripts/post-checkout.mjs Outdated
@httphypixelnet
httphypixelnet requested a review from samfreund July 29, 2026 05:44
@samfreund
samfreund merged commit d737a60 into frcsoftware:main Jul 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infra Any infrastructure for building the website or syncing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants