Reputation: 463
I've been googling and can't seem to find anything definitive. Is there anyway to only use JSLint or JSHint on just a specific line range from the command line.
Maybe something along the lines of jslint -L200,240 some_js_file.js
Upvotes: 0
Views: 195
Reputation: 611
It sounds like my comment on the OP is what he was looking for. JSHint can't really be run for a certain line number range, since it checks things like function signatures and variable names.
Ex:
1 : function main() {
2 : var omg = 'OMG!;
3 : function myFunc1() {
4 : alert('SPACE!');
5 : }
6 : function myFunc2() {
7 : myFunc1();
8 : alert(omg);
9 : }
10: }
If I tried putting just lines 6-9 into JSLint, it would tell me that there is no function myFunc2()
, and no variable called omg
.
The best solution, IMO, is to use an IDE like Webstorm which will inspect your code for you on-the-fly.
Another solution would be to make a script that lints your file and then deletes anything not relating to your specified line numbers.
Upvotes: 1
Reputation: 645
A simplistic approach is to just copy the exact lines you want to http://www.jslint.com/
Upvotes: 0