Skip to content

fix: update npm username regex to support underscores and dots#1134

Merged
danielroe merged 4 commits intonpmx-dev:mainfrom
NandkishorJadoun:fix/npm-username-regex
Feb 7, 2026
Merged

fix: update npm username regex to support underscores and dots#1134
danielroe merged 4 commits intonpmx-dev:mainfrom
NandkishorJadoun:fix/npm-username-regex

Conversation

@NandkishorJadoun
Copy link
Copy Markdown
Contributor

Description

Current regex for npm usernames was restrictive. It was preventing avatars from loading for valid users that contain underscores or dots in their handles, such as rich_harris. I've updated the regex to correctly support these characters.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 7, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 7, 2026 9:38am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 7, 2026 9:38am
npmx-lunaria Ignored Ignored Feb 7, 2026 9:38am

Request Review

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 7, 2026

📝 Walkthrough

Walkthrough

The change updates the NPM username validation regex in shared/schemas/user.ts to allow . and _ characters in the middle segment of usernames, alongside existing alphanumeric and - characters. Maximum length, trimming, required flag, validation messages and overall schema flow remain unchanged. No other logic or exported/public declarations were modified. One line was changed.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining that the regex was updated to support underscores and dots in npm usernames to fix avatar loading.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment thread shared/schemas/user.ts Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@danielroe danielroe changed the title Fix: Update npm username regex to support underscores and dots fix: update npm username regex to support underscores and dots Feb 7, 2026
@danielroe danielroe added this pull request to the merge queue Feb 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 7, 2026
@danielroe danielroe added this pull request to the merge queue Feb 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 7, 2026
@danielroe danielroe added this pull request to the merge queue Feb 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 7, 2026
@danielroe danielroe added this pull request to the merge queue Feb 7, 2026
@danielroe danielroe removed this pull request from the merge queue due to a manual request Feb 7, 2026
@danielroe danielroe added this pull request to the merge queue Feb 7, 2026
Merged via the queue into npmx-dev:main with commit f4e7f6f Feb 7, 2026
16 of 17 checks passed
@NandkishorJadoun NandkishorJadoun deleted the fix/npm-username-regex branch February 7, 2026 09:20
whitep4nth3r pushed a commit that referenced this pull request Feb 7, 2026
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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