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

Possible Bug/Misfeature? Whitespace error where comment exists but no spaces

Expand Messages
  • saj14saj
    This code { ... onRowClick: function onRowClick(/*integer*/index, /*tuple*/value) { }, ... } produces the error Problem at line 33 character 48: Unexpected
    Message 1 of 4 , Feb 2, 2011
    View Source
    • 0 Attachment
      This code

      {
      ...

      onRowClick: function onRowClick(/*integer*/index, /*tuple*/value) {
      },


      ...
      }

      produces the error

      Problem at line 33 character 48: Unexpected space between '(' and 'index'.

      onRowClick: function onRowClick(/*integer*/index, /*tuple*/value) {



      . . .

      I believe comments of this type, intending to indicate the expected type of the parameter should be encouraged.

      For readability, before I tried to make it JSLINT compliant, I had it written

      ... function onRowClick(/* integer */ index, ....

      where there were extra spaces.


      BTW, the name on the formerly anonymous function is an attempt, based on something I read in JavaScript Patterns from O'Reilly last night to give Firebug/IE Developer Tools better debug information by naming the functions.
    • Douglas Crockford
      ... Turn off the strict whitespace option.
      Message 2 of 4 , Feb 2, 2011
      View Source
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "saj14saj" <saj14saj@...> wrote:
        >
        > This code
        >
        > {
        > ...
        >
        > onRowClick: function onRowClick(/*integer*/index, /*tuple*/value) {
        > },
        >
        >
        > ...
        > }
        >
        > produces the error
        >
        > Problem at line 33 character 48: Unexpected space between '(' and 'index'.
        >
        > onRowClick: function onRowClick(/*integer*/index, /*tuple*/value) {
        >
        >
        >
        > . . .
        >



        Turn off the strict whitespace option.
      • saj14saj
        ... It is not on. JSLINT is giving the error with these settings reported /*jslint browser: true, sub: true, eqeqeq: true, windows: true, devel: true, undef:
        Message 3 of 4 , Feb 2, 2011
        View Source
        • 0 Attachment
          > Turn off the strict whitespace option.
          >

          It is not on. JSLINT is giving the error with these settings reported

          /*jslint browser: true, sub: true, eqeqeq: true, windows: true, devel: true, undef: true, maxerr: 50, indent: 4 */

          I specifically removed the comment from my source so there would be no overriding the UI from the web page.
        • abyssoft@ymail.com
          ... try using indent: 0
          Message 4 of 4 , Feb 4, 2011
          View Source
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "saj14saj" <saj14saj@...> wrote:
            >
            > > Turn off the strict whitespace option.
            > >
            >
            > It is not on. JSLINT is giving the error with these settings reported
            >
            > /*jslint browser: true, sub: true, eqeqeq: true, windows: true, devel: true, undef: true, maxerr: 50, indent: 4 */
            >
            > I specifically removed the comment from my source so there would be no overriding the UI from the web page.
            >
            try using

            indent: 0
          Your message has been successfully submitted and would be delivered to recipients shortly.