【问题标题】:lint-stage cannot see the fileslint-stage 看不到文件
【发布时间】:2022-01-17 21:07:29
【问题描述】:

我的项目结构如下:

project
- .husky
- src
-- all files
- package.json

这是我 lint-staged 来自 package.json

  "lint-staged": "^12.1.7",
  .
  .
  .
  "lint-staged": {
    "*.{js,ts,tsx}": [
      "npm run prettier",
      "npm run lint:fix"
    ]
  },

有人能告诉我yarn lint-staged 有什么问题吗,在启动此命令后他总是回复我这个:

→ No staged files match any configured task.

感谢您的帮助!

PS。我正在从 pre-push husky 脚本运行这个命令

【问题讨论】:

  • 您可能没有更改 js/ts 代码中的任何内容,因为 lint-staged 配置为仅通过 *.{js,ts,tsx} 模式查找这些文件。因此,如果您在其他文件中暂存更改,lint-staged 将直接跳过运行。

标签: javascript reactjs typescript lint


【解决方案1】:

您在运行yarn lint-staged 之前是否运行过git add .

【讨论】:

  • 是的,总是 ///
  • 好吧,这个脚本应该在预提交时运行。如果您在 pre-push 上运行它,您的文件现在会更加暂存,因为它们处于提交状态
猜你喜欢
  • 2021-04-23
  • 2021-05-14
  • 1970-01-01
  • 2013-09-16
  • 1970-01-01
  • 1970-01-01
  • 2022-10-22
  • 2020-01-06
  • 2021-12-17
相关资源
最近更新 更多