Coding

Integrate JS Lint into Komodo Edit


There’s no contest. My favourite editor is Komodo Edit. I’ve written in the past before about how much it rocks (although that was before the great blog crash of ’08, and is likely lost to the mists of time), and I’d like to share with you all today another way to make Komodo Edit just a little bit cooler – integrate JS Lint directly into it.

WTF is JS Lint?

Well, a long time ago, someone noticed that while there are all kinds of ways to write certain code, certain specific ways are sloppier than others and can lead to errors. They wrote a tool called lint to parse through code and find those little linty bits and draw them to your attention.

Javascript, while an incredible language, is absolutely chock-full of language constructs that allow for sloppy coding to occur. So, the inestimable Douglas Crockford wrote JS Lint – a lint program for the Javascript language.

Okay, so how do I do this?

First, you’ll need to download an executable form of JS Lint. If you’re running Linux, make sure you’ve got Wine installed and you’ll be just fine.

Make a copy of the “js.default.conf” file in that directory, and call it lint.conf. Find the following section:

### Output format
# Customize the format of the error message.
# __FILE__ indicates current file path
# __FILENAME__ indicates current file name
# __LINE__ indicates current line
# __ERROR__ indicates error message
#
# Visual Studio syntax (default):
+output-format __FILE__(__LINE__): __ERROR__
# Alternative syntax:
#+output-format __FILE__:__LINE__: __ERROR__

Comment out the un-commented line there, and un-comment the last one. Finally, at the bottom of that file, remove the entry in the “Files” section.

Now boot Komodo Edit.

Open the Toolbox by clicking the little “Show/Hide Right Pane” button in the toolbar. Click on the “Add Item to Toolbox” button and add a new command. Now go to town making your new command look like mine:

JSLint Properties

Now, that Command string isn’t quite correct – the right bit is chopped off in the screenshot. It should read:

wine /opt/jslint/jsl.exe -conf lint.conf -process %F

You can make the string smaller by including jsl.exe’s directory in your path, or by running Windows and removing wine from the equation. =)

I understand that the Parse Output string is a little confusing (and chopped-off too), but don’t worry about it. It should be filled in automatically and work by default. If it DOESN’T though, here’s the string for you to copy-paste:

^(?P<file>.+?):(?P<line>\d+):(?P<content>.*)$

Simple as that!

Yeah, but what does it do?

Results of running JS Lint in Komodo Edit.

Coding
Code faster with simple Sublime Text improvements
Coding
Gulp.js – an AMAZING build system!
Coding
Rage-quit support for fish shell
  • Cindy

    CindyCindy

    Author

    Hi Dan,

    Thanks for the continuing support of Komodo! :) Would it be okay if I post your comment on our web site?

    “There’s no contest. My favourite editor is Komodo Edit. I’ve written in the past before about how much it rocks (although that was before the great blog crash of ‘08, and is likely lost to the mists of time).”

    I’d be happy to send you a t-shirt and a mug in exchange. Please send me your t-shirt size, contact phone number, and mailing address.


  • Dan Hulton

    Dan HultonDan Hulton

    Author

    Go ahead and post the comment. And thanks for reminding me that I have yet to put up my Creative Commons license for this site that should solve questions like this in advance.


  • Pablo Caro

    Pablo CaroPablo Caro

    Author

    I arrived here searching for jslint integration in komodo. If you too it’s better:

    kJSLint – JSLint for Komodo

    Thank you for your post