Textmate gives Nodelint a nice big hug

Hey all, just a random tip, as you’ll have noticed I’ve been playing with Node.js, well tonight I had a play with JSLint, and I must say that I like the added strictness it gives. Though I find strictness only really works when it nags you, so I installed the excellent Nodelint via npmjs then processed to fiddle with Textmate with the goal of getting it to automagically nag me when I write un-linty code.

Before I show you how I got this working let me just say this, I’ve no idea what I’m doing, so if stuff breaks then its on you, it happened to work for me, but I’m certain there is a better way to achieve the same result.

Right from within Textmate you go ‘Bundles > Bundle Editor > Show Bundle Editor’, Once that opens look on the left for the JavaScript bundle. Click the plus and select ‘New Command’ from the menu.

In the save type select ‘Current File’, in the Input select ‘Entire Document’, Output set to ‘Show as Tool Tip’, then  down at the bottom Acivation as ‘Key Equivalent’ set this to Command-S and finally set ‘Scope Selector’ to source.js.

With all that fluff done we can move onto the code that does the business, in the Command(s) section paste in the following:

/Users/httpmmo/Nodejs/node/nodelint "$TM_FILEPATH"
--config /Users/httpmmo/Nodejs/node/nodelint.config.js

Replacing the paths with the correct path based on your system. You’ll notice I’ve added a nodelint.config.js into the node install directory, this is just so that I have common place for all my config stuff. The contents of this file is below:

nodelint.config.js

var options = {
    white: true,
    onevar: true,
    undef: true,
    //nomen: true, // nodes __dirname prevents this being used :(
    eqeqeq: true,
    plusplus: true,
    bitwise: true,
    regexp: true,
    newcap: true,
    immed: true

    // JSLint expects the "use strict"; declaration to be on the first line
    // of the document, if like me your wrapping your code in an
    // anonymous function then this will likely fail :(
    //strict: true
};

With that done we’re most of the way through the process, if go into an existing .js file and try saving it you’ll get the following error:

This is where I got my hack on, as I’m not linux/bash/console/terminal master I just opened up nodelint inside my node install directory and set the absolute path to the active version of node on my system, running the same test again now gives me.

With the corrected version looking like.

The best bit about this whole process is that I can forget about it, I just write code, and hit save, if something is ugly it lets me know, and I fix it, nagging in a good way :)

My next goal is to get it working in E-Texteditor over on windows, so that’ll be my next post.



This entry was posted on Tuesday, March 8th, 2011 at 11:37 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

6 Responses to “Textmate gives Nodelint a nice big hug”

  1. Bodybuilding.com Coupon Code

    Did you design the site this well with the default blog tools? Your blog is incredible.

  2. Spike

    I’m impressed by your writing. Are you a proefsisnaol or just very knowledgeable?

  3. jlsswdeu

    BSADPR xkutvhwlltjj

  4. jrhjrcueiau

    9UxL9R pdhjsyeqktst

  5. รายได้เสริมทางเน็ต

    รายได้เสริมทางเน็ต…

    [...]httpmmo » Textmate gives Nodelint a nice big hug[...]…

  6. Facebook Fans

    Sites We Like…

    [...]just below, are some totally unrelated sites to ours, however, they are definitely worth checking out[...]…

Leave a Reply

Your comment

  • bea test
  • vince young usc
  • chad ochocinco yesterday
  • c span yesterdayc span zelaya
  • monte
  • c span 2009
  • randy moss football cards
  • search cfisd.net
  • connecticut 5th district
  • c span video contest
  • connecticut 97.7connecticut attorney general
  • hp support contact number
  • moana
  • impression
  • hp support error 1005
  • battleship ipad
  • connecticut 5 star resorts
  • la ink corey
  • nickelback
  • la ink cast
  • randy moss vikings 2011
  • outside
  • bea luna
  • bea 71 16
  • dist 91
  • vince young dadvince young eagles
  • dis lyrics
  • search 4
  • vince young depression
  • cspan facebook
  • mtv cartoons
  • zara phillips kids
  • windsor
  • cspan washington correspondents dinner 2011
  • bea diy
  • tea party young people
  • braid
  • la ink 105
  • mtv true life
  • bea 71 series staples
  • connecticut 97.7connecticut attorney general
  • chad ochocinco celebrationschad ochocinco dating
  • connecticut post
  • la ink season 5 premiere
  • connecticut transit
  • mtv executivesmtv fantasy factory
  • search engines for kids
  • connecticut lottery
  • tea party hats
  • 60 search engines virus
  • urinary
  • new england patriots gillette stadium
  • bengals youth jerseys
  • vince young z
  • chicago bears 1985
  • chad ochocinco free agent
  • tea party nj
  • saturation
  • vince young injury
  • chad ochocinco 15
  • la ink price list
  • mtv 2 schedule
  • discjuggler
  • hp support id
  • period
  • bulldog
  • freida pinto zac posen
  • bengals insider
  • new england patriots wiki
  • quilt
  • bengals usa
  • search engines usage statistics 2010
  • randy moss korey stringer
  • rickey
  • bea goldfishberg
  • greg olsen website
  • battleship hacked
  • hp support chat
  • la ink season 5
  • bea taylor
  • disloyaldis magazine
  • contribution
  • bengals job fair
  • chicago bears donation request
  • bengals arrests
  • search engines other than google
  • beagle
  • connecticut 100 club
  • programming
  • bea per capita income
  • freida pinto glamour 2011
  • bea 2011 map
  • search engines 9
  • cspan government shutdown
  • vince young released
  • battleship classes
  • tea party texas
  • hp support 6310hp support 7200
  • bengals preseason schedule 2011
  • armband
  • new england patriots 3 4
  • bengals 08 schedule
  • connecticut juvenile training schoolconnecticut kids
  • chad ochocinco nascar
  • hp support number united states
  • bea input output
  • greg olsen puzzles
  • randy moss yahoo stats
  • chad ochocinco quotes video
  • tea party table settings
  • new england patriots 65
  • hp support chat
  • connecticut limo
  • clan
  • purple
  • purcell
  • chad ochocinco johnson
  • xanadu bengals
  • battleship excel
  • randy moss wonderlic
  • randy moss mix
  • new england patriots 07
  • la ink 2011 season 5
  • generation
  • c span 4 to 5
  • searchbugsearch engines
  • greg olsen football
  • chicago bears gifts
  • mtv music awards
  • indexed
  • connecticut quarry
  • freida pinto green dress
  • zara phillips yachtzara phillips zimbio
  • mtv 5 cover
  • new england patriots store
  • muncie
  • search 78search 800 numbers
  • vince young 2008
  • chicago bears zip hoodie
  • chili
  • new england patriots 1997 roster
  • bea rims
  • crossfire
  • recessed
  • chad ochocinco quits football
  • sailor
  • yield
  • search engines non tracking
  • views
  • bea fox
  • zara phillips baby
  • vince young uncle rico gif
  • search protocol host
  • mtv website
  • chicago bears 96
  • bengals forum
  • chelsea
  • zara phillips wedding date
  • bea 00037
  • freida pinto dev
  • chicago bears training camp
  • tea party for kids
  • search optics
  • freida pinto plastic surgery
  • hp support assistant review
  • vince young status
  • tea party 8 28 09
  • withdrawl
  • search 5500
  • zara phillips royal wedding picture
  • barriers
  • battleship egg hunt
  • battleship history
  • greg olsen no greater love
  • chad ochocinco vs skip bayless
  • instrumental
  • greg olsen university of miami
  • cspan kucinich
  • dis n dat band
  • chad ochocinco height and weight
  • trades
  • bangles eternal flame mp3bengals forum
  • la ink show
  • randy moss combine results
  • vince young to eagles
  • bengals undraftedbengals vs steelers
  • new england patriots offense
  • c span youtube obama
  • search engines for jobs
  • c span kozol