Sublime Forum

Jslint without any npm package installed

#1

Is it possible to install some js linter, which does not require Node.Js/NPM installed? I can’t find some package without dependencies :frowning:

0 Likes

#2

Hehe a JavaScript guy who doesn’t like node. Cool. :innocent: :wink:

As jslint is written in javascript, you’ll need some runtime environment to run it. So which alternatives exist for node?

You might have a look onto https://github.com/douglascrockford/JSLint/blob/master/jslint.js and convert it to python so it can run natively in ST.

But I am in doubt with any JavaScript guy being interested in porting stuff to python.

I the end you hit the most frustrating fact of the hundreds of evolving programming/scripting languages. Each of them come along with their own needs - hard to merge in one tool such as ST.

1 Like

#3

A script is gonna need some environment to run in. It may be one that just happens to come with your os or an editor, but scripts without dependencies don’t exist. Of course you can like a language and dislike its runtime environment but it’s not very productive. You simply don’t get to run JavaScript on Python.

If you really don’t like node, there are alternatives that will run jslint. But since node isn’t that much more than a smallish wrapper around a pretty good engine, I don’t see what you win by not using node.

2 Likes

#4

This is for sure, but one could port a function(ality) from one to another, without pointing to sense or nonesense.

node isn’t that much more than a smallish wrapper

maybe it doesn’t add too much around the engine, but I think we have different understandings of “small”.

I really like the way node makes use of async io. This is really cool. But the resources a even tiny NodeJS app needs is just some kind of joke and far away from something which could be called “efficient”.

I played around with the OPC-UA stuff a bit. Nice to see how little code is needed to do something like that. But running a little server app to publish one stupid byte with a RAM usage of 130MB is just bullshit. Same functionality can be achieved with maybe 1 or 2MB of RAM usage. JS is just a waste of resources. Sure, most PCs have 16 and 32GB of RAM today, so one could ask whether it is an issue, but with the world of IoT in mind which needs such technologies and consists of mostly embedded devices, … .

0 Likes

#5

Oh, I definitely don’t disagree. The JS runtime is massive. But not because of node, it’s mostly due to V8 and I don’t think there are any other JS engines that are really efficient. If you care about efficiency you shouldn’t be writing JavaScript. Again, can’t take the language without the runtime environment. Of course you can port, but you’d have to be really in love with JavaScript as a language to want to do that. You’d also be the first person I’ve met that loves JS that much :wink:

0 Likes

#6

I wouldn’t go so far and call it language. :smile: Therfore I would find it a waste of time to port anything. This was more or less a not serious meant suggestion to @andreasCag.

I personally don’t have any problems with JavaScript - I don’t need to use it. I just don’t understand the hype about it at all.

1 Like

#7

A way around it would be to use an online (or remote) service that you upload the file to, have it analyze that and send back the results. Note that you are uploading your entire code to some remote and you should realized the security implications of this in your work environment.

0 Likes

#8

Kite will do that well for you :wink: … no way.

0 Likes

#9

If you’re really determined, Cesanta has an embeddable JavaScript Engine named V7, so in theory with a little tinkering you could create a simple interpreter to just execute JavaScript files to do something like this (there may even be such an example in the linked repository).

That said, if jslint is meant to run on node it may be using a bunch of node package, which would complicate things. I’m also not enough of a JavaScript guru to know if node has any extra extensions that might need some working around (like requiring modules or something along those lines).

0 Likes