【发布时间】:2016-01-06 16:33:09
【问题描述】:
我正在使用带有 grunt-eslint 插件的 grunt。这是一个更大的 grunt 任务的一部分,它首先找到更改的文件并使用它们执行各种任务。如果没有更改任何 JS 文件(例如,如果我只是更改 CSS 文件),则整个任务将中止,因为 eslint 失败并显示“找不到任何要验证的文件”消息。
$ grunt eslint:precommit
Running "eslint:precommit" (eslint) task
Could not find any files to validate.
Warning: Task "eslint:precommit" failed. Use --force to continue.
Aborted due to warnings.
如果找不到任何 JS 文件,我不希望任务失败。
有没有办法:
A.如果没有文件运行,grunt 任务甚至没有调用 eslint 并且不会失败吗?
B.没有文件运行 eslint 不会失败吗?
(相关,但特定于从 grunt 调用的不同工具:Can an assemble target be silenced if there are no matching files? (Without using --force))
【问题讨论】:
标签: gruntjs eslint grunt-eslint