I added an Assume console, alert, ... (devel) option. It predefines globals that
are useful in browser development that should be avoided in production. It is
equivalent to
/*global alert: false, confirm: false, console: false, Debug: false, opera:
false, prompt: false */
What about alert() ?
2009/11/16 sks0001010 <simon.shepard@...>:
>
>
> Hmmm, not that I can think of off the top of my head, those 3 are the only
ones that get reused repeatedly for JS debugging in the different browsers.
>
> In another topic, I've been trying to use JSLint to validate HTML fragments,
but the templating system being used relies on having files with backend blocks
in it like <% print(someValue); %>
> it would be awesome, if there was a switch for tags with different starting
and ending delimeters that could be filtered out of the validation process, but
I don't know whether this becomes a bit out of the scope of the software ;-)
>
>
>
>
> --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
>>
>> --- In jslint_com@yahoogroups.com, Simon Kenyon Shepard wrote:
>> > I was wondering whether there are any plans to bring in the option to
>> > be able to flag console.log statements in JSLint.
>>
>> That is a great suggestion. Perhaps there could be an option that determines
whether console, Debug, and Opera are predefined. You would turn it on for
development, and off for deployment.
>>
>> Are there other useful development time globals?
>>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
--
Toby Maxwell-Lyte
07816 836300
01443 449003
Hmmm, not that I can think of off the top of my head, those 3 are the only ones
that get reused repeatedly for JS debugging in the different browsers.
In another topic, I've been trying to use JSLint to validate HTML fragments, but
the templating system being used relies on having files with backend blocks in
it like <% print(someValue); %>
it would be awesome, if there was a switch for tags with different starting and
ending delimeters that could be filtered out of the validation process, but I
don't know whether this becomes a bit out of the scope of the software ;-)
--- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
>
> --- In jslint_com@yahoogroups.com, Simon Kenyon Shepard wrote:
> > I was wondering whether there are any plans to bring in the option to
> > be able to flag console.log statements in JSLint.
>
> That is a great suggestion. Perhaps there could be an option that determines
whether console, Debug, and Opera are predefined. You would turn it on for
development, and off for deployment.
>
> Are there other useful development time globals?
>
--- In jslint_com@yahoogroups.com, Simon Kenyon Shepard wrote:
> I was wondering whether there are any plans to bring in the option to
> be able to flag console.log statements in JSLint.
That is a great suggestion. Perhaps there could be an option that determines
whether console, Debug, and Opera are predefined. You would turn it on for
development, and off for deployment.
Are there other useful development time globals?
Hi,
apologies if this has already been covered.
I was wondering whether there are any plans to bring in the option to
be able to flag console.log statements in JSLint.
I often find console.log's in javascript where someone has been using
them for debugging in firebug but then it breaks in IE (or firefox
without firebug) but have failed to remove them for production code.
Ideally I would like to fold this into my CI checks with JSLint, I was
hoping someone might be able to point me in the right direction...
Cheers
Simon
> Changelog 1.0.0.4
> -Clicking "OK" in the JSLint configuration window closes the window
> -JSLint is now available from the "Site Reports"
> -Multiple file selection via "Site Reports"
> -DWlint now uses the "Site Reports" tab on the "Result" pane of
> dreamweaver to show results.
> -Double-clicking the error/warning in the results pane will scroll to
> the offending line of code.
These are great updates. It is much more streamlined now. I don't miss the
control character much. It might be better if a jslint ICON could be place on
the COMMON toolbar.
The Results pane is the right place. It is much more convenient there and the
double-click to find the line of code is great.
One thing I'd like to see in DW is a JavaScript formatter. Even a good external
formatter for JS would be a help if you have any recommendation.
Thanks for this fine product. You might want to post it in some other DW
forums.
Sam
Sam i tried to address some of your suggestions.
Could not find how to do a keyboard shortcut yet, so that remains on the
wishlist for now.
Changelog 1.0.0.4
-Clicking "OK" in the JSLint configuration window closes the window
-JSLint is now available from the "Site Reports"
-Multiple file selection via "Site Reports"
-DWlint now uses the "Site Reports" tab on the "Result" pane of
dreamweaver to show results.
-Double-clicking the error/warning in the results pane will scroll to
the offending line of code.
Download version 1.0.0.4 from http://dwlint.abisvmm.nl
<http://dwlint.abisvmm.nl/>
--- In jslint_com@yahoogroups.com <mailto:jslint_com@yahoogroups.com> ,
"samckayak" <samc@...> wrote:
>
> This extension has so improved my jslint/JavaScript workflow.
>
> Some suggestions:
>
> 1 - Single key (CTRL-J maybe?) to launch the validator.
>
> 2 - Launching the results pane should close the jslint control pane
automatically.
>
> 3 - Double-clicking the error/warning in the results pane should
scroll-to and highlight the offending line of code.
>
> 4 - Once Edits are made, how about a refresh button on the results
pane? That would save a few steps.
>
> 5 - A Resizable results pane would let it fit nicely on the side or
bottom so the code edit window isn't covered.
>
> So... when will all this be done ;-)
>
> Sam
>
[Non-text portions of this message have been removed]
Hi all! I'd like to let you know that I've released a new version of my
jslint wrapper, jslint4java. The new features are:
* Upgrade to JSLint 2009-10-04.
* Add an ability to use an external copy of jslint.js, rather than the
bundled one.
As usual, it's available from:
http://code.google.com/p/jslint4java/
Thanks,
-Dom
[Non-text portions of this message have been removed]
>
> Turn on the "Disallow undefined variables" option.
>
I will, and thank you.
Isn't it a jslint anomaly that "of" was not flagged as a global variable by
jslint? I found that renaming "of" to "ox" resulted in a proper declaration of
"ox" as a global.
--- In jslint_com@yahoogroups.com, "samckayak" <samc@...> wrote:
>
> I'm working on a bookmarklet for ie6 which I hope explains the lack of
comments, short variables, and single-lined nature of the function.
>
> jslint seems to miss the global variable "of" in this function. The semicolon
preceeding "of" should be replaced with a comma. The variable "of" is not
reported as local or global. Is "of" a keyword conflict?
>
> function(){var
o=document.body.style,oz=(o.zoom===''?'1':o.zoom);of=parseFloat(oz,10);o.zoom=(o\
f>3)?'1.':of*1.33;}
Turn on the "Disallow undefined variables" option.
I'm working on a bookmarklet for ie6 which I hope explains the lack of comments,
short variables, and single-lined nature of the function.
jslint seems to miss the global variable "of" in this function. The semicolon
preceeding "of" should be replaced with a comma. The variable "of" is not
reported as local or global. Is "of" a keyword conflict?
function(){var
o=document.body.style,oz=(o.zoom===''?'1':o.zoom);of=parseFloat(oz,10);o.zoom=(o\
f>3)?'1.':of*1.33;}
--- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
>
> --- In jslint_com@yahoogroups.com, "Brook" <mrprogguy@> wrote:
> > Given
> >
> > var b = javaApplet.Connect("javascript:OnConnect()");
> >
> > as the target of investigation, I inevitably see the "Script URL" complaint
from JSLint. Since the method in question is by nature asynchronous, and the
interior Java cannot directly call script methods, this is the only method
available. It would be nice to be able to suppress this since the warning is
visual static in the response.
>
>
>
> I don't recommend the use of javascript:urls in any context.
>
I don't think that's really in question. The problem is that there aren't any
other mechanisms available for use. One would hope that JSLint would be
adaptable to practical needs as well as ideals.
--- In jslint_com@yahoogroups.com, "Brook" <mrprogguy@...> wrote:
> Given
>
> var b = javaApplet.Connect("javascript:OnConnect()");
>
> as the target of investigation, I inevitably see the "Script URL" complaint
from JSLint. Since the method in question is by nature asynchronous, and the
interior Java cannot directly call script methods, this is the only method
available. It would be nice to be able to suppress this since the warning is
visual static in the response.
I don't recommend the use of javascript:urls in any context.
Given
var b = javaApplet.Connect("javascript:OnConnect()");
as the target of investigation, I inevitably see the "Script URL" complaint from
JSLint. Since the method in question is by nature asynchronous, and the
interior Java cannot directly call script methods, this is the only method
available. It would be nice to be able to suppress this since the warning is
visual static in the response.
That's a good question. The only warning JSLint gives is that aa is global.
JSLint is more forgiving of global mishaps, assuming that if you are doing
things globally, then you aren't concerned with correctness. I will look at this
again. Thanks.
woomla wrote:
> This code jslint fine, but the second aa function is not accessible.
> Can't jslint give a warning for this?
>
>
> "use strict";
>
>
> var NN = '';
>
> function aa(name)
> {
> NN = name;
> }
>
> function aa(boolean)
> {
> NN = boolean ? 'true' : 'false';
> }
>
> aa('yes');
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>
This code jslint fine, but the second aa function is not accessible.
Can't jslint give a warning for this?
"use strict";
var NN = '';
function aa(name)
{
NN = name;
}
function aa(boolean)
{
NN = boolean ? 'true' : 'false';
}
aa('yes');
Hi,
I use JSLint with Rhino. And as the goodparts sometimes change, I wrote a short
rubyscript to update the options-string. Is there another way to get the most
recent goodparts?
(click on "Show Message Option" on the right, to change the font to monospace)
The script:
#!/usr/bin/env ruby
require "net/http"
r = []
Net::HTTP.get("www.jslint.com", "/").
scan(/<input[^>]*id="JSLINT_[^>]*>/i).
each do |option|
if /title=/i === option
#option with boolean
r.push([option.gsub(/<[^>]*title="(\w*)".*/, '\1'),
(/name=goodpart/ === option).to_s].join(":"))
elsif /value="\d+"/ === option
#option with number
r.push(option.gsub(/<[^>]*JSLINT_(\w*)[^>]*value="(\d*)"[^>]*>/,
'\1:\2'))
end
end
p "/*jslint " + r.join(", ").downcase + " */"
#creates this:
#/*jslint passfail:false, white:true, onevar:true, browser:false, widget:false,
sidebar:false, rhino:false, safe:false, adsafe:false, debug:false, evil:false,
laxbreak:false, forin:false, sub:false, css:false, cap:false, on:false,
fragment:false, undef:true, nomen:true, eqeqeq:true, plusplus:true,
bitwise:true, regexp:true, strict:true, newcap:true, immed:true, indent:4,
maxerr:50 */
Hi Sam,
Hahaha,
Well you gave it some thought i see.
I've no idea if it's all possible but after my holiday i will look in to it.
Thanks for the suggestions.
--- In jslint_com@yahoogroups.com, "samckayak" <samc@...> wrote:
>
> This extension has so improved my jslint/JavaScript workflow.
>
> Some suggestions:
>
> 1 - Single key (CTRL-J maybe?) to launch the validator.
>
> 2 - Launching the results pane should close the jslint control pane
automatically.
>
> 3 - Double-clicking the error/warning in the results pane should scroll-to and
highlight the offending line of code.
>
> 4 - Once Edits are made, how about a refresh button on the results pane? That
would save a few steps.
>
> 5 - A Resizable results pane would let it fit nicely on the side or bottom so
the code edit window isn't covered.
>
> So... when will all this be done ;-)
>
> Sam
>
Hello,
I am trying to integrate JSLint with our build and hence my preferred choice is
Rhino engine for JSLint. However I havn't had much of luck in getting success
result with rhino/jslint yet!
So, here's my problem. Our javascript code are based on ExtJS framework and
hence most of the code file start with Ext.namespace statement. For example, One
of our file has
Ext.namespace( "TEST" );
When I copy this statment and run in "http://www.jslint.com/" with options as
"/*jslint onevar: true, browser: true, rhino: true, debug: true, evil: true,
sub: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, immed:
true */" and predefined object "Ext", it passess successfully. I do not get any
errors.
However when I pass the same file to jslint using Rhino (as specified in
http://www.jslint.com/rhino/index.html ), it throws me the error
Lint at line 1 character 1: Cannot read property "id" from undefined
The options in jslint.js are same as what I define in web version.
I do not understand why the output differs in web based and rhino based version?
Can anyone suggest something? Am I missing anything here?
-Kunal
This extension has so improved my jslint/JavaScript workflow.
Some suggestions:
1 - Single key (CTRL-J maybe?) to launch the validator.
2 - Launching the results pane should close the jslint control pane
automatically.
3 - Double-clicking the error/warning in the results pane should scroll-to and
highlight the offending line of code.
4 - Once Edits are made, how about a refresh button on the results pane? That
would save a few steps.
5 - A Resizable results pane would let it fit nicely on the side or bottom so
the code edit window isn't covered.
So... when will all this be done ;-)
Sam
At 10/27/2009 06:56 PM, robert.luxemburg wrote:
>var ss = " ///// "(" \/ ");
>var s = /\s/("/ /"); // " "
May I ask why, if you're supplying the string as a hard-coded
literal, are you testing it with a regular expression? Don't you as
the scripter already know its value?
I realize that the question "Why would you ever do such a thing?" is
very different from "Is it legal syntax?" But it is a mystery to my
why someone would call up the RegExp engine just to find out whether
a known quoted string contains certain patterns. Is it because the
string is supplied by a server-side script and not by a human hand?
Or because you simply enjoy using regular expressions, or exploring
unusual syntax in your scripts?
Curiously,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
JSLint helps to use a proper subset of Javascript. Javascript has a lot of
issues which JSLint tries to fix, by proposing just to use a subset of the
language without loosing any of its functionality.
So some things are banned: some because they don't work as expected, e.g. the
with-statement, some because they have performance penalty, e.g. passing a
string instead of a function to setTimeout.
/\s/("/ /") doesn't add functionality to the language, just another syntax, and
its a not very well documented one.
Actually no one said that: "please do everyone a favor and just forget about it"
But ask yourself: Does this syntax make your code more clear? Or less?
And if less: Does it add functionality beyond better documented and wider
understood alternatives?
--- In jslint_com@yahoogroups.com, "robert.luxemburg" <robert.luxemburg@...>
wrote:
>
> I was playing around with JSLint lately, and entered the following:
>
> var ss = " ///// "(" \/ ");
>
> JSLint returned: "Problem at line 1 character 10: Bad invocation",
> and Firebug threw a TypeError, since strings are not callable.
>
> So I shuffled these very same characters a bit, until I got:
>
> var s = /\s/("/ /"); // " "
>
> and JSLint claimed: "Problem at line 1 character 9: Bad invocation",
> even though the above is, if not valid JS, implemented in Firefox,
> Safari, Chrome and Opera, as syntactic sugar for /\s/.exec("/ /").
>
> See here for a lengthy discussion:
> https://bugs.webkit.org/show_bug.cgi?id=28117
>
> It's definitely an obscure corner case, but shouldn't this be fixed
> in JSLint? Or added to the corresponding JS Style Guide? "Don't
> think you can call a RegExp, and if you find out that you actually
> can, please do everyone a favor and just forget about it..." ?
>
I was playing around with JSLint lately, and entered the following:
var ss = " ///// "(" \/ ");
JSLint returned: "Problem at line 1 character 10: Bad invocation",
and Firebug threw a TypeError, since strings are not callable.
So I shuffled these very same characters a bit, until I got:
var s = /\s/("/ /"); // " "
and JSLint claimed: "Problem at line 1 character 9: Bad invocation",
even though the above is, if not valid JS, implemented in Firefox,
Safari, Chrome and Opera, as syntactic sugar for /\s/.exec("/ /").
See here for a lengthy discussion:
https://bugs.webkit.org/show_bug.cgi?id=28117
It's definitely an obscure corner case, but shouldn't this be fixed
in JSLint? Or added to the corresponding JS Style Guide? "Don't
think you can call a RegExp, and if you find out that you actually
can, please do everyone a favor and just forget about it..." ?
Reporting a bug or missing feature is not complaining.
It's more like helping to make the software better and more useable.
--- In jslint_com@yahoogroups.com, "samckayak" <samc@...> wrote:
>
> > I've fixed the problem by calling a dreamweaver dom function called
"synchronizeDocument" before getting the source.
> > This looks like it fixes my problem.
>
> Thanks. I also noted this problem but I was so grateful for the product I
didn't want to complain about it!
>
> I've fixed the problem by calling a dreamweaver dom function called
"synchronizeDocument" before getting the source.
> This looks like it fixes my problem.
Thanks. I also noted this problem but I was so grateful for the product I
didn't want to complain about it!
I've fixed the problem by calling a dreamweaver dom function called
"synchronizeDocument" before getting the source.
This looks like it fixes my problem.
New version (1.0.0.3) on http://dwlint.abisvmm.nl
Did not yet build in the selection suggested by Sam.
Working on that at the moment.
--- In jslint_com@yahoogroups.com, "martijnbeulens" <mbeulens@...> wrote:
>
> If found that sometimes the source is being copied from the dreamweaver cache.
This means that if you use DW lint on a page, then change the page, it still
uses the old source to validate on.
> Closing and re-opening the file fixes the problem for now, but i'm still
figuring out what causes the cache problem.
>
> Ill post back with a solution when i got one.
> Any help is appreciated ofcourse.
>
>
> --- In jslint_com@yahoogroups.com, "martijnbeulens" <mbeulens@> wrote:
> >
> > After working with JSLint for a while i got tired from copy pasting my JS
code into jslint.com, so i searched google for a dreamweaver JSLint plugin.
> > Did not find it though, so created my own.
> >
> > It's an initial version, but i tend to update it if i find bugs or when
extra features are needed.
> >
> > I called it DWLint.
> > You can download an installer or the source from this page.
> >
> > http://dwlint.abisvmm.nl/
> >
> > Hope it's useful to someone.
> >
> > Martijn Beulens
> >
>
If found that sometimes the source is being copied from the dreamweaver cache.
This means that if you use DW lint on a page, then change the page, it still
uses the old source to validate on.
Closing and re-opening the file fixes the problem for now, but i'm still
figuring out what causes the cache problem.
Ill post back with a solution when i got one.
Any help is appreciated ofcourse.
--- In jslint_com@yahoogroups.com, "martijnbeulens" <mbeulens@...> wrote:
>
> After working with JSLint for a while i got tired from copy pasting my JS code
into jslint.com, so i searched google for a dreamweaver JSLint plugin.
> Did not find it though, so created my own.
>
> It's an initial version, but i tend to update it if i find bugs or when extra
features are needed.
>
> I called it DWLint.
> You can download an installer or the source from this page.
>
> http://dwlint.abisvmm.nl/
>
> Hope it's useful to someone.
>
> Martijn Beulens
>
That's weird. The Yahoo Widgets version of JSLint handles (X)HTML files just
fine. Copying and pasting into the on-line version generates all kinds of error
messages.
--- In jslint_com@yahoogroups.com, "samckayak" <samc@...> wrote:
>
> I just tried pasting several valid XHTML pages in JSLint and couldn't get past
the DOCTYPE.
>
> If it validates HTML, what am I doing wrong?
>