this.data is not available in non-multi-tasks
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
If I do this in a Gruntfile:
``` js
module.exports = function(grunt) {
grunt.registerTask('something', 'description', function() {
console.log(this.data);
});
grunt.initConfig({
something: {
some: 'data'
}
});
};
```
the output is `undefined`. Instead, you have to do `grunt.config('something.some')` to get that. I think I understand _why_ this works the way it does (data belongs to a target, not a task), but it also kind of feels like this _should_ work, if for no other reason than that the API is consistent then.
Contributor guide
Research direction
Start with the Gruntfile example and reproduce the difference between this.data in a non-multi-task and grunt.config('something.some'). Trace how task and target data are exposed, then verify the intended API behavior with a focused regression check. Done means the behavior is resolved or clearly documented, with the single-task and multi-task cases consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100