Ticket #29445: patch-jslint.js.diff

File patch-jslint.js.diff, 1.1 KB (added by tael67@…, 13 years ago)
  • .js

    old new  
     1#!@PREFIX@/bin/js
    12// jslint.js
    23// 2011-05-10
    34
     
    66746675
    66756676    return itself;
    66766677
    6677 }());
    6678  No newline at end of file
     6678}());
     6679
     6680
     6681if(!arguments[0] || arguments[0]==="-h" || arguments[0]==="--help"){
     6682        print('Usage : "jslint myscript.js option[=true]"');
     6683}else{
     6684var file=new File(arguments[0]);       
     6685file.open("read", "text");
     6686var script=file.readAll();
     6687var i;
     6688var option= {};
     6689for (i = 1; i < arguments.length; i++) {
     6690        var splitoptions=arguments[i].split("=");
     6691        option[splitoptions[0]]=splitoptions[1]=="false"?false:true;
     6692}
     6693if(!JSLINT(script, option)){
     6694for (i = 0; i < JSLINT.errors.length; i++) {
     6695            var e = JSLINT.errors[i];
     6696            if (e) {
     6697                print('Error at line ' + (e.line + 1) + ' character ' + (e.character + 1) + ': ' + e.reason);
     6698                if(e.evidence){
     6699                print((e.evidence).replace(/^\s+/g,'').replace(/\s+$/g,''));
     6700                }
     6701                print('');
     6702            }
     6703        }
     6704
     6705}else{
     6706print("No error found");       
     6707}
     6708}
     6709 No newline at end of file