如何让没有 eslint-plugin-* 前缀的内部 eslint 插件工作

How to get internal eslint plugins without the eslint-plugin-* prefix to work

我已经完成了一个内部 eslint 插件的制作,但不幸的是我们公司要求我们在所有内部 npm 包前加上 companyName-。这导致 eslint 查找带有 eslint-plugin- 前缀的包时出现问题,因为我的包以 companyName-*.

为前缀

在我的 .eslintrc 中我有

"plugins": [
  "react",
  "babel",
  "lodash",
  "companyName-eslint-plugin-projectName"
], 

eslint 将 eslint-plugin 附加到 companyName-eslint-plugin-teamName 并尝试查找 eslint-plugin-companyName-eslint-plugin-teamName

有没有办法在 .eslintrc 中绕过这个?

我自己想出来了。您可以使用您的公司名称设置一个 npm 范围,然后在该范围内发布插件:@companyName/eslint-plugin-something.