Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

jslint_com · This group has moved to Google Plus.

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 585
  • Category: JavaScript
  • Founded: Mar 7, 2008
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
getJSLintOptions()   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages | View Threaded Sort by Date v  
#486 From: "Douglas Crockford" <douglas@...>
Date: Wed May 6, 2009 12:56 am
Subject: Re: getJSLintOptions()
douglascrock...
Send Email Send Email
 
--- In jslint_com@yahoogroups.com, "christian.wirkus" <christian.wirkus@...>
wrote:
>
> Hello!
> I think really neat would be something that generates the
> jslint-options-string (/*jslint ... */).

Interesting idea.

http://www.JSLint.com/index.html now provides assistance in building /*jslint*/
and /*global*/ comments.




#479 From: "christian.wirkus" <christian.wirkus@...>
Date: Tue May 5, 2009 12:00 pm
Subject: getJSLintOptions()
christian.wi...
Send Email Send Email
 
Hello!
I think really neat would be something that generates the
jslint-options-string (/*jslint ... */).
I am writing a small Javascript Library and had the good-parts
and the assume-a-browser in my jslint-options; now I learned
the good-parts have altered and I manually changed the string.
I wrote myself this method to run in the js-console to get the
checked options more convenient.

var getJSLintOptions = function () {
var result = [],
walkTheDom = function walk(node, func) {
func(node);
node = node.firstChild;

while (node) {
walk(node, func);
node = node.nextSibling;
}
};

walkTheDom(document.getElementById("options"), function (node) {
var nodeName = node.nodeName.toLowerCase(),
id, type;
if (nodeName === "input") {
id = node.getAttribute("id");
type = node.getAttribute("type");
if (type === "checkbox" && node.checked) {
result.push(id + ": true");
}
if (type === "text" && node.value) {
result.push(id + ": " + node.value);
}
}
});

result = "\/*jslint " + result.join(", ") + " *\/";
return result;
};

For this is my first post here, I think I might conclude:
Thanks for JSLint (and the walkTheDom method)

Christian







 
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help