lance
lance

Reputation: 16362

How to enforce semicolons in JavaScript?

How best does the developer who's decided he likes semicolons at the end of his JavaScript statements enforce that expectation technically for himself?

I'm using Visual Studio (ASP.NET webapps), but I'd love to hear about solutions for any environment.

Upvotes: 2

Views: 1337

Answers (2)

David Murdoch
David Murdoch

Reputation: 89412

I sometimes run my JS through a handler that strips all new lines, comments, tabs, and extra whitespace automatically. If my JS statements don't end with a semi-colon I'll get an error (in most cases)...doing it this way is a PAIN to debug though (e.g., error on line 1 character 2654).

The other way I use is Firebug + YSlow. You can check it's built in JSLint every once in a while.

Maybe there is a file in Visual Studio for checking javascript syntax you may be able to modify like there is for (X)HTML and XML.

Upvotes: 0

kgiannakakis
kgiannakakis

Reputation: 104198

You could somehow integrate Javascript Lint into the IDE.

Upvotes: 1

Related Questions