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

Re: Option to ignore lines

Expand Messages
  • Stephen M. McKamey
    In this guy s defense, his code isn t necessarily defective, it appears to simply not follow your style guidelines. While most of the JSLint errors are
    Message 1 of 4 , Oct 27, 2008
      In this guy's defense, his code isn't necessarily defective, it
      appears to simply not follow your style guidelines. While most of the
      JSLint "errors" are valid issues, there are a few that are purely
      stylistic, yet they get the same weight as the others.

      Where I've experienced this most is when incorporating other library
      code which I don't (or often can't) maintain. For instance, the
      increasingly popular jQuery library doesn't pass JSLint.

      It would be nice if there was a distinction between the two types of
      issues, perhaps an error list and a warning list. The answer in the
      past to me has been "go ahead and modify it yourself" but this isn't
      realistic because I don't want to have to maintain yet another piece
      of software.

      It is a great product and we'd just like to be able to use it in more
      ways.

      --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...>
      wrote:
      >
      > --- In jslint_com@yahoogroups.com, "crlender" <crlender@> wrote:
      > >
      > > Hello.
      > >
      > > JSLint is a great tool, and we're using it a lot. Sometimes,
      though,
      > > we run across situations where we don't agree with JSLint's
      warnings
      > > or recommendations, and where there's no option to adjust its
      > > behavior. What we're looking for is something like
      > >
      > > // this is just an example
      > > var x = new Array(10); /*jslint:ignore*/
      > >
      > > In other words, a way to tell JSLint that "we've seen the warning,
      > > we know what we're doing, and take full responsibility".
      > >
      > > I haven't seen an option to do that, and I suspect that its
      absence
      > > is probably intentional. It might lead developers to ignore
      > > problematic parts in their code instead of fixing them.
      > >
      > > On the other hand, some of the lines that generate warnings are
      > > intentional, and won't be changed regardless of the JSLint report.
      > > Seeing the same warnings over and over again could lead people to
      > > ignore other warnings too, or just run the report through 'grep'
      to
      > > filter out certain types of warnings.
      > >
      > > Is there, or will there be, such an option in JSLint?
      > > If not, what's the rationale?
      >
      > I recommend that you fix your code instead of documenting that it is
      > intentionally defective.
      >
    • crlender
      ... Stephen is correct, I m not talking about defective code . I m talking about cases where my idea of good style clashes with your recommendations. Case in
      Message 2 of 4 , Oct 27, 2008
        --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...>
        wrote:
        > I recommend that you fix your code instead of documenting that it is
        > intentionally defective.

        Stephen is correct, I'm not talking about "defective code".
        I'm talking about cases where my idea of good style clashes with
        your recommendations. Case in point, just today I sent a message
        to this group about JSLint issuing warnings about perfectly legal
        and valid regular expressions (for example the character classes
        [^{}] and [#+-]). Your response was to escape the curly brackets
        and the minus sign anyway, even though it wasn't necessary or
        required. This has nothing to do with safe programming habits,
        it's a question of style (or habit) at best. In my opinion,
        unnecessary escaping is a Bad Idea; it reduces readability and
        can thus be a source of errors.

        I didn't expect you to like the idea of /*jslint:ignore*/, but I
        thought I'd ask here before I implemented it myself. We're using
        a wrapper for JSLint on the command line anyway (we're using
        SpiderMonkey instead of Rhino, and have added support for command
        line options and local configuration files), and an output filter
        will be trivial to add.


        - Conrad
      Your message has been successfully submitted and would be delivered to recipients shortly.