d8.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*extern JSLINT */
  2. /*jslint rhino: true*/
  3. (function (a) {
  4. if (!a[0]) {
  5. print("Usage: jslint.js file.js");
  6. quit(1);
  7. }
  8. var input = read(a[0]);
  9. if (!input) {
  10. print("jslint: Couldn't open file '" + a[0] + "'.");
  11. quit(1);
  12. }
  13. if (!JSLINT(input, {bitwise: false, eqeqeq: true, immed: true,
  14. newcap: false, nomen: true, onevar: false, plusplus: false,
  15. evil: true, sub: false, nomen: false,
  16. regexp: true, rhino: true, undef: true, white: false, indent: false, laxbreak:true})) {
  17. for (var i = 0; i < JSLINT.errors.length; i += 1) {
  18. var e = JSLINT.errors[i];
  19. if (e) {
  20. print('Lint at line ' + (e.line + 1) + ' character ' +
  21. (e.character + 1) + ': ' + e.reason);
  22. print((e.evidence || '').
  23. replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
  24. print('');
  25. }
  26. }
  27. print("---REPORT");
  28. print(JSLINT.report());
  29. quit(2);
  30. } else {
  31. print("---REPORT");
  32. print(JSLINT.report());
  33. quit();
  34. }
  35. }(arguments));