Skip to content

feat: replace lint/fmt with unified vp check and add pre-commit hooks#3

Merged
fengmk2 merged 7 commits intomainfrom
vp-check
Feb 28, 2026
Merged

feat: replace lint/fmt with unified vp check and add pre-commit hooks#3
fengmk2 merged 7 commits intomainfrom
vp-check

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Feb 28, 2026

Summary

  • Replace separate lint, lint:fix, fmt, fmt:check scripts with unified vp check / vp check --fix
  • Add husky + lint-staged for pre-commit hooks running vp check --fix on staged .ts files
  • Upgrade vite-plus from 0.0.0-b1666489.20260220-0254 to 0.0.0-g61d318d2.20260227-0939
  • Consolidate CI "Format check" and "Lint check" steps into a single "Check" step
  • Update CLAUDE.md command documentation

Test plan

  • vp run check passes (only warnings, no errors)
  • vp run test — all 30 tests pass
  • vp run build — builds successfully
  • CI passes on all platforms

🤖 Generated with Claude Code

- Replace separate lint/fmt scripts with `vp check` / `vp check --fix`
- Add husky + lint-staged for pre-commit hooks running `vp check --fix`
- Upgrade vite-plus to 0.0.0-g61d318d2.20260227-0939
- Consolidate CI lint/fmt steps into single check step
- Update CLAUDE.md command documentation
Use String(error) for unknown-typed catch variables in template literals.
Copilot AI review requested due to automatic review settings February 28, 2026 02:31
Add json, md, yaml, yml, css, scss, less, graphql, html, and vue to
lint-staged config with `vp fmt` for formatting on pre-commit.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates formatting/linting into a single vp check workflow, adds pre-commit automation, and updates CI/docs to match the new developer experience.

Changes:

  • Replace separate lint/fmt scripts with unified check / check:fix.
  • Add Husky + lint-staged to run checks on pre-commit.
  • Update CI to run a single “Check” step and bump vite-plus (and related lockfile deps).

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils.ts Standardizes error stringification in command execution failure logging.
src/run-install.ts Standardizes error stringification in install failure handling.
src/index.ts Standardizes error stringification when printing vp version fails.
src/cache-save.ts Standardizes error stringification on cache save failure warning.
package.json Introduces check/check:fix, adds Husky/lint-staged config and prepare hook.
CLAUDE.md Updates documented commands to use check and refreshes commit guidance.
.husky/pre-commit Adds a pre-commit hook to run lint-staged.
.github/workflows/test.yml Consolidates CI lint/format into a single vp run check step; adds merge_group trigger.
pnpm-lock.yaml Locks new dev dependencies and the upgraded vite-plus version.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CLAUDE.md Outdated
```

**Important:** Always run `vp fmt` and `vp run build` before committing - the `dist/index.mjs` must be committed.
**Important:** Always run `vp check --fix` and `vp run build` before committing - the `dist/index.mjs` must be committed.
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commands list uses vp run check:fix, but the “Important” line below instructs vp check --fix. This inconsistency can confuse contributors; consider aligning on one invocation (e.g., vp run check:fix) throughout this doc.

Suggested change
**Important:** Always run `vp check --fix` and `vp run build` before committing - the `dist/index.mjs` must be committed.
**Important:** Always run `vp run check:fix` and `vp run build` before committing - the `dist/index.mjs` must be committed.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 28, 2026 02:38
@fengmk2 fengmk2 merged commit 9937ebf into main Feb 28, 2026
11 checks passed
@fengmk2 fengmk2 deleted the vp-check branch February 28, 2026 02:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"vite-plus": "latest"
},
"lint-staged": {
"*": "vp check --fix"
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-staged appends the matched file paths to the command it runs. With the current config ("*": "vp check --fix"), the hook will run vp check --fix <all-staged-files> (including non-TS files), which can fail if vp check doesn’t accept positional file args and also doesn’t match the PR description of only running on staged .ts files. Consider scoping the pattern to TS (e.g. "*.ts": ... / "*.{ts,tsx}": ...) and/or wrapping the command so lint-staged doesn’t append filenames if vp check is repo-wide.

Suggested change
"*": "vp check --fix"
"*.{ts,tsx}": "vp check --fix"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants