what to do about jslint?

Antranig Basman antranig.basman at colorado.edu
Thu Feb 10 03:30:16 UTC 2011


I support #1 and I have had a look at Crockford's code and think it will be pretty easy to implement. I'll 
see if I can take care of it at the weekend. "github" at least makes the social values of this kind of thing 
much more agreeable :)

Cheers,
Antranig.

On 09/02/2011 20:25, Colin Clark wrote:
> Hi Justin,
>
> This seems like a pretty comprehensive list of our options. There is a part of me that wants to argue for #3. We know programmers coming from C-like languages tend to get tripped up by JavaScript's unusual scoping rules, and defining all variables at the top of a scope helps serve as a reminder.
>
> On the other hand, it's a pretty cumbersome technique. It makes refactoring harder because code isn't grouped together as closely, and it brings the risk that developers will accidentally omit var statements, causing unintentional global leakage.
>
> I'm people will have some strong opinions about these options. If someone is interested in volunteering to do #1, I'd support it. Crockford has helped us out a lot, so we might as well lend him a hand with this little bug in JSLint.
>
> Thoughts?
>
> Colin
>
> On 2011-02-09, at 5:40 PM, Justin Obara wrote:
>
>> You may recall from a past dev meeting Michelle mentioning that jslint no longer has any tolerance for var's in for loops.
>>
>> For instance this would no longer be acceptable.
>>
>> for (var i = 0; i<  5; i++) {
>> 	//do something five times
>> }
>>
>> The biggest problem that this poses to us is that, jslint does not allow you to scan past it, and provides no means of ignoring it.
>>
>> We still need to lint our code though. Here are some options we have.
>>
>> 1) Fork ( https://github.com/douglascrockford/JSLint ). Make the necessary changes and send a pull request.
>>
>> 2) Move the var out of the for loop and place it just above.
>>
>> 	var = i;
>> 	for (i = 0; i<  5; i++) {
>> 		// do something five times
>> 	}
>>
>> 3) we could also take up the practice of moving all of the var's to the top of every function
>
> ---
> Colin Clark
> Technical Lead, Fluid Project
> http://fluidproject.org
>
> _______________________________________________________
> fluid-work mailing list - fluid-work at fluidproject.org
> To unsubscribe, change settings or access archives,
> see http://fluidproject.org/mailman/listinfo/fluid-work




More information about the fluid-work mailing list