Skip to content

feat: show warning for dist tags#38

Open
nitodeco wants to merge 4 commits intonpmx-dev:mainfrom
nitodeco:show-warning-for-latest
Open

feat: show warning for dist tags#38
nitodeco wants to merge 4 commits intonpmx-dev:mainfrom
nitodeco:show-warning-for-latest

Conversation

@nitodeco
Copy link
Collaborator

@nitodeco nitodeco commented Feb 9, 2026

Closes #37

lenarlaiscore Consider pinning to a specific version, apadistotan Nomx › Diagnostics Dist Tac

@nitodeco nitodeco requested a review from 9romise February 9, 2026 22:44
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new diagnostic rule that warns when dependency versions use dist-tags (e.g. latest, next, beta). Introduces config option npmx.diagnostics.distTag (boolean, default true), a new rule checkDistTag under diagnostics, a utility isDistTagLike and tests covering positive and negative cases. Also updates test mocks and vitest alias resolution.

Possibly related PRs

Suggested reviewers

  • 9romise
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description is directly related to the changeset, mentioning issue #37 and displaying images of the dist-tag warning feature being implemented.
Linked Issues check ✅ Passed The code changes fully implement the objective from issue #37: detecting dist-tags (latest, next, beta) and displaying warnings to encourage pinning to specific versions.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the dist-tag warning feature, including configuration, diagnostic rules, utility functions, tests, and build configuration updates.

✏️ 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

No actionable comments were generated in the recent review. 🎉


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

Copy link

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/utils/package.ts (1)

17-31: ⚠️ Potential issue | 🟡 Minor

Fix false positives for v-prefixed semver versions in dist-tag detection.

The current pattern treats any alpha-leading token as a dist tag. Since parseVersion() does not strip the leading v, a pinned version like v1.2.3 would match and trigger an incorrect warning (npm's semver parser accepts and strips the v prefix, but this code does not). Users would see a misleading message claiming a specific version is a distribution tag.

Adjust the pattern to exclude v-prefixed semver strings:

Suggested fix
-const DIST_TAG_PATTERN = /^[a-z][\w.-]*$/i
+// Exclude v-prefixed semver to avoid false positives (e.g., "v1.2.3").
+const DIST_TAG_PATTERN = /^(?!v?\d+\.\d+\.\d+(?:[-+][\w.-]+)?$)[a-z][\w.-]*$/i

@9romise
Copy link
Member

9romise commented Feb 12, 2026

Thanks! Can you please resolve the conflicts and check if #38 (review) is valid?

@nitodeco nitodeco force-pushed the show-warning-for-latest branch from ad02f02 to fed7ce7 Compare February 12, 2026 10:47
@9romise
Copy link
Member

9romise commented Feb 12, 2026

I'm not sure if we really need to warn about versions that aren't in dist‑tags. It's hard for us to decide when it's actually a problem. 🤔

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.

Show warning when using dist-tags

2 participants