Greetings,

I've been using Prototype for a year or so now and think it is very
useful.  I have a web project currently underway, and I have been
integrating JavaScriptLint (www.javascriptlint.com) validation into my
build/test cycle and I run JSL with almost all options turned on after
reading Douglas Crockford's JSLint website and book (Javascript: The
Good Parts).

When I cranked up all the options on JavaScriptLint (jsl), I found
that the Prototype library was producing a number of minor errors and
warnings, from missing semicolons at the end of lines to unbracketed
"if" clauses.  Nothing huge, but my tests were failing.  I find that
having all the code checks enabled has helped me catch errors in my
own JS in the past and I like to have all my JS code checked,
including open source libs.

I've submitted a patch (Lighthouse ticket #525) to the current version
of Prototype which fixes all errors and warnings.  The ticket includes
the details, including regression tests.  Tobie Langel suggested that
I bring up the topic of JSL/JSLint validation on this mailing list.
Apparently fixing the warnings has been suggested in the past but no
action was ever taken.  I hope this patch will be seriously
considered: I have already done the work to fix the warnings so it
passes the lint tests.

>From a question of code style, my personal opinion is that the
benefits of strict lint checking outweigh the additional burden of
slightly more verbose code.  For example,

if (foo > 0) bar = undefined; // JSL warning

vs.

if (foo > 0) { bar = undefined; } // no warning

I've tried to keep with the code style present in the baseline as much
as possible.  I realize I have introduced a few more substantial
structural changes, converting

while(foo = list.next()) { ... }

loops to

for(foo = list.next(); foo; foo = list.next())

in order to avoid assignments within tests, but I agree with Crockford
that this more explicit coding style improves the ease with which the
code can be read and understood.

Please understand that I'm not trying to start a coding-style holy war
here.  It seems like more and more blogs are writing about lint for
javascript so I thought others might like to have a version of
Prototype which passed all the tests.

I hope this patch is accepted and committed to the main Prototype
baseline.

Thanks again for the great work on Prototype.

-Dane Avilla
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to