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.

Did you design the site this well with the default blog tools? Your blog is incredible.
I’m impressed by your writing. Are you a proefsisnaol or just very knowledgeable?
BSADPR xkutvhwlltjj
9UxL9R pdhjsyeqktst
รายได้เสริมทางเน็ต…
[...]httpmmo » Textmate gives Nodelint a nice big hug[...]…
Sites We Like…
[...]just below, are some totally unrelated sites to ours, however, they are definitely worth checking out[...]…
wholesale synthetic grass…
[...]httpmmo » Textmate gives Nodelint a nice big hug[...]…
fence cleaning…
[...]httpmmo » Textmate gives Nodelint a nice big hug[...]…