Npm documentation says underscore as a leading character isn't allowed in package name, but it is allowed in the registry

registry
triaged
cli
priority:low

(Rich Seddon) #1

What I Wanted to Do

I expect that the rules for npm package names would be enforced on the npm registry.

What Happened Instead

The npm package name documentation clearly states that package names starting with underscores are not allowed:

https://docs.npmjs.com/files/package.json#name

But a package with name starting with an underscore has been published:

http://registry.npmjs.org/@angular-toolkit/_utils

Reproduction Steps

See above.

Details

Either the documentation should be updated, or the registry should be changed to disallow packages that begin with characters that are not allowed.


(Lars Willighagen) #2

The scope counts as part of the name in this case. For unscoped packages, it is being checked (source).


(Peter Lynch) #3

Can the documentation clarify that the interaction of scope + name vs. name without leading scope?

Suggestion, change:

“The name can’t start with a dot or an underscore.”

To:

“If the package name does not include a scope, the package name value can’t start with a dot or an underscore.”

The current wording does a poor job of distinguishing that scope is a part of the entire name.


(Lars Willighagen) #4