ckeditor / ckeditor-boilerplate

A boilerplate for modern git based projects
Other
6 stars 4 forks source link

Paths which JSCS and JSHint tasks should check should be more precise #18

Open Reinmar opened 8 years ago

Reinmar commented 8 years ago
(master↑ 8e6c913) p@m /www/ckeditor5/ckeditor5> time grunt jshint:all
Running "jshint:all" (jshint) task
>> 19 files lint free.

Done, without errors.

real    0m8.241s
user    0m6.655s
sys    0m1.637s

8s for 19 files is extremely bad result. The reason for that is this piece of code:

        targets: {
            all: function() {
                return [ '**/*.js' ];
            },

So basically we tell linters that they should first get all files inside the whole repo (including the whole node_modules/ and Bender files and only later on we are saying that some of them should be excluded.

I think that we tried to make it too smart by saying "scan all files in the repo excluding these which are ignored by Git.". This is both, complicated and as we can see extremely slow. I would simplify this and say that you need to configure more precisely which directories should be checked. So the minimum changes is to make the array returned by that all() callback configurable from the gruntfile.js.

fredck commented 8 years ago

Why not keeping it smart and instead make "all" return just the files that need to be scanned (= '**/*.js' - .gitignore)?

Reinmar commented 8 years ago

We would need to create such list, what may not be that easy. Currently we just pass two lists – the paths to check and the paths to ignore. Question is whether all() can return both things at the same time, like:

[ '**/*.js', '!node_modules', ... and other ignored dirs marked with '!' ]

If that's possible, then we're home. If not, then we would need to resolve such list on our own. There's definitely a module to do that, but it's generally more work.