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

SV: [jslint] problems with Nesting

Expand Messages
  • Jakob Kruse
    JSLint (with the strict whitespace option) does not support the way you write an array. Specifically it does support a line break after a comma, but not
    Message 1 of 5 , Nov 21, 2010
    • 0 Attachment
      JSLint (with the strict whitespace option) does not support the way you write an array. Specifically it does support a line break after a comma, but not between the last array element and the end brace. This leads to the “wrong indentation” error.

      /Jakob


      Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af abyssoft@...
      Sendt: 22. november 2010 00:20
      Til: jslint_com@yahoogroups.com
      Emne: [jslint] problems with Nesting


      given the following snippet where » are tabs (4 space) and ---------- are begin and end markers. (the blank line after the start marker is intentional)

      ----------

      "use strict";
      //Library (Netsuite Objects)
      /*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn, NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup, NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord, NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter, NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
      */
      //Library (Netsuite API)
      /*global nlapiSearchRecord
      */
      //Library (IS_library_V2_00)
      /*global Global
      */
      var searchResults = nlapiSearchRecord(
      »'customrecord_is_module_codes',
      »null,
      »[
      »»new NlobjSearchFilter(
      »»»'internalid',
      »»»null,
      »»»"noneof",
      »»»[
      »»»»29,
      »»»»31,
      »»»»32,
      »»»»33
      »»»]
      »»)
      »]
      );
      ----------

      JSLint responds with a rather unexpected error

      Problem at line 27 character 5: Expected ']' to have an indentation at 9 instead at 5.

      Any insight as to whether this is a bug, or am I missing something?


      [Non-text portions of this message have been removed]
    • abyssoft@ymail.com
      It would be nice if this was supported as it provides good clarity. Any others who would like to weight in?
      Message 2 of 5 , Nov 21, 2010
      • 0 Attachment
        It would be nice if this was supported as it provides good clarity.
        Any others who would like to weight in?

        --- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
        >
        > JSLint (with the strict whitespace option) does not support the way you write an array. Specifically it does support a line break after a comma, but not between the last array element and the end brace. This leads to the "wrong indentation" error.
        >
        > /Jakob
        >
        >
      • abyssoft@ymail.com
        I decided to test your assertion, simplified the test and the result was not as expected given the assertion. The code below did not throw the error, yet uses
        Message 3 of 5 , Nov 22, 2010
        • 0 Attachment
          I decided to test your assertion, simplified the test and the result was not as expected given the assertion. The code below did not throw the error, yet uses the same formatting. So I'm starting to lean toward either throwing the error is a bug or the not throwing the error is a bug, as there should be consistency. As stated previously, my opinion is that the thrown error is the bug.

          ----------

          "use strict";
          var servicesClasses = [
          »"8",
          »"15",
          »"30"
          ];

          ----------

          --- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
          >
          > JSLint (with the strict whitespace option) does not support the way you write an array. Specifically it does support a line break after a comma, but not between the last array element and the end brace. This leads to the "wrong indentation" error.
          >
          > /Jakob
          >
          >
          > Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af abyssoft@...
          > Sendt: 22. november 2010 00:20
          > Til: jslint_com@yahoogroups.com
          > Emne: [jslint] problems with Nesting
          >
          >
          > given the following snippet where » are tabs (4 space) and ---------- are begin and end markers. (the blank line after the start marker is intentional)
          >
          > ----------
          >
          > "use strict";
          > //Library (Netsuite Objects)
          > /*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn, NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup, NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord, NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter, NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
          > */
          > //Library (Netsuite API)
          > /*global nlapiSearchRecord
          > */
          > //Library (IS_library_V2_00)
          > /*global Global
          > */
          > var searchResults = nlapiSearchRecord(
          > »'customrecord_is_module_codes',
          > »null,
          > »[
          > »»new NlobjSearchFilter(
          > »»»'internalid',
          > »»»null,
          > »»»"noneof",
          > »»»[
          > »»»»29,
          > »»»»31,
          > »»»»32,
          > »»»»33
          > »»»]
          > »»)
          > »]
          > );
          > ----------
          >
          > JSLint responds with a rather unexpected error
          >
          > Problem at line 27 character 5: Expected ']' to have an indentation at 9 instead at 5.
          >
          > Any insight as to whether this is a bug, or am I missing something?
          >
          >
          > [Non-text portions of this message have been removed]
          >
        • Douglas Crockford
          ... Thanks. Please try it now. In the future, please try to refine the problem text in bug reports. It is greatly appreciated if you try to make the example
          Message 4 of 5 , Dec 21, 2010
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
            >
            > JSLint (with the strict whitespace option) does not support the way you write an array. Specifically it does support a line break after a comma, but not between the last array element and the end brace. This leads to the "wrong indentation" error.
            >
            > /Jakob
            >
            >
            > Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af abyssoft@...
            > Sendt: 22. november 2010 00:20
            > Til: jslint_com@yahoogroups.com
            > Emne: [jslint] problems with Nesting
            >
            >
            > given the following snippet where » are tabs (4 space) and ---------- are begin and end markers. (the blank line after the start marker is intentional)
            >
            > ----------
            >
            > "use strict";
            > //Library (Netsuite Objects)
            > /*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn, NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup, NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord, NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter, NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
            > */
            > //Library (Netsuite API)
            > /*global nlapiSearchRecord
            > */
            > //Library (IS_library_V2_00)
            > /*global Global
            > */
            > var searchResults = nlapiSearchRecord(
            > »'customrecord_is_module_codes',
            > »null,
            > »[
            > »»new NlobjSearchFilter(
            > »»»'internalid',
            > »»»null,
            > »»»"noneof",
            > »»»[
            > »»»»29,
            > »»»»31,
            > »»»»32,
            > »»»»33
            > »»»]
            > »»)
            > »]
            > );
            > ----------
            >
            > JSLint responds with a rather unexpected error
            >
            > Problem at line 27 character 5: Expected ']' to have an indentation at 9 instead at 5.


            Thanks. Please try it now.

            In the future, please try to refine the problem text in bug reports. It is greatly appreciated if you try to make the example that demonstrates the problem as small as possible.
          • abyssoft@ymail.com
            Works now. Thank you.
            Message 5 of 5 , Dec 21, 2010
            • 0 Attachment
              Works now.
              Thank you.


              --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
              >
              > --- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@> wrote:
              > >
              > > JSLint (with the strict whitespace option) does not support the way you write an array. Specifically it does support a line break after a comma, but not between the last array element and the end brace. This leads to the "wrong indentation" error.
              > >
              > > /Jakob
              > >
              > >
              > > Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af abyssoft@
              > > Sendt: 22. november 2010 00:20
              > > Til: jslint_com@yahoogroups.com
              > > Emne: [jslint] problems with Nesting
              > >
              > >
              > > given the following snippet where » are tabs (4 space) and ---------- are begin and end markers. (the blank line after the start marker is intentional)
              > >
              > > ----------
              > >
              > > "use strict";
              > > //Library (Netsuite Objects)
              > > /*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn, NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup, NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord, NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter, NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
              > > */
              > > //Library (Netsuite API)
              > > /*global nlapiSearchRecord
              > > */
              > > //Library (IS_library_V2_00)
              > > /*global Global
              > > */
              > > var searchResults = nlapiSearchRecord(
              > > »'customrecord_is_module_codes',
              > > »null,
              > > »[
              > > »»new NlobjSearchFilter(
              > > »»»'internalid',
              > > »»»null,
              > > »»»"noneof",
              > > »»»[
              > > »»»»29,
              > > »»»»31,
              > > »»»»32,
              > > »»»»33
              > > »»»]
              > > »»)
              > > »]
              > > );
              > > ----------
              > >
              > > JSLint responds with a rather unexpected error
              > >
              > > Problem at line 27 character 5: Expected ']' to have an indentation at 9 instead at 5.
              >
              >
              > Thanks. Please try it now.
              >
              > In the future, please try to refine the problem text in bug reports. It is greatly appreciated if you try to make the example that demonstrates the problem as small as possible.
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.