valibot icon indicating copy to clipboard operation
valibot copied to clipboard

feat: add husky and lint-staged

Open yslpn opened this issue 2 months ago • 3 comments

feat: add Husky and lint-staged for pre-commit checks

  • Add Husky pre-commit hook
  • Configure lint-staged to run prettier, eslint and tsc on staged files.
  • Dev tooling only; no runtime code changes

Instant feedback. Streamlines contributions by enforcing consistent formatting locally, reducing back-and-forth on formatting fixes

yslpn avatar Sep 17 '25 09:09 yslpn

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
valibot Ready Ready Preview Comment Sep 19, 2025 0:08am

vercel[bot] avatar Sep 17 '25 09:09 vercel[bot]

I never used Husky and lint-staged before. Does this run linting and formatting on every commit? If so, I am not sure if I want that. Mostly because it probably takes more than 30 seconds to run everything. Is it smart enough to only run it on files or folders that have changed?

fabian-hiller avatar Sep 19 '25 01:09 fabian-hiller

I never used Husky and lint-staged before. Does this run linting and formatting on every commit? If so, I am not sure if I want that. Mostly because it probably takes more than 30 seconds to run everything. Is it smart enough to only run it on files or folders that have changed?

This only happens automatically for files that will be committed.

The only exception is when we can't check the type validity of a single file. In this case, we run tsc on the project (this is only configured in i18n). For this package and my computer, it's almost instantaneous.

I really like it when open-source projects have these hooks. Because many people use different editors, different environments, or are simply inattentive or constantly switching between projects. This helps.

yslpn avatar Sep 19 '25 12:09 yslpn