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

I can't appease JSLint on whitespace in a “var” statement

Expand Messages
  • Zhami
    All of my code, which used to run 100% clean with JSLint, now reports errors with every var statement, and I can t figure out how to fix. Consider this
    Message 1 of 4 , Jan 21, 2011
    • 0 Attachment
      All of my code, which used to run 100% clean with JSLint, now reports errors with every var statement, and I can't figure out how to fix.

      Consider this (hollowed out) example/snippert:

      var dateStrFromTimestamp;
      dateStrFromTimestamp = function (t) {
      "use strict";
      var a, d;
      d = new Date(t * 1000);
      a = [];
      };

      JSLint reports:

      ~~~~~
      Problem at line 1 character 5: Expected 'dateStrFromTimestamp' at column 3, not column 5.

      var dateStrFromTimestamp;

      Problem at line 4 character 7: Expected 'a' at column 5, not column 7.

      var a, d;
      ~~~~~

      How am I supposed to write my code? If I follow the recommendation, I'd have to remove the whitespace after the keyword "var" -- but that can't be. So, is the current version of JSLint buggy? Or am I currently blind to something obvious?
    • Jim Auldridge
      I had the same problem yesterday, even in extremely simplistic test code I was using to see how lint reacted. ... -- Jim Auldridge 11012 Lincoln Ave Hagerstown
      Message 2 of 4 , Jan 21, 2011
      • 0 Attachment
        I had the same problem yesterday, even in extremely simplistic test code I
        was using to see how lint reacted.

        On Fri, Jan 21, 2011 at 8:36 AM, Zhami <stuart@...> wrote:

        >
        >
        > All of my code, which used to run 100% clean with JSLint, now reports
        > errors with every var statement, and I can't figure out how to fix.
        >
        > Consider this (hollowed out) example/snippert:
        >
        > var dateStrFromTimestamp;
        > dateStrFromTimestamp = function (t) {
        > "use strict";
        > var a, d;
        > d = new Date(t * 1000);
        > a = [];
        > };
        >
        > JSLint reports:
        >
        > ~~~~~
        > Problem at line 1 character 5: Expected 'dateStrFromTimestamp' at column 3,
        > not column 5.
        >
        > var dateStrFromTimestamp;
        >
        > Problem at line 4 character 7: Expected 'a' at column 5, not column 7.
        >
        > var a, d;
        > ~~~~~
        >
        > How am I supposed to write my code? If I follow the recommendation, I'd
        > have to remove the whitespace after the keyword "var" -- but that can't be.
        > So, is the current version of JSLint buggy? Or am I currently blind to
        > something obvious?
        >
        >
        >



        --
        Jim Auldridge
        11012 Lincoln Ave
        Hagerstown MD 21740
        240.520.0240 (m)
        auldridgej@...
        http://jaaulde.com


        [Non-text portions of this message have been removed]
      • Douglas Crockford
        ... Thanks. Please try it now.
        Message 3 of 4 , Jan 21, 2011
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Zhami" <stuart@...> wrote:
          >
          > All of my code, which used to run 100% clean with JSLint, now reports errors with every var statement, and I can't figure out how to fix.
          >
          > Consider this (hollowed out) example/snippert:
          >
          > var dateStrFromTimestamp;
          > dateStrFromTimestamp = function (t) {
          > "use strict";
          > var a, d;
          > d = new Date(t * 1000);
          > a = [];
          > };
          >

          Thanks. Please try it now.
        • Zhami
          Thanks for addressing this so quickly!
          Message 4 of 4 , Jan 21, 2011
          • 0 Attachment
            Thanks for addressing this so quickly!

            --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
            >
            > --- In jslint_com@yahoogroups.com, "Zhami" <stuart@> wrote:
            > >
            > > All of my code, which used to run 100% clean with JSLint, now reports errors with every var statement, and I can't figure out how to fix.
            > >
            > > Consider this (hollowed out) example/snippert:
            > >
            > > var dateStrFromTimestamp;
            > > dateStrFromTimestamp = function (t) {
            > > "use strict";
            > > var a, d;
            > > d = new Date(t * 1000);
            > > a = [];
            > > };
            > >
            >
            > Thanks. Please try it now.
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.