开发者

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 usin开发者_如何学Cg Visual Studio (ASP.NET webapps), but I'd love to hear about solutions for any environment.


You could somehow integrate Javascript Lint into the IDE.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜