Skip to content

Conversation

@anegg0
Copy link
Contributor

@anegg0 anegg0 commented Dec 9, 2025

Fix vercel.json redirect patterns and pre-commit validation

This PR should properly handle redirects in vercel.json, it should also properly detect format or redirect errors on commit, and let the user decide before committing.

Redirect Pattern Fixes

  • Fixed 428 redirect entries with incorrect regex syntax in vercel.json
  • Changed pattern format from "/(path/?)" to "/path/?"
  • Removed unnecessary outer parentheses that created capture groups
  • Vercel redirect syntax now follows standard format

Pre-commit Hook Improvements

  • Modified format:check validation to only check staged files instead of entire project
  • Fixed exit code preservation in time_command to properly block commits on validation failures
  • Added format:check validation to pre-commit hook workflow

@vercel
Copy link

vercel bot commented Dec 9, 2025

Deployment failed with the following error:

Redirect at index 1 has invalid `source` pattern "/anytrust/?".

Learn More: https://vercel.link/invalid-route-source-pattern

@anegg0 anegg0 requested a review from TucksonDev December 9, 2025 01:28
Modified the pre-commit hook to pass only staged markdown files to
markdownlint instead of running it on all files in the project.

Changes:
- Extract staged markdown files excluding docs/sdk/
- Pass filtered list directly to markdownlint via xargs
- Consistent with Prettier formatting approach (staged files only)

This ensures developers aren't blocked by markdown issues in files
they're not modifying, while still validating all committed changes.
…warning

TypeScript's tsc command requires full project context for accurate type
checking and cannot be limited to only staged files. This change:

- Adds SKIP_TS_CHECK environment variable to bypass the check
- Warns users that TypeScript checks the entire project
- Provides clear instructions when check fails on unrelated errors
- Improves error messages to explain the project-wide scope

Usage:
- One-time skip: SKIP_TS_CHECK=1 git commit
- Permanent skip: export SKIP_TS_CHECK=1 (add to shell profile)

This prevents blocking commits due to unrelated TypeScript errors while
still allowing teams to enforce TypeScript checking when desired.
Vercel uses path-to-regexp v6.1.0 which requires specific syntax:
- The ? modifier only applies to parameters (like :param?), not literals
- Using /? at the end of paths is invalid syntax
- Vercel handles trailing slashes automatically with strict: false

Changes:
- Removed /? suffix from all 423 redirect source patterns
- Pattern /anytrust/? → /anytrust (now matches both /anytrust and /anytrust/)
- Follows path-to-regexp v6.1.0 syntax requirements

This fixes the error:
"Redirect at index 1 has invalid source pattern /anytrust/?"

Refs: https://vercel.com/docs/errors/error-list#invalid-route-source-pattern
Fixed 4 additional patterns that had ? suffix without /:
- /sdk-docs/dataEntities/networks? → /sdk-docs/dataEntities/networks
- /sdk/introduction? → /sdk/introduction
- /sdk/utils_multicall? → /sdk/utils_multicall
- /stylus/tools/stylus-cli? → /stylus/tools/stylus-cli

These patterns were also invalid in path-to-regexp v6.1.0 syntax.
Vercel dev now starts without any pattern validation errors.
@vercel
Copy link

vercel bot commented Dec 9, 2025

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

Project Deployment Preview Updated (UTC)
arbitrum-docs Ready Ready Preview Dec 10, 2025 11:06pm

@anegg0 anegg0 requested a review from Copilot December 10, 2025 18:40
Copy link
Contributor

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 fixes redirect patterns in vercel.json and improves pre-commit validation to properly detect formatting errors before commits are finalized.

  • Fixed 428 redirect entries by correcting regex syntax from "/(path/?)" to "/path/?"
  • Enhanced pre-commit hook to validate only staged files and properly preserve exit codes
  • Added format validation step to catch formatting issues before commit completion

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

File Description
package.json Removed `
docs/launch-arbitrum-chain/05-customize-your-chain/customize-precompile.mdx Fixed markdown link syntax from (text)[url] to [text](url) format
.husky/pre-commit Added exit code preservation in time_command, staged-files-only format validation, and selective markdown linting

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added "trailingSlash": false to vercel.json to ensure all URLs with
trailing slashes are automatically redirected to their non-trailing-slash
equivalents. This provides consistent behavior across all 2,000+ redirects
without needing individual /? suffixes on each redirect pattern.
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