rwjblue / broccoli-jshint

MIT License
6 stars 30 forks source link

Is it possible to jshint while running broccoli serve? #5

Open justin-calleja opened 10 years ago

justin-calleja commented 10 years ago

Hi,

Sorry if this is not the right place to ask (please let me know where I can ask these sort of questions in the future if this is not the place).

I got this working after looking at index.js in broccoli-jshint/tests. This is the relevant part of my Brocfile.js:

var jshintTree = require('broccoli-jshint');
var broccoli = require('broccoli');

var appJs =  'app/js';
appJs = pickFiles(appJs, {
    srcDir  : '/',
    files   : ['**/*.js'],
    destDir : '/js'
});

builder = new broccoli.Builder(jshintTree(appJs));
builder.build();

// etc... module.exports = mergeTrees([appHtml, appJs]);

Running broccoli build build gives me jshint output, but I can't get the same sort of instant feedback I was expecting when using broccoli serve.

Is there a way to have this set up so that while the broccoli server is running, changing code gives me jshint output? Or am I approaching this in the wrong way? I was thinking that perhaps I should have jshint run as part of a grunt set of tasks. Haven't used the grunt-broccoli plugin yet but the idea would be to have jshint run as a task since it's technically not a build step correct? (as in it doesn't output any files).

Any thoughts on this / am I using this plugin correctly?

Regards, J

mlunoe commented 9 years ago

This was working in an earlier version of broccoli (0.12.3). I'm not sure what changed, but here is an update I did of broccoli modules that made it stop working: https://github.com/mlunoe/react-bb-broccoli/commit/b3762b575ff1350efc3b8547e08a4ce99ae402ff#diff-b9cfc7f2cdf78a7f4b91a753d10865a2L17