Javascript code analysis and best practices - Stack Overflow

Are there any tools out there to help programmers that REALLY want type safety and the more stringent r

Are there any tools out there to help programmers that REALLY want type safety and the more stringent rules of a language like c# or java with javascript?

For example, something that say analyzed source files and found things like undeclared variables or a js file of defined type objects like int or string?

Are there any tools out there to help programmers that REALLY want type safety and the more stringent rules of a language like c# or java with javascript?

For example, something that say analyzed source files and found things like undeclared variables or a js file of defined type objects like int or string?

Share Improve this question asked Jul 10, 2010 at 5:45 j03mj03m 5,3014 gold badges48 silver badges50 bronze badges 2
  • you can't get type safety in a dynamically typed language by static analysis, because the type of anything can change anywhere during runtime. – gblazex Commented Jul 10, 2010 at 9:31
  • @galamalazs it can't if you mark all cases where this happens with a tool. the question is whether any such tool exists. – reinierpost Commented Jul 13, 2010 at 11:51
Add a ment  | 

4 Answers 4

Reset to default 5

In addition to JSLint, Google Closure Compiler can be used for static analysis of JS source as well, and it checks different things than JSLint too.

Neither of these tools does provide exactly what you want though.. Closure Compiler attempts type-checking if I remember correctly, but it doesn't always work (at all).

Although such features may seem desirable from the point of view of someone who's used to strictly typed languages, I often see people attempting to use JS like C#/Java/whatever go wrong on more than one level, and usually ending up with less readable and worse code in general. Of course this may not be your case, but this is just a general observation/warning to keep in mind.

My suggestion would be to embrace the "looseness" of the language, with perhaps test-driven development as a quality assistance tool (JsTestDriver).

You want a lint program. Try jslint -- http://www.jslint./

Like @no said, jslint is hawt. I think you're looking for the Closure piler, though.

If you want to check the javascript dependencies and define a client-side architecture, you can use JSAnalyse.

It allows you to keep the dependencies between javascript files under control by checking it during the build. It extends the Visual Studio Layer Diagram to support javascripts and can be easily integrated into the msbuild process.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745469295a4629059.html

相关推荐

  • Javascript code analysis and best practices - Stack Overflow

    Are there any tools out there to help programmers that REALLY want type safety and the more stringent r

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信