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

Re: [jslint] Re: several JSLint errors I can't understand

Expand Messages
  • Harry Whitfield
    Äkräm, Instead of trying to modify JSLint to accept non-standard JavaScript, you could consider altering the JavaScript code to make it conform to the
    Message 1 of 16 , Jan 7, 2010
    • 0 Attachment
      Äkräm,

      Instead of trying to modify JSLint to accept non-standard JavaScript, you could consider altering the JavaScript code to make it conform to the standard.
      That would be my preferred solution.

      Another possibility would be to pre-process the code to replace "let" and "const" by "var". It would also be fairly easy to modify JSLint or its file input code to do that.
      However, if I remember correctly, the semantics of "let" is not quite the same as that of "var".

      Harry.
    • Ekrem Tomur
      Hi Harry, Thank you for your helpful thoughts. But since I am a tester on a mozilla extension project and those js code I am testing meant to run on mozilla
      Message 2 of 16 , Jan 7, 2010
      • 0 Attachment
        Hi Harry,

        Thank you for your helpful thoughts. But since I am a tester on a mozilla
        extension project and those js code I am testing meant to run on mozilla
        javascript engine, I can not ask developers to use standard javascript
        instead of mozilla one. I must test their code, I hope JSLint can help me a
        little bit.

        You are right, now I also think treating let and const as var is a bad idea,
        since they are not quiet similar and also should be tested as a way they
        should be tested. So I like Tom's idea, add an Mozilla option since this is
        also quiet popular version of JS. If that could be done I will happy to
        contribute.

        Br,
        Äkräm

        On Thu, Jan 7, 2010 at 2:45 PM, Harry Whitfield <g7awz@...>wrote:

        >
        >
        > Äkräm,
        >
        > Instead of trying to modify JSLint to accept non-standard JavaScript, you
        > could consider altering the JavaScript code to make it conform to the
        > standard.
        > That would be my preferred solution.
        >
        > Another possibility would be to pre-process the code to replace "let" and
        > "const" by "var". It would also be fairly easy to modify JSLint or its file
        > input code to do that.
        > However, if I remember correctly, the semantics of "let" is not quite the
        > same as that of "var".
        >
        > Harry.
        >
        >
        >


        [Non-text portions of this message have been removed]
      • Tom Byers
        Interesting and kind of a catch 22. If Äkräm substitutes let and const then he is using the syntax of the language he is working in against the spec, the
        Message 3 of 16 , Jan 7, 2010
        • 0 Attachment
          Interesting and kind of a catch 22. If �kr�m substitutes let and const then
          he is using the syntax of the language he is working in against the spec,
          the very thing JSLint is meant to prevent.

          From what I read let is an additional way to define block scope so you could
          do some pre-processing that wrapped it in a function and split the variable
          assignments in the brackets out into separate variable assignments. This
          should let you test the scope correctly:

          var x = 5;
          var y = 0;

          let (x = x+10, y = 12) {
          print(x+y + "\n");
          }

          print((x + y) + "\n");

          as

          var x = 5;
          var y = 0;

          var let1 = function() {
          var x = x+10, y = 12;
          print(x+y + "\n");
          }

          print((x + y) + "\n");

          Print should also be commented.

          As for const, this provides something that standard Javascript doesn't
          currently support - proper constants. You can declare them as vars for the
          purposes of Linting but this JSLint will not actually check that your
          developers are staying true to the syntax.

          https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/const

          Tom

          p.s. don't worry to Simon, just trying to get this interesting discussion
          back on track :)

          On Thu, Jan 7, 2010 at 1:18 PM, Ekrem Tomur <ekrem.tomur@...> wrote:

          >
          >
          > Hi Harry,
          >
          > Thank you for your helpful thoughts. But since I am a tester on a mozilla
          > extension project and those js code I am testing meant to run on mozilla
          > javascript engine, I can not ask developers to use standard javascript
          > instead of mozilla one. I must test their code, I hope JSLint can help me a
          > little bit.
          >
          > You are right, now I also think treating let and const as var is a bad
          > idea,
          > since they are not quiet similar and also should be tested as a way they
          > should be tested. So I like Tom's idea, add an Mozilla option since this is
          > also quiet popular version of JS. If that could be done I will happy to
          > contribute.
          >
          > Br,
          > �kr�m
          >
          > On Thu, Jan 7, 2010 at 2:45 PM, Harry Whitfield <g7awz@...<g7awz%40btinternet.com>
          > >wrote:
          >
          >
          > >
          > >
          > > �kr�m,
          > >
          > > Instead of trying to modify JSLint to accept non-standard JavaScript, you
          > > could consider altering the JavaScript code to make it conform to the
          > > standard.
          > > That would be my preferred solution.
          > >
          > > Another possibility would be to pre-process the code to replace "let" and
          > > "const" by "var". It would also be fairly easy to modify JSLint or its
          > file
          > > input code to do that.
          > > However, if I remember correctly, the semantics of "let" is not quite the
          > > same as that of "var".
          > >
          > > Harry.
          > >
          > >
          > >
          >
          > [Non-text portions of this message have been removed]
          >
          >
          >


          [Non-text portions of this message have been removed]
        • Morgaut Alexandre Louis Marc
          I saw in previous posts kind of same assume request for some ssjs environment. I think it might be harder to assume mozilla or commonjs Than browser
          Message 4 of 16 , Jan 7, 2010
          • 0 Attachment
            I saw in previous posts kind of same "assume" request for some ssjs
            environment.

            I think it might be harder to assume "mozilla" or "commonjs" Than
            "browser" and "rhino" Because Mozilla JavaScript has more commands,
            and CommonJS has more types whereas the lastest only have builtin
            objects and methods which CAN be declared to JSLint as globals.

            Mozilla JavaScript is a différent language version, as are
            ActionScript and JScript. All of them should support ecmascript
            specification which is what JSlint is testing

            Asking to JSlint to support the specificities of main JavaScript
            implentation could be a powerfull option, it just be a little more
            complicated.

            It looks like one of the goals of JSLint was to help writing safe and
            portable codes, which explain the limitation to ECMAScript.

            So what about choosing the version number of the implementation we
            want to assume (Well I could like it)

            But sure, I'd love assume "server" instead of "rhino"

            Alexandre

            From iPhone

            Le 7 janv. 2010 à 14:18, Ekrem Tomur <ekrem.tomur@...> a écrit :

            > Hi Harry,
            >
            > Thank you for your helpful thoughts. But since I am a tester on a
            > mozilla
            > extension project and those js code I am testing meant to run on
            > mozilla
            > javascript engine, I can not ask developers to use standard javascript
            > instead of mozilla one. I must test their code, I hope JSLint can
            > help me a
            > little bit.
            >
            > You are right, now I also think treating let and const as var is a
            > bad idea,
            > since they are not quiet similar and also should be tested as a way
            > they
            > should be tested. So I like Tom's idea, add an Mozilla option since
            > this is
            > also quiet popular version of JS. If that could be done I will happy
            > to
            > contribute.
            >
            > Br,
            > Äkräm
            >
            > On Thu, Jan 7, 2010 at 2:45 PM, Harry Whitfield
            > <g7awz@...>wrote:
            >
            > >
            > >
            > > Äkräm,
            > >
            > > Instead of trying to modify JSLint to accept non-standard
            > JavaScript, you
            > > could consider altering the JavaScript code to make it conform to
            > the
            > > standard.
            > > That would be my preferred solution.
            > >
            > > Another possibility would be to pre-process the code to replace
            > "let" and
            > > "const" by "var". It would also be fairly easy to modify JSLint or
            > its file
            > > input code to do that.
            > > However, if I remember correctly, the semantics of "let" is not
            > quite the
            > > same as that of "var".
            > >
            > > Harry.
            > >
            > >
            > >
            >
            > [Non-text portions of this message have been removed]
            >
            >


            [Non-text portions of this message have been removed]
          • Ekrem Tomur
            Can somebody send me well formatted version of jslint.js? I really do not want to waste my time on preprocessing since it is wrong and limited. I want to try
            Message 5 of 16 , Jan 8, 2010
            • 0 Attachment
              Can somebody send me well formatted version of jslint.js? I really do not
              want to waste my time on preprocessing since it is wrong and limited. I want
              to try to implement Mozilla option myself, at least the part I needed. But
              that jslint.js version annoying me since it is hard to read and change.

              On Thu, Jan 7, 2010 at 7:17 PM, Morgaut Alexandre Louis Marc <
              morgaut@...> wrote:

              >
              >
              > I saw in previous posts kind of same "assume" request for some ssjs
              > environment.
              >
              > I think it might be harder to assume "mozilla" or "commonjs" Than
              > "browser" and "rhino" Because Mozilla JavaScript has more commands,
              > and CommonJS has more types whereas the lastest only have builtin
              > objects and methods which CAN be declared to JSLint as globals.
              >
              > Mozilla JavaScript is a différent language version, as are
              > ActionScript and JScript. All of them should support ecmascript
              > specification which is what JSlint is testing
              >
              > Asking to JSlint to support the specificities of main JavaScript
              > implentation could be a powerfull option, it just be a little more
              > complicated.
              >
              > It looks like one of the goals of JSLint was to help writing safe and
              > portable codes, which explain the limitation to ECMAScript.
              >
              > So what about choosing the version number of the implementation we
              > want to assume (Well I could like it)
              >
              > But sure, I'd love assume "server" instead of "rhino"
              >
              > Alexandre
              >
              > From iPhone
              >
              > Le 7 janv. 2010 à 14:18, Ekrem Tomur <ekrem.tomur@...<ekrem.tomur%40gmail.com>>
              > a écrit :
              >
              >
              > > Hi Harry,
              > >
              > > Thank you for your helpful thoughts. But since I am a tester on a
              > > mozilla
              > > extension project and those js code I am testing meant to run on
              > > mozilla
              > > javascript engine, I can not ask developers to use standard javascript
              > > instead of mozilla one. I must test their code, I hope JSLint can
              > > help me a
              > > little bit.
              > >
              > > You are right, now I also think treating let and const as var is a
              > > bad idea,
              > > since they are not quiet similar and also should be tested as a way
              > > they
              > > should be tested. So I like Tom's idea, add an Mozilla option since
              > > this is
              > > also quiet popular version of JS. If that could be done I will happy
              > > to
              > > contribute.
              > >
              > > Br,
              > > Äkräm
              > >
              > > On Thu, Jan 7, 2010 at 2:45 PM, Harry Whitfield
              > > <g7awz@... <g7awz%40btinternet.com>>wrote:
              > >
              > > >
              > > >
              > > > Äkräm,
              > > >
              > > > Instead of trying to modify JSLint to accept non-standard
              > > JavaScript, you
              > > > could consider altering the JavaScript code to make it conform to
              > > the
              > > > standard.
              > > > That would be my preferred solution.
              > > >
              > > > Another possibility would be to pre-process the code to replace
              > > "let" and
              > > > "const" by "var". It would also be fairly easy to modify JSLint or
              > > its file
              > > > input code to do that.
              > > > However, if I remember correctly, the semantics of "let" is not
              > > quite the
              > > > same as that of "var".
              > > >
              > > > Harry.
              > > >
              > > >
              > > >
              > >
              > > [Non-text portions of this message have been removed]
              > >
              > >
              >
              > [Non-text portions of this message have been removed]
              >
              >
              >


              [Non-text portions of this message have been removed]
            • Douglas Crockford
              ... Read the instructions. http://www.jslint.com/lint.html
              Message 6 of 16 , Jan 8, 2010
              • 0 Attachment
                --- In jslint_com@yahoogroups.com, Ekrem Tomur <ekrem.tomur@...> wrote:
                >
                > Can somebody send me well formatted version of jslint.js? I really do not
                > want to waste my time on preprocessing since it is wrong and limited. I want
                > to try to implement Mozilla option myself, at least the part I needed. But
                > that jslint.js version annoying me since it is hard to read and change.


                Read the instructions. http://www.jslint.com/lint.html
              • Klemen Slavič
                Or try a code beautifier: http://jsbeautifier.org/ 2010/1/8 Douglas Crockford ... [Non-text portions of this message have been removed]
                Message 7 of 16 , Jan 8, 2010
                • 0 Attachment
                  Or try a code beautifier:

                  http://jsbeautifier.org/

                  2010/1/8 Douglas Crockford <douglas@...>

                  >
                  >
                  > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, Ekrem
                  > Tomur <ekrem.tomur@...> wrote:
                  > >
                  > > Can somebody send me well formatted version of jslint.js? I really do not
                  > > want to waste my time on preprocessing since it is wrong and limited. I
                  > want
                  > > to try to implement Mozilla option myself, at least the part I needed.
                  > But
                  > > that jslint.js version annoying me since it is hard to read and change.
                  >
                  > Read the instructions. http://www.jslint.com/lint.html
                  >
                  >
                  >


                  [Non-text portions of this message have been removed]
                • Noah Sussman
                  ... How about http://www.jslint.com/fulljslint.js
                  Message 8 of 16 , Jan 8, 2010
                  • 0 Attachment
                    On Fri, Jan 8, 2010 at 9:18 AM, Ekrem Tomur <ekrem.tomur@...> wrote:
                    >
                    >
                    >
                    > Can somebody send me well formatted version of jslint.js?

                    How about

                    http://www.jslint.com/fulljslint.js
                  Your message has been successfully submitted and would be delivered to recipients shortly.