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

Feature request: disable warnings on a line-by-line basis

Expand Messages
  • bertbelder
    It would be cool if it were possible to surpress warnings/errors that originate form a certain line. For example, occasionaly I conciously use an unfiltered
    Message 1 of 4 , Mar 4, 2009
    • 0 Attachment
      It would be cool if it were possible to surpress warnings/errors that originate form a certain line.

      For example, occasionaly I conciously use an unfiltered for...in loop or switch(true) construct, but I'd rather not disable messages about these types of errors globally (which isn't even possible for the latter). When you're working on large scripts serious warnings tend to be surrounded by 'errors' that you know are there for a reason, which makes them hard to spot.

      So maybe there should be an option like /*jslint surpress*/ that surpresses any errors on the next line, like:

      var o = {test: 4};
      /*jslint surpress*/
      for (k in o) {
      alert(k);
      }

      PS: I'm truly sorry about the bogus message with the same topic I sent before.
    • Noah Peters
      Try this: var o = {test: 4}; /*jslint forin: false*/ for (k in o) { alert(k); } /*jslint forin: true*/ ... -- We know the hard things are possible, we just
      Message 2 of 4 , Mar 4, 2009
      • 0 Attachment
        Try this:
        var o = {test: 4};
        /*jslint forin: false*/
        for (k in o) {
        alert(k);
        }
        /*jslint forin: true*/

        On Wed, Mar 4, 2009 at 4:11 PM, bertbelder <bertbelder@...> wrote:

        > It would be cool if it were possible to surpress warnings/errors that
        > originate form a certain line.
        >
        > For example, occasionaly I conciously use an unfiltered for...in loop or
        > switch(true) construct, but I'd rather not disable messages about these
        > types of errors globally (which isn't even possible for the latter). When
        > you're working on large scripts serious warnings tend to be surrounded by
        > 'errors' that you know are there for a reason, which makes them hard to
        > spot.
        >
        > So maybe there should be an option like /*jslint surpress*/ that surpresses
        > any errors on the next line, like:
        >
        > var o = {test: 4};
        > /*jslint surpress*/
        > for (k in o) {
        > alert(k);
        > }
        >
        > PS: I'm truly sorry about the bogus message with the same topic I sent
        > before.
        >
        >
        >



        --
        We know the hard things are possible, we just have to make the easy things
        easy. -Norman Walsh


        [Non-text portions of this message have been removed]
      • bertbelder
        Thank s, I didn t realize that it was possible to set jslint options for a part of the file. However, there are still warnings I d like to suprpress sometimes
        Message 3 of 4 , Mar 12, 2009
        • 0 Attachment
          Thank's, I didn't realize that it was possible to set jslint options for a part of the file. However, there are still warnings I'd like to suprpress sometimes for which no such option exists. So what do you think about the proposed ignore-line feature?

          --- In jslint_com@yahoogroups.com, Noah Peters <boyopeg@...> wrote:
          >
          > Try this:
          > var o = {test: 4};
          > /*jslint forin: false*/
          > for (k in o) {
          > alert(k);
          > }
          > /*jslint forin: true*/
          >
          > On Wed, Mar 4, 2009 at 4:11 PM, bertbelder <bertbelder@...> wrote:
          >
          > > It would be cool if it were possible to surpress warnings/errors that
          > > originate form a certain line.
          > >
          > > For example, occasionaly I conciously use an unfiltered for...in loop or
          > > switch(true) construct, but I'd rather not disable messages about these
          > > types of errors globally (which isn't even possible for the latter). When
          > > you're working on large scripts serious warnings tend to be surrounded by
          > > 'errors' that you know are there for a reason, which makes them hard to
          > > spot.
          > >
          > > So maybe there should be an option like /*jslint surpress*/ that surpresses
          > > any errors on the next line, like:
          > >
          > > var o = {test: 4};
          > > /*jslint surpress*/
          > > for (k in o) {
          > > alert(k);
          > > }
          > >
          > > PS: I'm truly sorry about the bogus message with the same topic I sent
          > > before.
          > >
          > >
          > >
          >
          >
          >
          > --
          > We know the hard things are possible, we just have to make the easy things
          > easy. -Norman Walsh
          >
          >
          > [Non-text portions of this message have been removed]
          >
        • Douglas Crockford
          ... I think it is better to fix your code than to document that it is intentionally faulty.
          Message 4 of 4 , Mar 13, 2009
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "bertbelder" <bertbelder@...> wrote:
            >
            > However, there are still warnings I'd like to suprpress sometimes
            > for which no such option exists. So what do you think about the
            > proposed ignore-line feature?

            I think it is better to fix your code than to document that it is intentionally faulty.
          Your message has been successfully submitted and would be delivered to recipients shortly.