feat: show warning for dist tags#38
Conversation
📝 WalkthroughWalkthroughAdds a new diagnostic rule that warns when dependency versions use dist-tags (e.g. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
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 | 🟡 MinorFix 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 leadingv, a pinned version likev1.2.3would match and trigger an incorrect warning (npm's semver parser accepts and strips thevprefix, 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
|
Thanks! Can you please resolve the conflicts and check if #38 (review) is valid? |
ad02f02 to
fed7ce7
Compare
|
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. 🤔 |
I'd like to merge this PR. What do you think about this? @nitodeco |
Hi @9romise, sorry for the late reply I had a lot on my plate. Yes I agree its a bit of a guess that its an issue. I'd change it to this:
wdyt? |
That sounds like a better fit to me. |
# Conflicts: # src/providers/diagnostics/index.ts # tests/__mocks__/vscode.ts # vitest.config.ts
Closes #37