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

Web and rhino differences

Expand Messages
  • santini.alberto
    I pasted the following snippet in jslint.com text area, selected The Good Parts options and pressed JSLint button:function foo(p1) { var a = p1, b; return
    Message 1 of 7 , May 17, 2010
    • 0 Attachment
      I pasted the following snippet in jslint.com text area, selected "The
      Good Parts" options and pressed "JSLint" button:function foo(p1) {
      var a = p1, b;
      return a;
      }The result was: "Error: Unused variable: b 1 foo".

      Using locally the rhino version (2010-04-06) I get: "p.js:1: Missing
      "use strict" statement."

      In the first case, JSLint missed use strict error; in the second one the
      unused variable.

      What have I been missing?

      Thanks in advance,
      Alberto


      [Non-text portions of this message have been removed]
    • santini.alberto
      The snippet: function foo(p1) { var a = p1, b; return a; } Regards, Alberto
      Message 2 of 7 , May 18, 2010
      • 0 Attachment
        The snippet:

        function foo(p1) {
        var a = p1, b;
        return a;
        }

        Regards,
        Alberto
      • santini.alberto
        It seems there is a difference if I use, for instance, FireFox (3.6.3) on Windows XP: the web version catches correctly the two errors. In my first post I used
        Message 3 of 7 , May 19, 2010
        • 0 Attachment
          It seems there is a difference if I use, for instance, FireFox (3.6.3) on Windows XP: the web version catches correctly the two errors.

          In my first post I used Firefox 3.6.3 on Ubuntu 10.04.

          Locally on Windows or Linux, using the rhino approach, I get "only" the error "Missing "use strict" statement.".

          The options are the same: good parts enabled.

          Any idea or suggestion?

          Regards,
          Alberto
        • Douglas Crockford
          ... It would seem that there is a bug in Rhino.
          Message 4 of 7 , May 19, 2010
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "santini.alberto" <albertosantini@...> wrote:
            >
            >
            > It seems there is a difference if I use, for instance, FireFox (3.6.3) on Windows XP: the web version catches correctly the two errors.
            >
            > In my first post I used Firefox 3.6.3 on Ubuntu 10.04.
            >
            > Locally on Windows or Linux, using the rhino approach, I get "only" the error "Missing "use strict" statement.".
            >
            > The options are the same: good parts enabled.
            >
            > Any idea or suggestion?


            It would seem that there is a bug in Rhino.
          • santini.alberto
            ... On Windows I used cscript executable and the output is equals to rhino one. Same bug? Possible but with low probability. Regards, Alberto
            Message 5 of 7 , May 19, 2010
            • 0 Attachment
              --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
              >
              > It would seem that there is a bug in Rhino.
              >

              On Windows I used "cscript" executable and the output is equals to rhino one.

              Same bug? Possible but with low probability.

              Regards,
              Alberto
            • santini.alberto
              ... I jslinted the snippet with V8 [1]: it reports only use strict error. No idea because it doesn t report also unused variable error. Regards, Alberto
              Message 6 of 7 , May 21, 2010
              • 0 Attachment
                --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
                >
                >
                > It would seem that there is a bug in Rhino.
                >

                I jslinted the snippet with V8 [1]: it reports only "use strict" error.

                No idea because it doesn't report also "unused variable" error.

                Regards,
                Alberto

                [1] http://groups.google.com/group/nodejs/t/aa30e1b6f4f6314f
              • santini.alberto
                ... I added in my rhino script the following code: data = JSLINT.data(); if (data.unused) { for (i = 0; i
                Message 7 of 7 , May 30, 2010
                • 0 Attachment
                  --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
                  >
                  > It would seem that there is a bug in Rhino.
                  >

                  I added in my rhino script the following code:

                  data = JSLINT.data();
                  if (data.unused) {
                  for (i = 0; i < data.unused.length; i += 1) {
                  print(filename + ':' + data.unused[i].line + ': ' +
                  'Unused variable \'' + data.unused[i].name + '\'.');
                  }
                  }

                  It is quite similar to the code you found in the report function.
                  Now the unused variables are printed.

                  I think the web version print the html created by the report function.
                  This is the difference between rhino and web jslint.

                  Maybe a call of the warning function would be better, adding an item in errors array, when an unused variable is detected.

                  Another approach may be adding a warning array: JSLINT.warnings.

                  Regards,
                  Alberto
                Your message has been successfully submitted and would be delivered to recipients shortly.