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

Re: nomen: true respects function scope?

Expand Messages
  • Douglas Crockford
    ... JSLint does not recognize a /*nomen*/ directive, so it see that as a comment. You probably meant /*jslint nomen: true*/ JSLint could have issued a warning
    Message 1 of 3 , Jun 9, 2011
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "spence.randall@..." <randall@...> wrote:
      >
      > I have a small file that deals with Google Analytics, which requires you to use _gaq as the global variable. I want to wrap this in a function so I can declare nomen: true for this section of the file only, but JSLint does not appear to recognize this directive in the function scope, it only suppresses errors when it is applied globally.
      >
      > /*jslint browser: true*/
      > (function () {
      > /*nomen: true*/
      > 'use strict';
      > window._gaq = window._gaq || [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
      > }());

      JSLint does not recognize a /*nomen*/ directive, so it see that as a comment. You probably meant /*jslint nomen: true*/

      JSLint could have issued a warning on an unrecognized directive, but that might also cause it to warning on comments that do not contain a strategic space.
    • spence.randall@ymail.com
      Ah, how silly of me. I guess I was typing to fast and missed the jslint directive. Thanks. Randall
      Message 2 of 3 , Jun 9, 2011
      • 0 Attachment
        Ah, how silly of me. I guess I was typing to fast and missed the jslint directive. Thanks.

        Randall

        --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
        >
        > --- In jslint_com@yahoogroups.com, "spence.randall@" <randall@> wrote:
        > >
        > > I have a small file that deals with Google Analytics, which requires you to use _gaq as the global variable. I want to wrap this in a function so I can declare nomen: true for this section of the file only, but JSLint does not appear to recognize this directive in the function scope, it only suppresses errors when it is applied globally.
        > >
        > > /*jslint browser: true*/
        > > (function () {
        > > /*nomen: true*/
        > > 'use strict';
        > > window._gaq = window._gaq || [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
        > > }());
        >
        > JSLint does not recognize a /*nomen*/ directive, so it see that as a comment. You probably meant /*jslint nomen: true*/
        >
        > JSLint could have issued a warning on an unrecognized directive, but that might also cause it to warning on comments that do not contain a strategic space.
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.