All these files contain "Input is an empty string." errors for the first time.
Empty files are not correct files. You can, by mistake, point JSHint to an incorrect/empty file and without any errors you would think that there are no warnings. Depending on how you use JSHint, why can't you just filter out empty files yourself, before passing them to JSHint?
Thanks for the quick response.
Empty files are executed without errors, that's why I think these files are correct.
Well, it's also possible, by mistake, to point JSHint to an correct nonempty file and there will also be no errors.
We run JSHint from IDE (WebStorm, IntelliJ IDEA and others). So, yes, sure, we can filter out empty files before passing them to JSHint, but in this case console JSHint behavior won't be the same as IDE JSHint one.
It seems to me that errors reported by JSHint in IDE should be the same as errors reported by console JSHint.
Now files that consist of whitespaces only are filtered out by IDE.
IMO the issue is still there for console users.
Like for other errors, why can't there simply be an option to turn this error off?
I don't understand why can't you just not run JSHint against an empty file?
I agree with @segrey. Executing an empty file causes no errors and shouldn't be reported. The reason why it's harder not to run JSHint against an empty file is in the context of a project where you might have a bunch of placeholder files throughout your directory structure, and omitting them in grunt, for example, is a major pain.
This is indeed a pain. I'd love to see a jshint option to ignore empty files for all the reasons @jedverity mention above.
I agree this is a bit of a pain. When running JSHint within Grunt, you want to just point it to your app's JS folder and let it do its thing without having to add and maintain a bunch of exclusions. It might be a bad practice to serve up empty files to the browser, but I fail to see the harm in having them in my dev environment.
But maybe I should be raising this issue to the Grunt team instead of here.
FWIW, I worked around it by placing '//' in my empty files.
I'm doing the same thing with putting empty comments in my files 👎
Have you warmed up to this at all? @antonkovalyov
Don't return an error on empty input.
Lots of people complaining about that so I decided to remove it.