ExtAspNet应用技巧(二十二) - Ext4JSLint之JSON文件创建树控件2011-10-06 博客园 三生石上引子Ext4JSLint是使用ExtAspNet来展示JSLint-Toolkit检查结果的开源项目。JSLint-Toolkit是一个使用Rhino和JSLint的开源项目,可以对一个文件夹中的所有JavaScript进行语 法检查,并显示友好的检查结果。下面是JSLint-Toolkit生成的检查结果:
01.[{
02. "name": "source",
03. "type": "folder",
04. "kids": [
05. {
06. "name": "config.js",
07. "type": "file",
08. "errors": [0, 0, 0]
09. },
10. {
11. "name": "lint.js",
12. "type": "file",
13. "errors": [3, 0, 3]
14. },
15. {
16. "name": "main.js",
17. "type": "file",
18. "errors": [0, 0, 0]
19. },
20. {
21. "name": "util.js",
22. "type": "file",
23. "errors": [0, 0, 0]
24. }
25. ],
26. "basePath": "scripts/source",
27. "fileCount": 4,
28. "errors": [3, 0, 3]
29.},
30.{
31. "name": "jquery-1.3.2.js",
32. "type": "file",
33. "basePath": "scripts/jquery-1.3.2.js",
34. "errors": [51, 43, 8]
35.}]
这样一个JSON字符串其实描述了一个如下的文件结构:+scripts/source-config.js-lint.js-main.js-util.js-scripts/jquery-1.3.2.js特别注意的是,根节点多了一个属性basePath用来表示根路径。errors表示此JavaScript文件中的错误数(这是一个数组,第一个表示总数,第二个表示严重错误的 个数)。页面效果: