Cannot use GLOB with JSHint in Windows?

只谈情不闲聊 提交于 2019-12-07 03:43:34

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/29089460/cannot-use-glob-with-jshint-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!