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

Re: [jslint] JSlint from VIM

Expand Messages
  • Thomas Koch
    ... This is how I integrate JSLint into VIM using spidermonkey on Debian: function! RunJslint() let l:input=join(getbufline(bufnr( % ),1, $ ), n ) cd
    Message 1 of 2 , Jun 10, 2008
    • 0 Attachment
      Am Dienstag 10 Juni 2008 15:07:55 schrieb Kai Hendry:
      > http://svn.natalian.org/projects/html5/javascript.vim
      >
      > Any comments? Source code is linked from there.
      >
      >
      > Some more Web dev IDE tips here:
      > http://wiki.whatwg.org/wiki/IDE
      >
      >
      >
      > Kind regards,

      This is how I integrate JSLint into VIM using spidermonkey on Debian:


      function! RunJslint()
      let l:input=join(getbufline(bufnr('%'),1,'$'),"\n")
      cd ~/bin/jslint
      let l:output=system('xargs -0 smjs calljslint.js ',l:input)
      let l:list=split(l:output, "\n")

      let l:i = 0
      while l:i < len(l:list)
      let l:list[l:i] = '"'.@%.'"'.l:list[l:i]
      let l:i=l:i+1
      endwhile

      cexpr l:list
      cwindow
      endfunction

      set errorformat+=\"%f\"%l\ %c:\ %m
      command! Jslint execute RunJslint()

      ---------------------------------------------------------------


      (function (a) {
      load('jslint.js');
      if (!a[0]) {
      print("No input");
      quit(1);
      }
      if (!JSLINT(a[0] /*, {rhino: true, passfail: false}*/)) {
      for (var i = 0; i < JSLINT.errors.length; i += 1) {
      var e = JSLINT.errors[i];
      if (e) {
      print( (e.line + 1) + ' ' +
      (e.character + 1) + ': ' + e.reason);
      // print((e.evidence || '').
      // replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
      // print('');
      }
      }
      } else {
      print("jslint: No problems found in " + a[0]);
      quit();
      }
      })(arguments);



      --
      Thomas Koch, Software Developer
      http://www.koch.ro

      Young Media Concepts GmbH
      Sonnenstr. 4
      CH-8280 Kreuzlingen
      Switzerland

      Tel +41 (0)71 / 508 24 86
      Fax +41 (0)71 / 560 53 89
      Mobile +49 (0)170 / 753 89 16
      Web www.ymc.ch
    Your message has been successfully submitted and would be delivered to recipients shortly.