星号 (*) 在 lint 阶段配置中起什么作用?
我想使用 lint-staged 仅在 node.js 项目中的暂存文件上运行挂钩。 docs 建议将以下代码添加到 package.json
文件中;
{
"lint-staged": {
"*": "your-cmd"
}
}
我还在另一个代码库的其他地方看到了以下代码;
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
}
星号有什么作用?我不认为这只是一个占位符。感谢您的帮助。
I want to use lint-staged
to run hooks only on staged files in a node.js project. The docs suggest adding the following code to the package.json
file;
{
"lint-staged": {
"*": "your-cmd"
}
}
I have also seen the following code elsewhere in another codebase;
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
}
What purpose does the asterisk(s) serve? I don't suppose it's simply a placeholder. Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如自述文件所述,这些是 glob 模式。
将匹配任何文件(
*
根据定义匹配任何文件)将匹配:
**
- “≥ 0 个字符跨越目录边界”,后跟/
- 目录边界,后跟As the readme says, those are glob patterns.
will match any file (
*
matches anything by definition)will match:
**
- "≥ 0 characters crossing directory boundaries", followed by/
- A directory boundary, followed by*
- Anything