Loading ...
Sorry, an error occurred while loading the content.

1372jslint in cli without WSH and Rhino

Expand Messages
  • roltar@ymail.com
    Jul 19, 2010
    • 0 Attachment
      Hi,

      I thought it can be intresting
      for those who don't have WSH (for example, I have Linux - there is no WSH) and do not want to install Java and Rhino, but want to use jslint in console.

      There is Perl module jslint, which have jslint cli version, wrapped in
      perl and using spidermonkey library. However, this module consist
      outdated version of JSLint library and seems broken.

      I found easy way to run JSLint from cli using smjs tool from spidermonkey package and small code:


      var source=[];
      var line;

      while((line=readline())){
      source.push(line);
      }

      if(!JSLINT(source)){
      for(var i in JSLINT.errors){
      if(JSLINT.errors[i]) {
      print(i+') L:'+(JSLINT.errors[i].line+1)+'
      C:'+(JSLINT.errors[i].character+1)+' ['+JSLINT.errors[i].reason+'] >
      '+JSLINT.errors[i].evidence);
      }
      }
      }

      It can be used by 'smjs jslint.js < some.js'
    • Show all 5 messages in this topic