[nodejs] node.js and jslint

203 views
Skip to first unread message

Alberto Santini

unread,
May 21, 2010, 3:40:42 PM5/21/10
to nodejs
Hello.

I tried to integrate jslint [1] with node.js.

I downloaded jslint file [2] and added at the end of file

exports.JSLINT = JSLINT;

Then I wrote a (primitive) node server [3].

When I connect to the server, in the console I get the following
message:

/home/icebox/My/Lib/SciTE/fulljslint.js:1107
at = s.search(/ \t/);
^
TypeError: Object 102 has no method 'search'
at nextLine (/home/icebox/My/Lib/SciTE/fulljslint.js:1107:20)
at Object.init (/home/icebox/My/Lib/SciTE/fulljslint.js:1178:17)
at /home/icebox/My/Lib/SciTE/fulljslint.js:5320:13
at /home/icebox/My/Lib/SciTE/node_fulljslint.js:32:18
at fs:78:13
at node.js:176:9

Usually with rhino, for instance, I have no problem with
fulljslint.js.

Any idea about node.js (0.1.95) error?

Thanks in advance,
Alberto

[1] http://www.jslint.com/
[2] http://www.jslint.com/fulljslint.js
[3] http://pastebin.com/jPhVT4Pi

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

Jan Schütze

unread,
May 21, 2010, 3:53:28 PM5/21/10
to nod...@googlegroups.com
Hello Alberto,

I guess it won't work since you are using a buffer as input for jslint here:

if (!JSLINT(data, options)) {

try this instead:

if (!JSLINT(data.toString(), options)) {

Regards,
Jan
--

http://dracoblue.net

anders conbere

unread,
May 21, 2010, 4:01:52 PM5/21/10
to nod...@googlegroups.com
If your goal is to jslint your own code, there are a few already
available translations into nice Node.

http://github.com/reid/node-jslint

for example.

~ Anders

2010/5/21 Jan Schütze <Ja...@dracoblue.de>:

Alberto Santini

unread,
May 21, 2010, 4:44:24 PM5/21/10
to nodejs


On May 21, 9:53 pm, Jan Schütze <J...@DracoBlue.de> wrote:
>
> try this instead:
>
>     if (!JSLINT(data.toString(), options))  {
>

Thanks for the suggestion. It works nice.

Regards,
Alberto

Alberto Santini

unread,
May 21, 2010, 4:50:18 PM5/21/10
to nodejs


On May 21, 10:01 pm, anders conbere <aconb...@gmail.com> wrote:
> If your goal is to jslint your own code, there are a few already
> available translations into nice Node.
>
> http://github.com/reid/node-jslint

Nice.

My goal was testing a script with V8, investigating a weird behaviour
[1] in rhino, cscript and now in v8, but not in spidermonkey.

In the meantime I learnt a bit about node.js. :)

Regards,
Alberto

[1] http://tech.groups.yahoo.com/group/jslint_com/message/1316
Reply all
Reply to author
Forward
0 new messages