jslint-org / jslint

JSLint, The JavaScript Code Quality and Coverage Tool

Home Page:https://www.jslint.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Providing a link to a JavaScript file to lint

unrealapex opened this issue · comments

commented

It would be nice to be able to provide a link to a file e.g https://www.example.com/script.js for linting as an alternative to copying the contents of the file and pasting them into JSLint.

closing this feature-request as infeasible-at-moment since it would require a backend/external server to process cors-requests. jslint.com currently is a static website.

commented

@kaizhu256 we could use an XMLHttpRequest to retrieve the content of webpages without the need of a server(works with static sites):

function reqListener () {
  // set the value of the editor textarea to the response text
  console.log(this.responseText);
}

var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "http://www.example.org/example.txt");
oReq.send();

it doesn't work. copy-paste the following code in your browser's console, and you'll see the http-request is refused. the only way to get around it is if jslint.com has a backend-server to serve as proxy.

await fetch("https://www.example.org/example.txt")

image

commented

I'm a little busy at the moment, when I get time, I'll verify it.