How can I get the output from JSHint to show up in my Error List in Visual Studio 2015 when using Gulp, rather than just output to the Task Runner?
I've tried this package but that doesn't seem to do anything except format the Gulp output slightly differently.
This is my gulpfile.js:
gulp.task('default', function () { gulp.src(["Scripts/**/*.js"]) .pipe(jshint(".jshintrc")) .pipe(jshint.reporter("jshint-visual-studio")); });
Actual output (in Task Runner Window):
Preferred output (in Error List):
Please Note: I'm using Visual Studio 2015, so Web Essentials is no longer an option for JSHint as the functionality has been removed.
Run a Gulp Task in Visual Studio CodeType "Run Task" and select it, which will bring up a list of tasks configured in Gulp. Choose the Gulp Task you want to run! Most of your Gulp Tasks will probably be automated using gulp watch, but manual Gulp Tasks can easily be run within Visual Studio Code.
Gulpfile explained A gulpfile is a file in your project directory titled gulpfile. js (or capitalized as Gulpfile. js , like Makefile), that automatically loads when you run the gulp command.
I managed to get an official word on this from Mads Kristensen in this conversation on Twitter:
So in VS2015RC (and RTM too), there is no way to get messages to go to the output window. The task runner only outputs to the error window if the Gulp task returns a failure - but honestly, I haven't managed to get this working either.
He did also confirm that this kind of functionality will be coming post-RTM.
Thanks to Eonasdan for pointing this out!
Source code of your package (jshint-visual-studio) just add errors to errors
array and log it to console
. The code can't do anything to change console
output, you must do it by yourself.
You can use this plugin.
Once the plugin is installed, open the Task Runner Explorer from the View –> Other Windows –> Task Runner Explorer menu.
This window will show you all the tasks in the gulp file and allow you to bind those tasks to certain Visual Studio events. This way, we don’t need to remember to run the gulp tasks from the command line. The IDE can handle it for us.
What I like to do is bind the watch task to the Solution Load event and bind the scripts task to the Before Build event.
With these bindings, we can make sure that all.min.js is correctly generated when we build the application and also regenerated anytime I make changes to the js files.
The Task Runner Explorer also shows the output of any running tasks. Here you can see the output from the watch task, which is always running in the background in this configuration.
From this article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With