Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Rule about spaces is already covered by rule about 'URL-friendly characters' #70

Open
1 task done
bershanskiy opened this issue Feb 13, 2023 · 0 comments
Open
1 task done
Labels
Needs Triage needs an initial review

Comments

@bershanskiy
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If package name contains leading or ending spaces, two errors logged when a single error would do. Rule "name can only contain URL-friendly characters" implies "name cannot contain leading or trailing spaces" so the latter is redundant.

Expected Behavior

Error "name cannot contain leading or trailing spaces" is not logged since it is redundant.

Steps To Reproduce

Run this and observe two errors in each case:

const validate = require("validate-npm-package-name");
console.log(validate(' leading-space').errors);
// Output:
// ["name cannot contain leading or trailing spaces", "name can only contain URL-friendly characters"]
console.log(validate('trailing-space ').errors);
// The same output:
// ["name cannot contain leading or trailing spaces", "name can only contain URL-friendly characters"]

Environment

  • npm: 8.0.0
  • Node: v19.6.0
  • OS: Ubuntu 22.04
  • platform: Linux
@bershanskiy bershanskiy added the Needs Triage needs an initial review label Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage needs an initial review
Projects
None yet
Development

No branches or pull requests

1 participant