grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Stop/warn user when declaring an already existing task or a loop

Open xavierpriour opened this issue 10 years ago • 2 comments

(this is a proposed feature for discussion, I'll gladly do the PR afterwards)

Sometimes, distracted or new developers declare custom tasks using names that are already used for other tasks, which yields surprising (for them) results. Worse, they sometimes do it in a multi-task, which then causes an infinite loop and baffles them:

grunt.registerTask('uglify', ['build', `copy`, 'uglify']);

grunt.loadNpmTasks('grunt-contrib-uglify');

My proposal would be to have grunt fail with a nice explanation in this case. What do you think?

xavierpriour avatar Jun 03 '15 15:06 xavierpriour

side note, we have this in the FAQ: http://gruntjs.com/frequently-asked-questions#why-am-i-getting-a-maximum-call-stack-size-exceeded-error

vladikoff avatar Jun 03 '15 15:06 vladikoff

I looked at the code, and would put a check in task.registerTask. that way it's one less risk of error and FAQ entry to maintain :)

xavierpriour avatar Jun 04 '15 01:06 xavierpriour