Loading ...
Sorry, an error occurred while loading the content.

Re: SV: [jslint] js_beautify bookmarklet

Expand Messages
  • walfisch1
    what s the value of linting a beautified version of some script? It s better than not linting at all. True, I don t get what I d like to get, and JSLint
    Message 1 of 2 , Jan 26, 2011
    View Source
    • 0 Attachment
      "what's the value of linting a beautified version of some script?"
      It's better than not linting at all.
      True, I don't get what I'd like to get, and JSLint might not find all errors it could. But it still can tell me about missing semicola, lax regexps, implied globals, ...
      I like JSLint's code conventions (http://javascript.crockford.com/code.html) and use them in my private projects, but in a team with lots of projects I can't switch the code conventions or just write my own style.



      --- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
      >
      > Maybe I'm just being dumb, but what's the value of linting a beautified version of some script? Assuming (as you state) that turning off strict whitespace checking is not enough, chances are the original script has bugs that jslint fails to find because the beautifier changes or removes them.
      >
      > You should convince your employer that following the advice of jslint is better for everyone.
      >
      > /Jakob
      >
      > Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af walfisch1
      > Sendt: 26. januar 2011 14:26
      > Til: jslint_com@yahoogroups.com
      > Emne: [jslint] js_beautify bookmarklet
      >
      >
      > My new employer has a non-JSLint-compliant white-space code convention. No options will make this validate.
      > To use JSLint nontheless I wrote a bookmarklet that fetches jsbeautifier and beautifies the JSLint input field.
      > Feel free to use or modify.
      > (You want to see this monospaced and indented? Click "Show Message Option" on the right and select "Use Fixed Width Font".)
      >
      > /*global js_beautify*/
      > (function () {
      > var execute, input, lock, script;
      >
      > execute = function () {
      > if (lock) {
      > setTimeout(execute, 1000);
      > return;
      > }
      > input = document.getElementById("JSLINT_INPUT");
      > input.value = js_beautify(input.value, {
      > space_after_anon_function: true
      > });
      > };
      >
      > if (typeof js_beautify === "undefined" &&
      > !document.getElementById("_beauty_lint_")) {
      > lock = true;
      > script = document.createElement("script");
      > script.id = "_beauty_lint_";
      > script.src = "http://jsbeautifier.org/beautify.js";
      > script.onload = function () {
      > lock = false;
      > };
      > document.body.appendChild(script);
      > }
      >
      > execute();
      > }());
      >
      >
      > [Non-text portions of this message have been removed]
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.