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

option.closure

Expand Messages
  • douglascrockford
    I am experimenting with a new option that will tolerate Google Closure declarations. Please let me know if you see problems or omissions.
    Message 1 of 4 , Mar 27, 2013
    • 0 Attachment
      I am experimenting with a new option that will tolerate Google Closure declarations. Please let me know if you see problems or omissions.
    • Jos van den Oever
      ... I have tried on jslint.com with this fragment: === /*jslint closure: true, white: true */ function cast(arg) { use strict ; return
      Message 2 of 4 , Mar 28, 2013
      • 0 Attachment
        On 03/27/2013 10:20 PM, douglascrockford wrote:
        > I am experimenting with a new option that will tolerate Google Closure
        > declarations. Please let me know if you see problems or omissions.

        I have tried on jslint.com with this fragment:
        ===
        /*jslint closure: true, white: true */
        function cast(arg) {
        "use strict";
        return /**@type{{length:number}}*/(arg);
        }
        ===
        which gives the error:
        Unexpected '('.

        The file webjslint.js says the version is 2013-03-26.

        Best regards,
        Jos
      • douglascrockford
        ... Thanks. Please try it now. https://developers.google.com/closure/compiler/docs/js-for-compiler does not indicate that the parens are required. Why are they
        Message 3 of 4 , Mar 28, 2013
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, Jos van den Oever <jos.van.den.oever@...> wrote:
          >
          > On 03/27/2013 10:20 PM, douglascrockford wrote:
          > > I am experimenting with a new option that will tolerate Google Closure
          > > declarations. Please let me know if you see problems or omissions.
          >
          > I have tried on jslint.com with this fragment:
          > ===
          > /*jslint closure: true, white: true */
          > function cast(arg) {
          > "use strict";
          > return /**@type{{length:number}}*/(arg);
          > }
          > ===
          > which gives the error:
          > Unexpected '('.


          Thanks. Please try it now.

          https://developers.google.com/closure/compiler/docs/js-for-compiler does not indicate that the parens are required. Why are they necessary?
        • Jos van den Oever
          ... The parentheses are required to limit the scope of the type cast. The use of @type for casting is not documented on that page, but there is information on
          Message 4 of 4 , Mar 28, 2013
          • 0 Attachment
            On 03/28/2013 01:42 PM, douglascrockford wrote:
            > --- In jslint_com@yahoogroups.com <mailto:jslint_com%40yahoogroups.com>,
            > Jos van den Oever <jos.van.den.oever@...> wrote:
            > >
            > > On 03/27/2013 10:20 PM, douglascrockford wrote:
            > > > I am experimenting with a new option that will tolerate Google Closure
            > > > declarations. Please let me know if you see problems or omissions.
            > >
            > > I have tried on jslint.com with this fragment:
            > > ===
            > > /*jslint closure: true, white: true */
            > > function cast(arg) {
            > > "use strict";
            > > return /**@type{{length:number}}*/(arg);
            > > }
            > > ===
            > > which gives the error:
            > > Unexpected '('.
            >
            > Thanks. Please try it now.
            >
            > https://developers.google.com/closure/compiler/docs/js-for-compiler does
            > not indicate that the parens are required. Why are they necessary?

            The parentheses are required to limit the scope of the type cast. The
            use of @type for casting is not documented on that page, but there is
            information on that use on the wiki:
            http://code.google.com/p/closure-compiler/wiki/AnnotatingTypes

            The example on the page embedded in function work on jslint.com now are
            found to be valid:

            function cast(fruit) {
            "use strict";
            var x = /** @type {string} */ (fruit);
            return x;
            }

            I've imported the new jslint.js into our quality assurence and ran it
            with 'closure: true'. Now all file pass without error. The only
            unrelated change required in some places is to change
            (test) ? 1 : 0;
            to
            test ? 1 : 0;

            Thanks you very much!
            Jos
          Your message has been successfully submitted and would be delivered to recipients shortly.