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

option.es5

Expand Messages
  • Douglas Crockford
    There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals. It will require that the
    Message 1 of 12 , Apr 5 5:07 PM
    View Source
    • 0 Attachment
      There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals.

      It will require that the get and set functions be declared together, that the get function have no parameters, and that the set function will have a single parameter called 'value'.

      Please let me know if you find any problems. Eventually it may recognize other corrections with this option, such as dangling commas in array and object literals.
    • Harry Whitfield
      The Widget Tester Widget (version 8.9) with JSLint Edition 2010-04-05 is now at http://tinyurl.com/5unocx . This version has the new Tolerate ES5 syntax
      Message 2 of 12 , Apr 6 1:45 AM
      View Source
      • 0 Attachment
        The Widget Tester Widget (version 8.9) with JSLint Edition 2010-04-05 is now at

        http://tinyurl.com/5unocx .

        This version has the new "Tolerate ES5 syntax" option.

        Harry.
      • Douglas Crockford
        ... option.es5 will now relax the reserved word restriction on object literals and dot notation, and tolerate a dangling comma, so var object = { class:
        Message 3 of 12 , Apr 6 9:18 AM
        View Source
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
          >
          > There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals.
          >
          > It will require that the get and set functions be declared together, that the get function have no parameters, and that the set function will have a single parameter called 'value'.
          >
          > Please let me know if you find any problems.


          option.es5 will now relax the reserved word restriction on object
          literals and dot notation, and tolerate a dangling comma, so

          var object = {
          class: x.class,
          };

          is accepted.
        • boyopeg
          It seems to me that the trailing comma in object notation is a rather bad coding practice. I m fine with JS parsers being able to ignore errors such as these.
          Message 4 of 12 , Apr 6 9:47 AM
          View Source
          • 0 Attachment
            It seems to me that the trailing comma in object notation is a rather bad coding practice. I'm fine with JS parsers being able to ignore errors such as these. But why should a style and syntax checking tool like JSLint be blind to such sloppy code practices?  Am I missing something with this option? 

            -noah

            --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
            >
            > --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@> wrote:
            > >
            > > There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals.
            > >
            > > It will require that the get and set functions be declared together, that the get function have no parameters, and that the set function will have a single parameter called 'value'.
            > >
            > > Please let me know if you find any problems.
            >
            >
            > option.es5 will now relax the reserved word restriction on object
            > literals and dot notation, and tolerate a dangling comma, so
            >
            > var object = {
            > class: x.class,
            > };
            >
            > is accepted.
            >
          • Michael Mikowski
            There is a very good reason to allow for trailing commas (even though IE js doesn t) -- Consider this object (since we only use it as an associative array
            Message 5 of 12 , Apr 6 11:54 AM
            View Source
            • 0 Attachment
              There is a very good reason to allow for trailing commas (even though IE js doesn't) -- Consider this 'object' (since we only use it as an associative array here, we call it a hash):

              var hash_example = [
              foo : 'bar',
              zing : 'zang',
              one : 'two'
              ];

              Now lets say I want to reorder the keys so they are alphabetical:

              var hash_example = [
              foo : 'bar',
              one : 'two'
              zing : 'zang',
              ];

              Boom. Instant error -- in two places. Allowing trailing commas avoids this problem nicely.

              In Perl, a trailing comma is best practice, and omitting the trailing comma is
              considered sloppy.

              If IE would allow trailing commas, I'd use them consistently. Since it doesn't, I use jslint to find the above errors :)



              Cheers, Mike



              ________________________________
              From: boyopeg <boyopeg@...>
              To: jslint_com@yahoogroups.com
              Sent: Tue, April 6, 2010 9:47:41 AM
              Subject: [jslint] Re: option.es5


              It seems to me that the trailing comma in object notation is a rather bad coding practice. I'm fine with JS parsers being able to ignore errors such as these. But why should a style and syntax checking tool like JSLint be blind to such sloppy code practices? Am I missing something with this option?

              -noah

              --- In jslint_com@yahoogro ups.com, "Douglas Crockford" <douglas@... > wrote:
              >
              > --- In jslint_com@yahoogro ups.com, "Douglas Crockford" <douglas@> wrote:
              > >
              > > There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals.
              > >
              > > It will require that the get and set functions be declared together, that the get function have no parameters, and that the set function will have a single parameter called 'value'.
              > >
              > > Please let me know if you find any problems.
              >
              >
              > option.es5 will now relax the reserved word restriction on object
              > literals and dot notation, and tolerate a dangling comma, so
              >
              > var object = {
              > class: x.class,
              > };
              >
              > is accepted.
              >




              [Non-text portions of this message have been removed]
            • Michael Mikowski
              Whoops. Need more coffee. Should be var hash_example = {...}, not []. But you get the idea. ________________________________ From: Michael Mikowski
              Message 6 of 12 , Apr 6 11:56 AM
              View Source
              • 0 Attachment
                Whoops. Need more coffee. Should be var hash_example = {...}, not []. But you get the idea.





                ________________________________
                From: Michael Mikowski <z_mikowski@...>
                To: jslint_com@yahoogroups.com
                Sent: Tue, April 6, 2010 11:54:25 AM
                Subject: Re: [jslint] Re: option.es5


                There is a very good reason to allow for trailing commas (even though IE js doesn't) -- Consider this 'object' (since we only use it as an associative array here, we call it a hash):

                var hash_example = [
                foo : 'bar',
                zing : 'zang',
                one : 'two'
                ];

                Now lets say I want to reorder the keys so they are alphabetical:

                var hash_example = [
                foo : 'bar',
                one : 'two'
                zing : 'zang',
                ];

                Boom. Instant error -- in two places. Allowing trailing commas avoids this problem nicely.

                In Perl, a trailing comma is best practice, and omitting the trailing comma is
                considered sloppy.

                If IE would allow trailing commas, I'd use them consistently. Since it doesn't, I use jslint to find the above errors :)



                Cheers, Mike



                ________________________________
                From: boyopeg <boyopeg@...>
                To: jslint_com@yahoogroups.com
                Sent: Tue, April 6, 2010 9:47:41 AM
                Subject: [jslint] Re: option.es5


                It seems to me that the trailing comma in object notation is a rather bad coding practice. I'm fine with JS parsers being able to ignore errors such as these. But why should a style and syntax checking tool like JSLint be blind to such sloppy code practices? Am I missing something with this option?

                -noah

                --- In jslint_com@yahoogro ups.com, "Douglas Crockford" <douglas@... > wrote:
                >
                > --- In jslint_com@yahoogro ups.com, "Douglas Crockford" <douglas@> wrote:
                > >
                > > There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals.
                > >
                > > It will require that the get and set functions be declared together, that the get function have no parameters, and that the set function will have a single parameter called 'value'.
                > >
                > > Please let me know if you find any problems.
                >
                >
                > option.es5 will now relax the reserved word restriction on object
                > literals and dot notation, and tolerate a dangling comma, so
                >
                > var object = {
                > class: x.class,
                > };
                >
                > is accepted.
                >




                [Non-text portions of this message have been removed]
              • Rob Richardson
                I can see in certain circumstances that trailing commas could be deemed acceptable, though I m still of the mindset that this is bad form in most JavaScript
                Message 7 of 12 , Apr 6 12:16 PM
                View Source
                • 0 Attachment
                  I can see in certain circumstances that trailing commas could be deemed acceptable, though I'm still of the mindset that this is bad form in most JavaScript contexts. I'm failing to see how opting into this practice is linked to ES5 compatibility though. Does ES5 specifically dictate that trailing commas are acceptable?

                  Rob





                  ________________________________
                  From: Michael Mikowski <z_mikowski@...>
                  To: jslint_com@yahoogroups.com
                  Sent: Tue, April 6, 2010 11:56:46 AM
                  Subject: Re: [jslint] Re: option.es5


                  Whoops. Need more coffee. Should be var hash_example = {...}, not []. But you get the idea.

                  ____________ _________ _________ __
                  From: Michael Mikowski <z_mikowski@yahoo. com>
                  To: jslint_com@yahoogro ups.com
                  Sent: Tue, April 6, 2010 11:54:25 AM
                  Subject: Re: [jslint] Re: option.es5

                  There is a very good reason to allow for trailing commas (even though IE js doesn't) -- Consider this 'object' (since we only use it as an associative array here, we call it a hash):

                  var hash_example = [
                  foo : 'bar',
                  zing : 'zang',
                  one : 'two'
                  ];

                  Now lets say I want to reorder the keys so they are alphabetical:

                  var hash_example = [
                  foo : 'bar',
                  one : 'two'
                  zing : 'zang',
                  ];

                  Boom. Instant error -- in two places. Allowing trailing commas avoids this problem nicely.

                  In Perl, a trailing comma is best practice, and omitting the trailing comma is
                  considered sloppy.

                  If IE would allow trailing commas, I'd use them consistently. Since it doesn't, I use jslint to find the above errors :)

                  Cheers, Mike

                  ____________ _________ _________ __
                  From: boyopeg <boyopeg@gmail. com>
                  To: jslint_com@yahoogro ups.com
                  Sent: Tue, April 6, 2010 9:47:41 AM
                  Subject: [jslint] Re: option.es5

                  It seems to me that the trailing comma in object notation is a rather bad coding practice. I'm fine with JS parsers being able to ignore errors such as these. But why should a style and syntax checking tool like JSLint be blind to such sloppy code practices? Am I missing something with this option?

                  -noah

                  --- In jslint_com@yahoogro ups.com, "Douglas Crockford" <douglas@... > wrote:
                  >
                  > --- In jslint_com@yahoogro ups.com, "Douglas Crockford" <douglas@> wrote:
                  > >
                  > > There is a new option, Tolerate ES5 syntax. If you check this option, JSLint will accept the new get/set syntax in object literals.
                  > >
                  > > It will require that the get and set functions be declared together, that the get function have no parameters, and that the set function will have a single parameter called 'value'.
                  > >
                  > > Please let me know if you find any problems.
                  >
                  >
                  > option.es5 will now relax the reserved word restriction on object
                  > literals and dot notation, and tolerate a dangling comma, so
                  >
                  > var object = {
                  > class: x.class,
                  > };
                  >
                  > is accepted.





                  [Non-text portions of this message have been removed]
                • Douglas Crockford
                  ... ES3 does not allow the trailing comma, so IE is correct when it rejects it. ES5 allows but does not require the trailing comma. There is often confusion
                  Message 8 of 12 , Apr 6 12:35 PM
                  View Source
                  • 0 Attachment
                    --- In jslint_com@yahoogroups.com, Rob Richardson <erobrich@...> wrote:
                    >
                    > I can see in certain circumstances that trailing commas could be deemed acceptable, though I'm still of the mindset that this is bad form in most JavaScript contexts. I'm failing to see how opting into this practice is linked to ES5 compatibility though. Does ES5 specifically dictate that trailing commas are acceptable?

                    ES3 does not allow the trailing comma, so IE is correct when it rejects it.

                    ES5 allows but does not require the trailing comma.

                    There is often confusion between separators and terminators. Commas are separators. Semicolons are terminators.
                  • Michael Lorton
                    ... it. Distinguo: ES3 does not allow the trailing comma, so Internet Explorer is correct TO reject it. IE does the right thing the wrong way. It rejects the
                    Message 9 of 12 , Apr 6 12:48 PM
                    View Source
                    • 0 Attachment
                      > ES3 does not allow the trailing comma, so IE is correct when it rejects
                      it.

                      Distinguo: ES3 does not allow the trailing comma, so Internet Explorer is correct TO reject
                      it.

                      IE does the right thing the wrong way. It rejects the comma and gives an ambiguous message and the line number BUT NOT THE FILE NAME.

                      Even assuming Microsoft employees should otherwise be allowed to live, this transgression (perversely maintained through every version of IE) is alone grounds for hunting them all down with dogs and shotguns.

                      M.




                      ________________________________
                      From: Douglas Crockford <douglas@...>
                      To: jslint_com@yahoogroups.com
                      Sent: Tue, April 6, 2010 12:35:27 PM
                      Subject: [jslint] Re: option.es5

                      --- In jslint_com@yahoogroups.com, Rob Richardson <erobrich@...> wrote:
                      >
                      > I can see in certain circumstances that trailing commas could be deemed acceptable, though I'm still of the mindset that this is bad form in most JavaScript contexts. I'm failing to see how opting into this practice is linked to ES5 compatibility though. Does ES5 specifically dictate that trailing commas are acceptable?

                      ES3 does not allow the trailing comma, so IE is correct when it rejects it.

                      ES5 allows but does not require the trailing comma.

                      There is often confusion between separators and terminators. Commas are separators. Semicolons are terminators.



                      ------------------------------------

                      Yahoo! Groups Links



                      [Non-text portions of this message have been removed]
                    • Douglas Crockford
                      ... You are way out of line. Tone it down.
                      Message 10 of 12 , Apr 6 1:12 PM
                      View Source
                      • 0 Attachment
                        --- In jslint_com@yahoogroups.com, Michael Lorton <mlorton@...> wrote:
                        > Even assuming Microsoft employees should otherwise be allowed to live, this transgression (perversely maintained through every version of IE) is alone grounds for hunting them all down with dogs and shotguns.


                        You are way out of line. Tone it down.
                      • Simon Kenyon Shepard
                        So, would I be correct in surmising that this change from ES3 to ES5 to allow the trailing comma is for developer convenience as in the aforementioned
                        Message 11 of 12 , Apr 7 5:26 AM
                        View Source
                        • 0 Attachment
                          So, would I be correct in surmising that this change from ES3 to ES5 to
                          allow the trailing comma is for developer convenience as in the
                          aforementioned reordering example?

                          Out of curiosity are there any other reasons or examples where this would
                          come in useful?



                          On 6 April 2010 21:48, Michael Lorton <mlorton@...> wrote:

                          >
                          >
                          > > ES3 does not allow the trailing comma, so IE is correct when it rejects
                          > it.
                          >
                          > Distinguo: ES3 does not allow the trailing comma, so Internet Explorer is
                          > correct TO reject
                          > it.
                          >
                          > IE does the right thing the wrong way. It rejects the comma and gives an
                          > ambiguous message and the line number BUT NOT THE FILE NAME.
                          >
                          > Even assuming Microsoft employees should otherwise be allowed to live, this
                          > transgression (perversely maintained through every version of IE) is alone
                          > grounds for hunting them all down with dogs and shotguns.
                          >
                          > M.
                          >
                          > ________________________________
                          > From: Douglas Crockford <douglas@... <douglas%40crockford.com>>
                          >
                          > To: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>
                          > Sent: Tue, April 6, 2010 12:35:27 PM
                          >
                          > Subject: [jslint] Re: option.es5
                          >
                          > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, Rob
                          > Richardson <erobrich@...> wrote:
                          > >
                          > > I can see in certain circumstances that trailing commas could be deemed
                          > acceptable, though I'm still of the mindset that this is bad form in most
                          > JavaScript contexts. I'm failing to see how opting into this practice is
                          > linked to ES5 compatibility though. Does ES5 specifically dictate that
                          > trailing commas are acceptable?
                          >
                          > ES3 does not allow the trailing comma, so IE is correct when it rejects it.
                          >
                          > ES5 allows but does not require the trailing comma.
                          >
                          > There is often confusion between separators and terminators. Commas are
                          > separators. Semicolons are terminators.
                          >
                          > ------------------------------------
                          >
                          > Yahoo! Groups Links
                          >
                          >
                          > [Non-text portions of this message have been removed]
                          >
                          >
                          >



                          --
                          "We are the music makers, And we are the dreamers of dreams"


                          [Non-text portions of this message have been removed]
                        • Michael Lorton
                          It makes reordering easier, editing the list less error-prone, and generating Javascript from data a little simpler. Overall, probably a good thing. M.
                          Message 12 of 12 , Apr 7 7:32 AM
                          View Source
                          • 0 Attachment
                            It makes reordering easier, editing the list less error-prone, and generating Javascript from data a little simpler. Overall, probably a good thing.

                            M.




                            ________________________________
                            From: Simon Kenyon Shepard <simon.shepard@...>
                            To: jslint_com@yahoogroups.com
                            Sent: Wed, April 7, 2010 5:26:29 AM
                            Subject: Re: [jslint] Re: option.es5

                            So, would I be correct in surmising that this change from ES3 to ES5 to
                            allow the trailing comma is for developer convenience as in the
                            aforementioned reordering example?

                            Out of curiosity are there any other reasons or examples where this would
                            come in useful?



                            On 6 April 2010 21:48, Michael Lorton <mlorton@...> wrote:

                            >
                            >
                            > > ES3 does not allow the trailing comma, so IE is correct when it rejects
                            > it.
                            >
                            > Distinguo: ES3 does not allow the trailing comma, so Internet Explorer is
                            > correct TO reject
                            > it.
                            >
                            > IE does the right thing the wrong way. It rejects the comma and gives an
                            > ambiguous message and the line number BUT NOT THE FILE NAME.
                            >
                            > Even assuming Microsoft employees should otherwise be allowed to live, this
                            > transgression (perversely maintained through every version of IE) is alone
                            > grounds for hunting them all down with dogs and shotguns.
                            >
                            > M.
                            >
                            > ________________________________
                            > From: Douglas Crockford <douglas@... <douglas%40crockford.com>>
                            >
                            > To: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>
                            > Sent: Tue, April 6, 2010 12:35:27 PM
                            >
                            > Subject: [jslint] Re: option.es5
                            >
                            > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, Rob
                            > Richardson <erobrich@...> wrote:
                            > >
                            > > I can see in certain circumstances that trailing commas could be deemed
                            > acceptable, though I'm still of the mindset that this is bad form in most
                            > JavaScript contexts. I'm failing to see how opting into this practice is
                            > linked to ES5 compatibility though. Does ES5 specifically dictate that
                            > trailing commas are acceptable?
                            >
                            > ES3 does not allow the trailing comma, so IE is correct when it rejects it.
                            >
                            > ES5 allows but does not require the trailing comma.
                            >
                            > There is often confusion between separators and terminators. Commas are
                            > separators. Semicolons are terminators.
                            >
                            > ------------------------------------
                            >
                            > Yahoo! Groups Links
                            >
                            >
                            > [Non-text portions of this message have been removed]
                            >
                            >
                            >



                            --
                            "We are the music makers, And we are the dreamers of dreams"


                            [Non-text portions of this message have been removed]



                            ------------------------------------

                            Yahoo! Groups Links



                            [Non-text portions of this message have been removed]
                          Your message has been successfully submitted and would be delivered to recipients shortly.