Douglas Crockford douglas@crockford.com
Branch | master (v2024.11.24) |
beta (Web Demo) |
alpha (Development) |
---|---|---|---|
CI | |||
Coverage | |||
Demo | |||
Artifacts |
/*jslint*/
/*jslint beta*/
/*jslint bitwise*/
/*jslint browser*/
/*jslint convert*/
/*jslint couch*/
/*jslint devel*/
/*jslint eval*/
/*jslint fart*/
/*jslint for*/
/*jslint getset*/
/*jslint indent2*/
/*jslint long*/
/*jslint node*/
/*jslint nomen*/
/*jslint single*/
/*jslint subscript*/
/*jslint this*/
/*jslint trace*/
/*jslint unordered*/
/*jslint white*/
/*global*/
/*property*/
/*jslint-disable*/.../*jslint-enable*/
//jslint-ignore-line
#!/bin/sh
curl -L https://www.jslint.com/jslint.mjs > jslint.mjs
jslint.mjs
in shell:#!/bin/sh
printf "console.log('hello world');\n" > hello.js
node jslint.mjs hello.js
jslint.mjs
in ES Module environment:#!/bin/sh
node --input-type=module --eval '
/*jslint devel*/
// Import JSLint in ES Module environment.
import jslint from "./jslint.mjs";
let globals = ["caches", "indexedDb"];
let options = {browser: true};
let result;
let source = "console.log(\u0027hello world\u0027);\n";
// JSLint <source> and print <formatted_message>.
result = jslint.jslint(source, options, globals);
result.warnings.forEach(function ({
formatted_message
}) {
console.error(formatted_message);
});
'
jslint.mjs
in CommonJS environment:#!/bin/sh
node --eval '
/*jslint devel*/
(async function () {
let globals = ["caches", "indexedDb"];
let jslint;
let options = {browser: true};
let result;
let source = "console.log(\u0027hello world\u0027);\n";
// Import JSLint in CommonJS environment.
jslint = await import("./jslint.mjs");
jslint = jslint.default;
// JSLint <source> and print <formatted_message>.
result = jslint.jslint(source, options, globals);
result.warnings.forEach(function ({
formatted_message
}) {
console.error(formatted_message);
});
}());
'
#!/bin/sh
# JSLint directory '.'
node jslint.mjs .
#!/bin/sh
printf "function foo() {console.log('hello world');}\n" > hello.js
# Create JSLint report from file 'hello.js' in shell.
node jslint.mjs \
jslint_report=.artifact/jslint_report_hello.html \
hello.js
#!/bin/sh
node --input-type=module --eval '
/*jslint devel*/
import jslint from "./jslint.mjs";
import fs from "fs";
(async function () {
let result;
let source = "function foo() {console.log(\u0027hello world\u0027);}\n";
// Create JSLint report from <source> in javascript.
result = jslint.jslint(source);
result = jslint.jslint_report(result);
result = `<body class="JSLINT_ JSLINT_REPORT_">\n${result}</body>\n`;
await fs.promises.mkdir(".artifact/", {recursive: true});
await fs.promises.writeFile(".artifact/jslint_report_hello.html", result);
console.error("wrote file .artifact/jslint_report_hello.html");
}());
'
#!/bin/sh
git clone https://github.com/tryghost/node-sqlite3 node-sqlite3-sh \
--branch=v5.0.11 \
--depth=1 \
--single-branch
cd node-sqlite3-sh
npm install
# Create V8 coverage report from program `npm run test` in shell.
node ../jslint.mjs \
v8_coverage_report=../.artifact/coverage_sqlite3_sh/ \
--exclude=tes?/ \
--exclude=tes[!0-9A-Z_a-z-]/ \
--exclude=tes[0-9A-Z_a-z-]/ \
--exclude=tes[^0-9A-Z_a-z-]/ \
--exclude=test/**/*.js \
--exclude=test/suppor*/*elper.js \
--exclude=test/suppor?/?elper.js \
--exclude=test/support/helper.js \
--include=**/*.cjs \
--include=**/*.js \
--include=**/*.mjs \
--include=li*/*.js \
--include=li?/*.js \
--include=lib/ \
--include=lib/**/*.js \
--include=lib/*.js \
--include=lib/sqlite3.js \
npm run test
#!/bin/sh
git clone https://github.com/tryghost/node-sqlite3 node-sqlite3-js \
--branch=v5.0.11 \
--depth=1 \
--single-branch
cd node-sqlite3-js
npm install
node --input-type=module --eval '
/*jslint node*/
import jslint from "../jslint.mjs";
(async function () {
// Create V8 coverage report from program `npm run test` in javascript.
await jslint.v8CoverageReportCreate({
coverageDir: "../.artifact/coverage_sqlite3_js/",
processArgv: [
"--exclude=tes?/",
"--exclude=tes[!0-9A-Z_a-z-]/",
"--exclude=tes[0-9A-Z_a-z-]/",
"--exclude=tes[^0-9A-Z_a-z-]/",
"--exclude=test/**/*.js",
"--exclude=test/suppor*/*elper.js",
"--exclude=test/suppor?/?elper.js",
"--exclude=test/support/helper.js",
"--include=**/*.cjs",
"--include=**/*.js",
"--include=**/*.mjs",
"--include=li*/*.js",
"--include=li?/*.js",
"--include=lib/",
"--include=lib/**/*.js",
"--include=lib/*.js",
"--include=lib/sqlite3.js",
"npm", "run", "test"
]
});
}());
'
Download and save jslint.mjs
, jslint_wrapper_codemirror.js
to file.
Edit, save, and serve example html-file below:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CodeMirror: JSLint Demo</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.10/codemirror.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.10/addon/lint/lint.css">
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.10/codemirror.js"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.10/mode/javascript/javascript.js"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.10/addon/lint/lint.js"></script>
<script type="module" src="https://github.com/jslint-org/jslint/raw/beta/jslint.mjs?window_jslint=1"></script>
<script defer src="https://github.com/jslint-org/jslint/raw/beta/jslint_wrapper_codemirror.js"></script>