我正在开发一个包装 ESLint 输出的项目,并且希望访问每个警告的详细 Markdown 文档的内容。这些文件位于 ESLint 存储库中 docs/rules .
但是,它看起来像 docs 目录 might not get included在打包模块中,因此安装后可能无法从标准产品访问这些文档。
npm package.json 文档也使得文档看起来通常不可用:
directories.doc
Put markdown files in here. Eventually, these will be displayed
nicely, maybe, someday.
我是使用 Node 包的新手,所以可能会遗漏一些明显的东西。感谢您的任何想法!
最佳答案
在这里。最后,我和一个 friend 一起开发了一个 ESLint 分支,添加了这个功能:https://github.com/codeclimate/eslint/commit/fb68870708b1b3bbad80a955eec085a8dfd5f13b
如果有人想使用它,您可以使用我们的 eslint 分支并通过以下方式访问每个规则的文档:
var docs = require("eslint").docs;
其中 docs 是一个带有 {rule_name: "content string....", ... } 的对象
complexity_readup = docs.get("复杂性")
关于node.js - 如何访问 Node 模块文档 - eslint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33178146/