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

Re: [jslint] Some parser problems

Expand Messages
  • Cheney, Edward A SSG RES USAR USARC
    ... You are still performing assignment in a condition and not evaluation. At the same time never use redundant assignment, such as x = y = 1, because that is
    Message 1 of 7 , May 11, 2010
    View Source
    • 0 Attachment
      > if ((x = (y = 1))) {
      > // do stuff
      > }

      You are still performing assignment in a condition and not evaluation. At the same time never use redundant assignment, such as x = y = 1, because that is extremely unpredictable with regard to closure.

      In your original example variable "b" is an implied global, BECAUSE it is used before it is declared.

      > I know I can fix issues 1 and 2, but my question was why the
      > parser stops when it should continue with a warning.

      I am sure when Douglas built the tool one of the problems he may have encountered were patterns of faulty input that potentially choke the logical evaluation of the tool. If that is the case it makes more sense to return prematurely than to double the size of the tool to compensate for bad practices or faulty input.

      Austin
    • Rob Richardson
      Is there a good rule-of-thumb for what type of errors stop JSLint immediately and what type of errors accumulate? Rob ________________________________ From:
      Message 2 of 7 , May 11, 2010
      View Source
      • 0 Attachment
        Is there a good rule-of-thumb for what type of errors stop JSLint immediately and what type of errors accumulate?

        Rob

        ________________________________
        From: Douglas Crockford <douglas@...>
        To: jslint_com@yahoogroups.com
        Sent: Tue, May 11, 2010 6:26:12 AM
        Subject: [jslint] Re: Some parser problems


        --- In jslint_com@yahoogro ups.com, "avegaart" <avegaart@.. .> wrote:
        >
        > I just ran the ExtJS javascript library through JSLint again and I am pleasantly surprised by the progress that JSLint has made in the past few months.
        > The parser is able to scan almost all of the code and there are only 2 constructs that stop JSLint from parsing the entire library.
        >
        ...

        1. Fix your code, then it won't stop.
        2. Fix your code, then it won't stop.
        3. b was used before it was declared. This can confuse a reader, who will likely read b as being a global variable.
        4. self and window are commonly abused. You have to declare those yourself. escape and unescape have been deprecated. Do not use them.
      • Cheney, Edward A SSG RES USAR USARC
        Rob, Evaluation of the code, JSLint function, will tell you exactly that. It is not likely that there are static definitions that point certain errors to
        Message 3 of 7 , May 11, 2010
        View Source
        • 0 Attachment
          Rob,

          Evaluation of the code, JSLint function, will tell you exactly that. It is not likely that there are static definitions that point certain errors to cumulative output versus others that prematurely return. Instead the premature termination is likely due to various patterns of input that may result from interactions of various errors. The code that produces such errors is sure to let you know.

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