reid / node-jslint

The JavaScript Code Quality Tool — for Node.js.
http://jslint.com/
Other
491 stars 101 forks source link

Automatically recurse on directories #110

Closed mcandre closed 9 years ago

mcandre commented 9 years ago

As a former JSHint user, I would appreciate the ability to JSLint all of my code at once, with jslint .

But when I try this, I get an error:

$ npm run jslint

> regenboog@0.0.2 jslint /Users/andrew/Desktop/src/regenboog
> jslint .

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: EISDIR, read

As a workaround, I can use https://github.com/davybrion/node-jslint-all

Could we merge jslint-all into official jslint, so that recursive directory scanning happens out of the box?

smikes commented 9 years ago

node-jslint supports the double-star glob, so you can probably get what you want with

jslint /Users/andrew/Desktop/src/regenboog/**/*.js

or even

jslint /Users/andrew/Desktop/src/regenboog/**/*

If all you have in that hierarchy are javascript files.

smikes commented 9 years ago

I'm not familiar with node-jslint-all. It looks like it hasn't been updated in a while (it still uses edition 2011-04-21), but if there's specific behavior from it that you'd like to see included, can you file an issue and point out the relevant functionality?

mcandre commented 9 years ago

Recursive globs are good, but in a large project, npm has trouble handling them.

$ npm run exec -- jslint **/*.js
bash: /Users/andrew/.nvm/v0.10.36/bin/npm: Argument list too long

Could we add a check for directory names, and have jslint explicitly glob them when present?

smikes commented 9 years ago

How about this --

$ find . -name *.js | xargs npm run exec -- jslint
mcandre commented 9 years ago

Yes, I can write a unix find command as well. But I would like for jslint to behave like this automatically, without requiring me to do that.

smikes commented 9 years ago

Since you are using grunt you may wish to check out https://github.com/stephenmathieson/grunt-jslint which may provide traversal of the filesystem for you.

smikes commented 9 years ago

Closing, for reasons documented here: https://github.com/reid/node-jslint/issues/122#issuecomment-76546643

Thank you for making this feature request.