[BUG] Rule about spaces is already covered by rule about 'URL-friendly characters'
bershanskiy opened this issue · 0 comments
bershanskiy commented
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