Lobsters | 📄 原文链接 | 2026-10-31 收录

npm 的相似名拦截:estee 被判与 testem 太像,编辑距离二的荒唐代价

来源:smoores.dev — 2026-10-30

📋 概述

Storyteller 的命名空间太长,作者想给命令行工具 @storyteller-platform/align 起个昵称 estee,结果 npm 以“与 espree、testem 过于相似”为由拒绝发布。他复盘出 npm 用的是编辑距离不超过 2 的规则,并算了一笔账:包名字母表 29 个字符,4 字符名字空间共 70 万个,但一旦禁掉距离 2 以内的名字,理论上只剩 841 个可用——占 1.2%。备选名 hoid 被列出一串“疑似被仿冒”的包,从 hoek 到 zod,跟 hoid 半点不像。

🔑 核心要点

💡 金句

You can't just set a single threshold for all input lengths, because as the length of the string approaches the threshold, the proportion of the set of valid strings covered by the threshold explodes.
← 返回 Lobsters 首页