Reputation: 10517
I'm using grunt with the grunt-eslint plugin. This is part of a larger grunt task that first finds changed files and does various tasks with them. If there aren't any JS files changed (for example if I just change a CSS file) the whole task aborts because eslint fails with a "could not find any files to validate" message.
$ 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.
I don't want the task to fail if there aren't any JS files found.
Is there a way to either:
A. Have the grunt task not even call eslint and not fail if no files are run?
B. Have eslint not fail if no files are run?
(Related, but specific to a different tool called from grunt: Can an assemble target be silenced if there are no matching files? (Without using --force))
Upvotes: 3
Views: 865
Reputation: 13558
Using Dynamic task is your solution, here the link for the docs: http://gruntjs.com/frequently-asked-questions#dynamic-alias-tasks
Related links:
Upvotes: 1