在 JavaScript 源代码中自动插入分号的实用程序?

在 JavaScript 源代码中自动插入分号的实用程序?

问题描述:

我正在处理来自多个开发人员的代码,其中一些开发人员在使用分号方面不一致,我只希望在每一行之后使用它们以保持一致性(并防止任何错误掩盖).

I'm working with code from multiple developers, some of whom are inconsistent in their use of semicolons, and I just want them after every line for consistency (and to prevent any masking of errors).

我使用 Aptana 来格式化我的源代码,但它不会为您添加分号 AFAIK.

I use Aptana to format my source code, but it won't add semicolons for you AFAIK.

啊...刚刚发现 YUI 压缩器有一个保留分号选项,它实际上会将分号添加到适当的行.然后只需通过 aptana 格式化程序将缩小的、未压缩的版本发送回即可.

Ah ... just discovered YUI compressor has a preserve semicolons options that will actually add the semicolons to the appropriate lines. Then it's just a matter of sending the minified, unmunged version back thru the aptana formatter.

如果有人想出更简单的解决方案,请发布.

If someone comes up with a simpler solution, please post.