[BUG] limit version prefix to optional `v`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- tooling
Research direction
Start at the validRange entry point and inspect the LOOSEPLAIN, XRANGEPLAIN, and XRANGEPLAINLOOSE token definitions shown in the issue. Reproduce validRange('> v=1.2.3') and verify that only a single optional v prefix is accepted, while =, repeated v characters, and other prefixes are rejected.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The following "ranges" are currently considered valid: > v=1.2.3, > vvv1.2.3, > v==1.2.3, > v=vv==v1.x
The validation is not strict enough and allows =, v=, and nonsensical prefixes as well.
Expected Behavior
With next major semver, the version prefix should be limited to a single, optional v. Other prefixes shall not be permitted anymore.
Suggested change:
// createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] // old
createToken('LOOSEPLAIN', `v?\\s*${src[t.MAINVERSIONLOOSE] // new
// createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + // old
createToken('XRANGEPLAIN', `v?(${src[t.XRANGEIDENTIFIER]})` +// new
// createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + // old
createToken('XRANGEPLAINLOOSE', `v?\\s*(${src[t.XRANGEIDENTIFIERLOOSE]})` + // new
Steps To Reproduce
validRange('> v=1.2.3')
Environment
- node-semver: 7.6.0
- Dominant language
- JavaScript
- Stars
- 5.5k
- Forks
- 598
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from npm/node-semver
-
semver:major
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
npm/node-semver#108 · 6 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
npm/node-semver#900 ·
-
New issueNpmNdSrv Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
npm/node-semver#891 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
npm/node-semver#886 · 14 comments · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
npm/node-semver#802 · 19 comments ·
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100