#1789·grunt

Task sorting is unreliable when using the verbose option

Author: PetrisorTanasaCreated Apr 26, 2025Updated Apr 26, 2025

Hi

Inside grunt.js there are the following lines

  // Display available tasks (for shell completion, etc).
  _tasks = Object.keys(grunt.task._tasks).sort();

While this would be correct in the case of the english alphabet, for special characters from all over the world it might produce unexpected an unexpected behaviour. The fix is using localeCompare.

  // Display available tasks (for shell completion, etc).
  _tasks = Object.keys(grunt.task._tasks).sort((a, b) => a.localeCompare(b));

If needed, I could open a PR on this.

Thanks!