PDA

View Full Version : Comma convention JSlint



emredagli
13 Oct 2009, 10:49 PM
Hii,
There are some conventions in javascript coding,
In first convention comma is placed before the item like:


var a={
b:3
,c:4
}


As I understand, reason is IE errors.

But in this case I may get alot of errors in JSLint and reach the max error count...

My question is,
- Do you use other tools to check java script errors?
- Do you have some other reasons to use this convention?

Thanks.

mankz
14 Oct 2009, 12:35 AM
I use JavaScriptLint since it's easy to use with Visual Studio as I only want syntax checks and serious warnings. JsLint is more powerful but takes longer to please :)

jay@moduscreate.com
14 Oct 2009, 4:35 AM
There is a reason why commas are placed at the end of a part of a sentence. Think written language and it will make sense.

emredagli
14 Oct 2009, 5:06 AM
There is a reason why commas are placed at the end of a part of a sentence. Think written language and it will make sense.

As I understand Garcia,
You prefer to use comma end of the sentence.

And I wonder to learn which tool do you use to verify javascript code?

Thanks.

jay@moduscreate.com
14 Oct 2009, 5:08 AM
Yes, because it goes along with the way people write most languages based on the Roman character set. :)


That said, I use IntelliJ IDEA as it provides a list of errors as I edit the files, thus leaving me with no doubt that my code is clean.

emredagli
14 Oct 2009, 5:09 AM
Perfect,
Thanks a lot.

mschwartz
14 Oct 2009, 5:35 AM
komodo edit runs JSLint on the files as you edit and you get green underline where there's warnings (like inconsistent returns from a function) and red underline where there's syntax errors.

Plus all the macros are in javascript, so you can use your skills to make the editor customized to your needs.

joeri
14 Oct 2009, 5:52 AM
I place comma's at the end of the line and use aptana with jslint validation to find any missing or additional comma's. Works fine.