Skip to content

Commit

Permalink
Merge pull request #380 from kaizhu256/alpha
Browse files Browse the repository at this point in the history
# v2021.12.20
  • Loading branch information
kaizhu256 committed Dec 21, 2021
2 parents 3784d73 + cb8ae5e commit dbf17df
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 18 deletions.
4 changes: 1 addition & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
*
.*
!.npmignore
!CHANGELOG.md
!LICENSE
!README.md

!jslint.cjs
!jslint.mjs
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
- perf - improve performance by hoisting inlined regexps out of loops and subfunctions

# v2021.12.1-beta
# v2021.12.20
- npm - add file jslint.cjs so package @jslint-org/jslint can be published as dual-module
- jslint - relax warning "function_in_loop"
- update function assertJsonEqual to JSON.stringify 3rd param if its an object

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>


# Status
| Branch | [master<br>(v2021.11.20)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
| Branch | [master<br>(v2021.12.20)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
|--:|:--:|:--:|:--:|
| CI | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jslint-org/jslint/actions?query=branch%3Amaster) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=beta)](https://github.com/jslint-org/jslint/actions?query=branch%3Abeta) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=alpha)](https://github.com/jslint-org/jslint/actions?query=branch%3Aalpha) |
| Coverage | [![coverage](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/index.html) |
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta
name="description"
content="JSLint, The JavaScript Code Quality Tool. This file allows JSLint
content="JSLint, The JavaScript Code Quality and Coverage Tool. This file allows JSLint
to be run from a web browser. It can accept a source program and analyze
it without sending it over the network."
>
<meta name="author" content="Douglas Crockford">
<link rel="icon" type="image/png" href="asset_image_logo_512.svg">
<title>JSLint: The JavaScript Code Quality Tool</title>
<title>JSLint: The JavaScript Code Quality and Coverage Tool</title>
<!-- Google Lighthouse Performance - Reduce Largest Contentful Paint. -->
<link as="script" rel="preload" href="asset_codemirror_rollup.js">
<link rel="modulepreload" href="jslint.mjs">
Expand Down
14 changes: 14 additions & 0 deletions jslint.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*jslint beta, node*/
/*property
readFileSync, replace, runInNewContext
*/
require("vm").runInNewContext(
require("fs").readFileSync(__dirname + "/jslint.mjs", "utf8").replace(
"\nexport default Object.freeze(jslint_export);",
"\nexports = jslint_export;"
).replace(
"\njslint_import_meta_url = import.meta.url;",
"\n// jslint_import_meta_url = import.meta.url;"
),
module
);
2 changes: 1 addition & 1 deletion jslint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ let jslint_charset_ascii = (
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
);
let jslint_edition = "v2021.12.1-beta";
let jslint_edition = "v2021.12.20";
let jslint_export; // The jslint object to be exported.
let jslint_fudge = 1; // Fudge starting line and starting
// ... column to 1.
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
},
"counter": 7,
"description": "JSLint, The JavaScript Code Quality and Coverage Tool",
"exports": {
"default": "./jslint.cjs",
"import": "./jslint.mjs"
},
"fileCount": 28,
"keywords": [
"coverage-report",
Expand All @@ -13,7 +17,8 @@
"zero-dependency"
],
"license": "UNLICENSE",
"main": "jslint.mjs",
"main": "./jslint.cjs",
"module": "./jslint.mjs",
"name": "@jslint-org/jslint",
"repository": {
"type": "git",
Expand All @@ -23,5 +28,6 @@
"test": "node jslint.mjs v8_coverage_report=.artifact/coverage node test.mjs",
"test2": "sh jslint_ci.sh shCiBase"
},
"version": "2021.12.1-beta"
"type": "module",
"version": "2021.12.20"
}
25 changes: 17 additions & 8 deletions test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*jslint beta, node*/
import jslint from "./jslint.mjs";
import jslintCjs from "./jslint.cjs";
import moduleFs from "fs";
import modulePath from "path";
import jslint from "./jslint.mjs";

let {
assertErrorThrownAsync,
Expand Down Expand Up @@ -433,13 +434,18 @@ try {
elemPrv, code
], undefined, 4));
elemPrv = code;
warnings = jslint.jslint(code, {
beta: true
}).warnings;
assertOrThrow(
warnings.length === 0,
JSON.stringify([code, warnings])
);
[
jslint.jslint,
jslintCjs.jslint
].forEach(function (jslint) {
warnings = jslint.jslint(code, {
beta: true
}).warnings;
assertOrThrow(
warnings.length === 0,
JSON.stringify([code, warnings])
);
});
});
});
}());
Expand Down Expand Up @@ -567,6 +573,9 @@ try {
assertOrThrow(jslint.jslint("", {
test_internal_error: true
}).warnings.length === 1);
assertOrThrow(jslintCjs.jslint("", {
test_internal_error: true
}).warnings.length === 1);
}());

(async function testcaseJslintWarningsValidate() {
Expand Down

0 comments on commit dbf17df

Please sign in to comment.