jslint options specified in .js files

Hello, I m using intensively jslint for every .js I code now with everything strict to make code consistent. First, thanks for your work to make js code looks

Message 1 of 4
, Jun 9, 2011

0 Attachment

Hello,

I'm using intensively jslint for every .js I code now with everything
strict to make code consistent.
First, thanks for your work to make js code looks better!

I have a routine that launches jslint for every .js I have, I
intensively uses the specific js comment:
/*global ....*/ to indicate some globals to jslint

But is there a way to indicate, like another js comment, specific
options to JSLint ?

Here's my problem indeed: I'm using the same jslint options for all .js
(the most strict ones), including strict: true

BUT, in some js codes, I can't use strict mode, (for code example, see
below)

=> As a result, it would be perfect for me to add strict: false for
those .js (that overrides the options given to jslint)

Possible to do this ?

---- example where I can't "use strict" -----
dojo.declare("my.InlineEditBox", [dijit.InlineEditBox], {
edit: function () {
// 'caller', 'callee', and 'arguments' properties may not be
accessed
// on strict mode functions or the arguments objects for calls
to them
// Hence, we have to put this into comment...
//"use strict";

> I'm using intensively jslint for every .js I code now with everything
> strict to make code consistent.
> First, thanks for your work to make js code looks better!
>
> I have a routine that launches jslint for every .js I have, I
> intensively uses the specific js comment:
> /*global ....*/ to indicate some globals to jslint
>
> But is there a way to indicate, like another js comment, specific
> options to JSLint ?
>
> Here's my problem indeed: I'm using the same jslint options for all .js
> (the most strict ones), including strict: true
>
> BUT, in some js codes, I can't use strict mode, (for code example, see
> below)
>
> => As a result, it would be perfect for me to add strict: false for
> those .js (that overrides the options given to jslint)
>
> Possible to do this ?

Yes. The instructions describe a /*jslint*/ object. It can set the options, and it respects function scope.

Jérôme DESPATIS

Ok, it works great thanks, One more remark, as Firefox throws me: caller , callee , and arguments properties may not be accessed on strict mode functions

Message 3 of 4
, Jun 9, 2011

0 Attachment

Ok, it works great thanks,

One more remark, as Firefox throws me:
'caller', 'callee', and 'arguments' properties may not be accessed on
strict mode functions or the arguments objects for calls to them

=> Wouldn't be nice to not generate an error if "use strict" is not
present in a function that uses caller, caller or arguments ?

Because, in the following code, if 'use strict' is present, jslint is
happy but the code doesn't work.
And if not present, then jslint is not happy, but code works!

>
> --- In jslint_com@yahoogroups.com
> <mailto:jslint_com%40yahoogroups.com>, Jérôme DESPATIS <jerome@...> wrote:
> > I'm using intensively jslint for every .js I code now with everything
> > strict to make code consistent.
> > First, thanks for your work to make js code looks better!
> >
> > I have a routine that launches jslint for every .js I have, I
> > intensively uses the specific js comment:
> > /*global ....*/ to indicate some globals to jslint
> >
> > But is there a way to indicate, like another js comment, specific
> > options to JSLint ?
> >
> > Here's my problem indeed: I'm using the same jslint options for all .js
> > (the most strict ones), including strict: true
> >
> > BUT, in some js codes, I can't use strict mode, (for code example, see
> > below)
> >
> > => As a result, it would be perfect for me to add strict: false for
> > those .js (that overrides the options given to jslint)
> >
> > Possible to do this ?
>
> Yes. The instructions describe a /*jslint*/ object. It can set the
> options, and it respects function scope.
>
>

> One more remark, as Firefox throws me:
> 'caller', 'callee', and 'arguments' properties may not be accessed on
> strict mode functions or the arguments objects for calls to them
>
> => Wouldn't be nice to not generate an error if "use strict" is not
> present in a function that uses caller, caller or arguments ?
>
> Because, in the following code, if 'use strict' is present, jslint is
> happy but the code doesn't work.
> And if not present, then jslint is not happy, but code works!
>
> dojo.declare("my.InlineEditBox", [dijit.InlineEditBox], {
> edit: function () {
> //"use strict";
> this.previousValue = this.get("value");
> this.inherited(arguments);
> }
> });

I am sorry. I don't understand. What exactly is the problem?

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