6

I'm doing a PoC of NPM as a build tool (http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/). I'm fairly new using NPM. For now, I only have JSHint and Mocha installed. My packagae.json is attached. Now, when I run "npm run lint" in the command line (Windows 7), it gives me an error:

c:\project>npm run list
MyNPMProject@1.0.0 lint c:\project
jshint test/*.js

ERROR: Can't open test/*.js

It works when I change the script "lint": "jshint test/test.js".

Can I use glob with jshint?

Please advise and thank you in advanced.

Brad
  • 159,648
  • 54
  • 349
  • 530
flexapp
  • 73
  • 6

2 Answers2

6

You shouldn't need the glob, just give it the directory and it will scan all js files in there.

IBam
  • 10,114
  • 1
  • 24
  • 36
  • Yes. To clarify, with your example that would be `jshint test` or else `cd test` followed by `jshint .`, since `.` means 'current directory'. – Jon Coombs May 08 '15 at 02:11
  • Exactly, my preference would probably be the former but either should work. – IBam May 08 '15 at 05:31
-1

If you need to use a wildcard that can recurse down into subfolders, such as test/**.js, the basic Windows shell (Command Prompt) doesn't support that, but there are various workarounds/alternatives. See this for more details: https://stackoverflow.com/a/30114333/1593924

Community
  • 1
  • 1
Jon Coombs
  • 2,135
  • 2
  • 25
  • 26