Cannot use GLOB with JSHint in Windows?

2019-04-29 02:56发布

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.

2条回答
ゆ 、 Hurt°
2楼-- · 2019-04-29 03:02

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

查看更多
时光不老,我们不散
3楼-- · 2019-04-29 03:19

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

查看更多
登录 后发表回答