@jslint-org/jslint 2022.5.20 → 2022.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +10 -7
- package/asset_codemirror_rollup.js +32 -20
- package/jslint.mjs +91 -67
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
# Todo
|
|
4
|
+
- wrapper - add vscode-command to suppress minor warnings on given line
|
|
5
|
+
- doc - document jslint directives and supported/unsupported es6+ features
|
|
4
6
|
- cli - remove cli-option `--mode-vim-plugin`
|
|
5
7
|
- coverage - add macros `/*coverage-disable*/` and `/*coverage-enable*/`.
|
|
6
8
|
- jslint - add html and css linting back into jslint.
|
|
@@ -12,6 +14,15 @@
|
|
|
12
14
|
- jslint - add new warning "Expected Object.create(null) instead of {}"
|
|
13
15
|
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
|
|
14
16
|
|
|
17
|
+
# v2022.6.21
|
|
18
|
+
- directive - add new directive `subscript` for linting of scripts targeting Google Closure Compiler
|
|
19
|
+
- bugfix - fix expression after "await" mis-identified as statement
|
|
20
|
+
- warning - relax warning about missing `catch` in `try...finally` statement
|
|
21
|
+
- jslint - allow aliases `evil, nomen` for jslint-directives `eval, name`, respectively for backwards-compat
|
|
22
|
+
- bugfix - fix broken codemirror example
|
|
23
|
+
- bugfix - fix jslint not-recognizing option-chaining when comparing operands of binary operator
|
|
24
|
+
- allow array-literals to directly call [...].flat() and [...].flatMap()
|
|
25
|
+
|
|
15
26
|
# v2022.5.20
|
|
16
27
|
- coverage-report - disable default-coverage of directory `node_modules`, but allow override with cli-option `--include-node-modules=1`
|
|
17
28
|
- coverage-report - add function globExclude() to revamp coverage-report to exclude files using glob-pattern-matching
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# Status
|
|
6
|
-
| Branch | [master<br>(v2022.
|
|
6
|
+
| Branch | [master<br>(v2022.6.21)](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) |
|
|
7
7
|
|--:|:--:|:--:|:--:|
|
|
8
8
|
| CI | [](https://github.com/jslint-org/jslint/actions?query=branch%3Amaster) | [](https://github.com/jslint-org/jslint/actions?query=branch%3Abeta) | [](https://github.com/jslint-org/jslint/actions?query=branch%3Aalpha) |
|
|
9
9
|
| Coverage | [](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/index.html) | [](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/index.html) | [](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/index.html) |
|
|
@@ -376,12 +376,11 @@ import jslint from "../jslint.mjs";
|
|
|
376
376
|
|
|
377
377
|
<!-- Assets from codemirror. -->
|
|
378
378
|
|
|
379
|
-
<link rel="stylesheet" href="https://
|
|
380
|
-
<link rel="stylesheet" href="https://codemirror.
|
|
381
|
-
<script defer src="https://
|
|
382
|
-
<script defer
|
|
383
|
-
|
|
384
|
-
<script defer src="https://codemirror.net/addon/lint/lint.js"></script>
|
|
379
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/codemirror.css">
|
|
380
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/addon/lint/lint.css">
|
|
381
|
+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/codemirror.js"></script>
|
|
382
|
+
<script defer src="https://codemirror.net/mode/javascript/javascript.js"></script>
|
|
383
|
+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/addon/lint/lint.js"></script>
|
|
385
384
|
|
|
386
385
|
<!-- Assets from jslint. -->
|
|
387
386
|
|
|
@@ -397,6 +396,10 @@ body {
|
|
|
397
396
|
.JSLINT_.JSLINT_REPORT_ {
|
|
398
397
|
margin-top: 20px;
|
|
399
398
|
}
|
|
399
|
+
#editor1 {
|
|
400
|
+
height: 300px;
|
|
401
|
+
width: 100%;
|
|
402
|
+
}
|
|
400
403
|
</style>
|
|
401
404
|
</head>
|
|
402
405
|
|
|
@@ -5,26 +5,26 @@ shRawLibFetch
|
|
|
5
5
|
"fetchList": [
|
|
6
6
|
{
|
|
7
7
|
"comment": true,
|
|
8
|
-
"url": "https://github.com/codemirror/
|
|
8
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/LICENSE"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
"url": "https://github.com/codemirror/
|
|
12
|
-
"url2": "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.
|
|
11
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/codemirror.js",
|
|
12
|
+
"url2": "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/codemirror.js"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"url": "https://github.com/codemirror/
|
|
15
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/edit/matchbrackets.js"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"url": "https://github.com/codemirror/
|
|
18
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/edit/trailingspace.js"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
"url": "https://github.com/codemirror/
|
|
21
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/lint/lint.js"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"url": "https://github.com/codemirror/
|
|
24
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/selection/active-line.js"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
"url": "https://github.com/codemirror/
|
|
27
|
+
"url": "https://github.com/codemirror/CodeMirror5/blob/5.65.5/mode/javascript/javascript.js"
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
30
|
"replaceList": []
|
|
@@ -33,13 +33,13 @@ shRawLibFetch
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
/*
|
|
36
|
-
repo https://github.com/codemirror/
|
|
37
|
-
committed 2022-
|
|
36
|
+
repo https://github.com/codemirror/CodeMirror5/tree/5.65.5
|
|
37
|
+
committed 2022-05-30T09:58:15Z
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
/*
|
|
42
|
-
file https://github.com/codemirror/
|
|
42
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/LICENSE
|
|
43
43
|
*/
|
|
44
44
|
/*
|
|
45
45
|
MIT License
|
|
@@ -67,7 +67,7 @@ THE SOFTWARE.
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
/*
|
|
70
|
-
file https://github.com/codemirror/
|
|
70
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/codemirror.js
|
|
71
71
|
*/
|
|
72
72
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
73
73
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
@@ -97,7 +97,8 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/codemirror.js
|
|
|
97
97
|
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
|
|
98
98
|
var webkit = !edge && /WebKit\//.test(userAgent);
|
|
99
99
|
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
|
|
100
|
-
var chrome = !edge && /Chrome
|
|
100
|
+
var chrome = !edge && /Chrome\/(\d+)/.exec(userAgent);
|
|
101
|
+
var chrome_version = chrome && +chrome[1];
|
|
101
102
|
var presto = /Opera\//.test(userAgent);
|
|
102
103
|
var safari = /Apple Computer/.test(navigator.vendor);
|
|
103
104
|
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
|
|
@@ -4580,6 +4581,17 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/codemirror.js
|
|
|
4580
4581
|
}
|
|
4581
4582
|
|
|
4582
4583
|
function onScrollWheel(cm, e) {
|
|
4584
|
+
// On Chrome 102, viewport updates somehow stop wheel-based
|
|
4585
|
+
// scrolling. Turning off pointer events during the scroll seems
|
|
4586
|
+
// to avoid the issue.
|
|
4587
|
+
if (chrome && chrome_version >= 102) {
|
|
4588
|
+
if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = "none"; }
|
|
4589
|
+
else { clearTimeout(cm.display.chromeScrollHack); }
|
|
4590
|
+
cm.display.chromeScrollHack = setTimeout(function () {
|
|
4591
|
+
cm.display.chromeScrollHack = null;
|
|
4592
|
+
cm.display.sizer.style.pointerEvents = "";
|
|
4593
|
+
}, 100);
|
|
4594
|
+
}
|
|
4583
4595
|
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
|
|
4584
4596
|
var pixelsPerUnit = wheelPixelsPerUnit;
|
|
4585
4597
|
if (e.deltaMode === 0) {
|
|
@@ -8268,7 +8280,7 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/codemirror.js
|
|
|
8268
8280
|
var pasted = e.clipboardData && e.clipboardData.getData("Text");
|
|
8269
8281
|
if (pasted) {
|
|
8270
8282
|
e.preventDefault();
|
|
8271
|
-
if (!cm.isReadOnly() && !cm.options.disableInput)
|
|
8283
|
+
if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())
|
|
8272
8284
|
{ runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
|
|
8273
8285
|
return true
|
|
8274
8286
|
}
|
|
@@ -9912,14 +9924,14 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/codemirror.js
|
|
|
9912
9924
|
|
|
9913
9925
|
addLegacyProps(CodeMirror);
|
|
9914
9926
|
|
|
9915
|
-
CodeMirror.version = "5.65.
|
|
9927
|
+
CodeMirror.version = "5.65.5";
|
|
9916
9928
|
|
|
9917
9929
|
return CodeMirror;
|
|
9918
9930
|
})));
|
|
9919
9931
|
|
|
9920
9932
|
|
|
9921
9933
|
/*
|
|
9922
|
-
file https://github.com/codemirror/
|
|
9934
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/edit/matchbrackets.js
|
|
9923
9935
|
*/
|
|
9924
9936
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
9925
9937
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
@@ -10084,7 +10096,7 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/addon/edit/matchbracke
|
|
|
10084
10096
|
|
|
10085
10097
|
|
|
10086
10098
|
/*
|
|
10087
|
-
file https://github.com/codemirror/
|
|
10099
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/edit/trailingspace.js
|
|
10088
10100
|
*/
|
|
10089
10101
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
10090
10102
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
@@ -10116,7 +10128,7 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/addon/edit/trailingspa
|
|
|
10116
10128
|
|
|
10117
10129
|
|
|
10118
10130
|
/*
|
|
10119
|
-
file https://github.com/codemirror/
|
|
10131
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/lint/lint.js
|
|
10120
10132
|
*/
|
|
10121
10133
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
10122
10134
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
@@ -10412,7 +10424,7 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/addon/lint/lint.js
|
|
|
10412
10424
|
|
|
10413
10425
|
|
|
10414
10426
|
/*
|
|
10415
|
-
file https://github.com/codemirror/
|
|
10427
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/addon/selection/active-line.js
|
|
10416
10428
|
*/
|
|
10417
10429
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
10418
10430
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
@@ -10489,7 +10501,7 @@ file https://github.com/codemirror/CodeMirror/blob/5.65.3/addon/selection/active
|
|
|
10489
10501
|
|
|
10490
10502
|
|
|
10491
10503
|
/*
|
|
10492
|
-
file https://github.com/codemirror/
|
|
10504
|
+
file https://github.com/codemirror/CodeMirror5/blob/5.65.5/mode/javascript/javascript.js
|
|
10493
10505
|
*/
|
|
10494
10506
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
10495
10507
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
package/jslint.mjs
CHANGED
|
@@ -94,10 +94,6 @@
|
|
|
94
94
|
|
|
95
95
|
/*jslint beta, node*/
|
|
96
96
|
/*property
|
|
97
|
-
excludeList,
|
|
98
|
-
globExclude,
|
|
99
|
-
import_meta_url, includeList,
|
|
100
|
-
pathnameList,
|
|
101
97
|
JSLINT_BETA, NODE_V8_COVERAGE, a, all, argv, arity, artifact,
|
|
102
98
|
assertErrorThrownAsync, assertJsonEqual, assertOrThrow, assign, async, b,
|
|
103
99
|
beta, bitwise, block, body, browser, c, calls, catch, catch_list,
|
|
@@ -106,57 +102,58 @@
|
|
|
106
102
|
convert, count, coverageDir, create, cwd, d, dead, debugInline, default,
|
|
107
103
|
delta, devel, directive, directive_list, directive_quiet, directives,
|
|
108
104
|
dirname, disrupt, dot, edition, elem_list, ellipsis, else, end, endOffset,
|
|
109
|
-
endsWith, entries, env, error, eval, every, example_list,
|
|
110
|
-
exit, exitCode, export_dict, exports, expression, extra, file,
|
|
111
|
-
fileURLToPath, filter, finally, flag, floor, for, forEach,
|
|
105
|
+
endsWith, entries, env, error, eval, every, example_list, excludeList, exec,
|
|
106
|
+
execArgv, exit, exitCode, export_dict, exports, expression, extra, file,
|
|
107
|
+
fileList, fileURLToPath, filter, finally, flag, floor, for, forEach,
|
|
112
108
|
formatted_message, free, freeze, from, froms, fsWriteFileWithParents,
|
|
113
109
|
fud_stmt, functionName, function_list, function_stack, functions, get,
|
|
114
|
-
getset, github_repo, global, global_dict, global_list,
|
|
115
|
-
id, identifier, import, import_list,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
110
|
+
getset, github_repo, globExclude, global, global_dict, global_list,
|
|
111
|
+
holeList, htmlEscape, id, identifier, import, import_list, import_meta_url,
|
|
112
|
+
inc, includeList, indent2, index, indexOf, init, initial, isArray,
|
|
113
|
+
isBlockCoverage, isHole, isNaN, is_equal, is_fart, is_weird, join, jslint,
|
|
114
|
+
jslint_apidoc, jslint_assert, jslint_charset_ascii, jslint_cli,
|
|
115
|
+
jslint_edition, jslint_phase1_split, jslint_phase2_lex, jslint_phase3_parse,
|
|
116
|
+
jslint_phase4_walk, jslint_phase5_whitage, jslint_report, json,
|
|
117
|
+
jstestDescribe, jstestIt, jstestOnExit, keys, label, lbp, led_infix, length,
|
|
118
|
+
level, line, lineList, line_list, line_offset, line_source, lines,
|
|
119
|
+
linesCovered, linesTotal, live, log, long, loop, m, map, margin, match, max,
|
|
120
|
+
message, meta, min, mkdir, modeCoverageIgnoreFile, modeIndex, mode_cli,
|
|
121
|
+
mode_conditional, mode_json, mode_module, mode_noop, mode_property,
|
|
122
|
+
mode_shebang, mode_stop, module, moduleFsInit, moduleName, module_list,
|
|
123
|
+
name, names, node, nomen, noop, now, nr, nud_prefix,
|
|
127
124
|
objectDeepCopyWithKeysSorted, ok, on, open, opening, option, option_dict,
|
|
128
125
|
order, package_name, padEnd, padStart, parameters, parent, parentIi, parse,
|
|
129
|
-
pathname, platform, pop, processArgv, process_argv,
|
|
130
|
-
process_exit, promises, property, property_dict, push, quote,
|
|
131
|
-
readFile, readdir, readonly, recursive, reduce, repeat, replace,
|
|
132
|
-
result, reverse, role, round, scriptId, search, set, shebang,
|
|
133
|
-
signature, single, slice, some, sort, source, spawn, splice, split,
|
|
134
|
-
stack_trace, start, startOffset, startsWith, statement,
|
|
135
|
-
stdio, stop, stop_at, stringify,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
versions, warn, warn_at, warning, warning_list, warnings,
|
|
141
|
-
writeFile
|
|
126
|
+
pathname, pathnameList, platform, pop, processArgv, process_argv,
|
|
127
|
+
process_env, process_exit, promises, property, property_dict, push, quote,
|
|
128
|
+
ranges, readFile, readdir, readonly, recursive, reduce, repeat, replace,
|
|
129
|
+
resolve, result, reverse, role, round, scriptId, search, set, shebang,
|
|
130
|
+
shift, signature, single, slice, some, sort, source, spawn, splice, split,
|
|
131
|
+
stack, stack_trace, start, startOffset, startsWith, statement,
|
|
132
|
+
statement_prv, stdio, stop, stop_at, stringify, subscript, switch,
|
|
133
|
+
syntax_dict, tenure, test, test_cause, test_internal_error, this, thru,
|
|
134
|
+
toString, token, token_global, token_list, token_nxt, token_tree, tokens,
|
|
135
|
+
trace, tree, trim, trimEnd, trimRight, try, type, unlink, unordered,
|
|
136
|
+
unshift, url, used, v8CoverageListMerge, v8CoverageReportCreate, value,
|
|
137
|
+
variable, version, versions, warn, warn_at, warning, warning_list, warnings,
|
|
138
|
+
white, wrapped, writeFile
|
|
142
139
|
*/
|
|
143
140
|
|
|
144
141
|
// init debugInline
|
|
145
142
|
let debugInline = (function () {
|
|
146
|
-
let
|
|
143
|
+
let __consoleError = function () {
|
|
147
144
|
return;
|
|
148
145
|
};
|
|
149
146
|
function debug(...argv) {
|
|
150
147
|
|
|
151
148
|
// This function will print <argv> to stderr and then return <argv>[0].
|
|
152
149
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
__consoleError("\n\ndebugInline");
|
|
151
|
+
__consoleError(...argv);
|
|
152
|
+
__consoleError("\n");
|
|
156
153
|
return argv[0];
|
|
157
154
|
}
|
|
158
155
|
debug(); // Coverage-hack.
|
|
159
|
-
|
|
156
|
+
__consoleError = console.error;
|
|
160
157
|
return debug;
|
|
161
158
|
}());
|
|
162
159
|
let jslint_charset_ascii = (
|
|
@@ -168,7 +165,7 @@ let jslint_charset_ascii = (
|
|
|
168
165
|
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
|
169
166
|
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
|
|
170
167
|
);
|
|
171
|
-
let jslint_edition = "v2022.
|
|
168
|
+
let jslint_edition = "v2022.6.21";
|
|
172
169
|
let jslint_export; // The jslint object to be exported.
|
|
173
170
|
let jslint_fudge = 1; // Fudge starting line and starting
|
|
174
171
|
// ... column to 1.
|
|
@@ -472,7 +469,9 @@ function globExclude({
|
|
|
472
469
|
// $()*+-./?[\]^{|}
|
|
473
470
|
|
|
474
471
|
strRegex = strRegex.replace((
|
|
475
|
-
|
|
472
|
+
|
|
473
|
+
// Ignore [-/].
|
|
474
|
+
|
|
476
475
|
/[$()*+.?\[\\\]\^{|}]/g
|
|
477
476
|
), "\\$&");
|
|
478
477
|
|
|
@@ -716,10 +715,11 @@ function jslint(
|
|
|
716
715
|
return false;
|
|
717
716
|
}
|
|
718
717
|
if (aa.arity === bb.arity && aa.id === bb.id) {
|
|
719
|
-
if (aa.id === ".") {
|
|
718
|
+
if (aa.id === "." || aa.id === "?.") {
|
|
720
719
|
|
|
721
720
|
// test_cause:
|
|
722
721
|
// ["aa.bb&&aa.bb", "is_equal", "recurse_arity_id", "", 0]
|
|
722
|
+
// ["aa?.bb&&aa?.bb", "is_equal", "recurse_arity_id", "", 0]
|
|
723
723
|
|
|
724
724
|
test_cause("recurse_arity_id");
|
|
725
725
|
return (
|
|
@@ -1258,7 +1258,7 @@ function jslint(
|
|
|
1258
1258
|
mode_json: false, // true if parsing JSON.
|
|
1259
1259
|
mode_module: false, // true if import or export was used.
|
|
1260
1260
|
mode_property: false, // true if directive /*property*/ is
|
|
1261
|
-
// used.
|
|
1261
|
+
// ... used.
|
|
1262
1262
|
mode_shebang: false, // true if #! is seen on the first line.
|
|
1263
1263
|
option_dict,
|
|
1264
1264
|
property_dict,
|
|
@@ -2473,6 +2473,7 @@ function jslint_phase2_lex(state) {
|
|
|
2473
2473
|
global_dict[key] = "user-defined";
|
|
2474
2474
|
|
|
2475
2475
|
// PR-347 - Disable warning "unexpected_directive_a".
|
|
2476
|
+
//
|
|
2476
2477
|
// state.mode_module = the_comment;
|
|
2477
2478
|
|
|
2478
2479
|
break;
|
|
@@ -3288,9 +3289,10 @@ function jslint_phase2_lex(state) {
|
|
|
3288
3289
|
case "getset": // Allow get() and set().
|
|
3289
3290
|
case "indent2": // Use 2-space indent.
|
|
3290
3291
|
case "long": // Allow long lines.
|
|
3291
|
-
case "name": // Allow weird property names.
|
|
3292
3292
|
case "node": // Assume Node.js environment.
|
|
3293
|
+
case "nomen": // Allow weird property names.
|
|
3293
3294
|
case "single": // Allow single-quote strings.
|
|
3295
|
+
case "subscript": // Allow identifier in subscript-notation.
|
|
3294
3296
|
case "test_cause": // Test jslint's causes.
|
|
3295
3297
|
case "test_internal_error": // Test jslint's internal-error
|
|
3296
3298
|
// ... handling-ability.
|
|
@@ -3303,6 +3305,16 @@ function jslint_phase2_lex(state) {
|
|
|
3303
3305
|
case "white": // Allow messy whitespace.
|
|
3304
3306
|
option_dict[key] = val;
|
|
3305
3307
|
break;
|
|
3308
|
+
|
|
3309
|
+
// PR-404 - Alias "evil" to jslint-directive "eval" for backwards-compat.
|
|
3310
|
+
|
|
3311
|
+
case "evil":
|
|
3312
|
+
return option_set_item("eval", val);
|
|
3313
|
+
|
|
3314
|
+
// PR-404 - Alias "nomen" to jslint-directive "name" for backwards-compat.
|
|
3315
|
+
|
|
3316
|
+
case "name":
|
|
3317
|
+
return option_set_item("nomen", val);
|
|
3306
3318
|
default:
|
|
3307
3319
|
return false;
|
|
3308
3320
|
}
|
|
@@ -3391,6 +3403,7 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
|
|
|
3391
3403
|
"location",
|
|
3392
3404
|
// "name",
|
|
3393
3405
|
"navigator",
|
|
3406
|
+
"postMessage",
|
|
3394
3407
|
// "screen",
|
|
3395
3408
|
"sessionStorage",
|
|
3396
3409
|
// "setInterval",
|
|
@@ -4487,6 +4500,8 @@ function jslint_phase3_parse(state) {
|
|
|
4487
4500
|
left.id !== "["
|
|
4488
4501
|
|| (
|
|
4489
4502
|
name.id !== "concat"
|
|
4503
|
+
&& name.id !== "flat"
|
|
4504
|
+
&& name.id !== "flatMap"
|
|
4490
4505
|
&& name.id !== "forEach"
|
|
4491
4506
|
&& name.id !== "join"
|
|
4492
4507
|
&& name.id !== "map"
|
|
@@ -4546,7 +4561,10 @@ function jslint_phase3_parse(state) {
|
|
|
4546
4561
|
let the_subscript = parse_expression(0);
|
|
4547
4562
|
if (the_subscript.id === "(string)" || the_subscript.id === "`") {
|
|
4548
4563
|
name = survey(the_subscript);
|
|
4549
|
-
|
|
4564
|
+
|
|
4565
|
+
// PR-404 - Add new directive "subscript" to play nice with Google Closure.
|
|
4566
|
+
|
|
4567
|
+
if (!option_dict.subscript && jslint_rgx_identifier.test(name)) {
|
|
4550
4568
|
|
|
4551
4569
|
// test_cause:
|
|
4552
4570
|
// ["aa[`aa`]", "infix_lbracket", "subscript_a", "aa", 4]
|
|
@@ -5275,10 +5293,13 @@ function jslint_phase3_parse(state) {
|
|
|
5275
5293
|
functionage.async += 1;
|
|
5276
5294
|
}
|
|
5277
5295
|
if (the_await.arity === "statement") {
|
|
5278
|
-
|
|
5296
|
+
|
|
5297
|
+
// PR-405 - Bugfix - fix expression after "await" mis-identified as statement.
|
|
5298
|
+
|
|
5299
|
+
the_await.expression = parse_expression(150);
|
|
5279
5300
|
semicolon();
|
|
5280
5301
|
} else {
|
|
5281
|
-
the_await.expression = parse_expression();
|
|
5302
|
+
the_await.expression = parse_expression(150);
|
|
5282
5303
|
}
|
|
5283
5304
|
return the_await;
|
|
5284
5305
|
}
|
|
@@ -6344,6 +6365,7 @@ function jslint_phase3_parse(state) {
|
|
|
6344
6365
|
let names;
|
|
6345
6366
|
|
|
6346
6367
|
// PR-347 - Disable warning "unexpected_directive_a".
|
|
6368
|
+
//
|
|
6347
6369
|
// if (typeof state.mode_module === "object") {
|
|
6348
6370
|
//
|
|
6349
6371
|
// // test_cause:
|
|
@@ -6701,12 +6723,16 @@ function jslint_phase3_parse(state) {
|
|
|
6701
6723
|
// Restore previous catch-scope after catch-block.
|
|
6702
6724
|
|
|
6703
6725
|
catchage = catch_stack.pop();
|
|
6704
|
-
} else {
|
|
6705
6726
|
|
|
6706
|
-
//
|
|
6707
|
-
//
|
|
6727
|
+
// PR-404 - Relax warning about missing `catch` in `try...finally` statement.
|
|
6728
|
+
//
|
|
6729
|
+
// } else {
|
|
6730
|
+
//
|
|
6731
|
+
// // test_cause:
|
|
6732
|
+
// // ["try{}finally{break;}", "stmt_try", "expected_a_before_b", "finally", 6]
|
|
6733
|
+
//
|
|
6734
|
+
// warn("expected_a_before_b", token_nxt, "catch", artifact());
|
|
6708
6735
|
|
|
6709
|
-
warn("expected_a_before_b", token_nxt, "catch", artifact());
|
|
6710
6736
|
}
|
|
6711
6737
|
if (token_nxt.id === "finally") {
|
|
6712
6738
|
functionage.finally += 1;
|
|
@@ -6827,12 +6853,14 @@ function jslint_phase3_parse(state) {
|
|
|
6827
6853
|
return stop("expected_identifier_a");
|
|
6828
6854
|
}
|
|
6829
6855
|
|
|
6830
|
-
// PR-363 - Bugfix
|
|
6831
|
-
// <uninitialized 'bb'> in code
|
|
6856
|
+
// PR-363 - Bugfix
|
|
6857
|
+
// Add test against false-warning <uninitialized 'bb'> in code
|
|
6858
|
+
// '/*jslint node*/\nlet {aa:bb} = {}; bb();'.
|
|
6859
|
+
//
|
|
6860
|
+
// token_nxt.label = name;
|
|
6861
|
+
// the_variable.names.push(token_nxt);
|
|
6862
|
+
// enroll(token_nxt, "variable", mode_const);
|
|
6832
6863
|
|
|
6833
|
-
// token_nxt.label = name;
|
|
6834
|
-
// the_variable.names.push(token_nxt);
|
|
6835
|
-
// enroll(token_nxt, "variable", mode_const);
|
|
6836
6864
|
name = token_nxt;
|
|
6837
6865
|
the_variable.names.push(name);
|
|
6838
6866
|
survey(name);
|
|
@@ -7055,7 +7083,7 @@ function jslint_phase3_parse(state) {
|
|
|
7055
7083
|
warn("unregistered_property_a", name);
|
|
7056
7084
|
}
|
|
7057
7085
|
} else if (
|
|
7058
|
-
!option_dict.
|
|
7086
|
+
!option_dict.nomen
|
|
7059
7087
|
&& name.identifier
|
|
7060
7088
|
&& jslint_rgx_weird_property.test(id)
|
|
7061
7089
|
) {
|
|
@@ -8468,9 +8496,6 @@ function jslint_phase4_walk(state) {
|
|
|
8468
8496
|
// ["+[]", "walk_statement", "unexpected_expression_a", "+", 1]
|
|
8469
8497
|
// ["+new aa()", "walk_statement", "unexpected_expression_a", "+", 1]
|
|
8470
8498
|
// ["0", "walk_statement", "unexpected_expression_a", "0", 1]
|
|
8471
|
-
// ["
|
|
8472
|
-
// async function aa(){await 0;}
|
|
8473
|
-
// ", "walk_statement", "unexpected_expression_a", "0", 27]
|
|
8474
8499
|
// ["typeof 0", "walk_statement", "unexpected_expression_a", "typeof", 1]
|
|
8475
8500
|
|
|
8476
8501
|
warn("unexpected_expression_a", thing);
|
|
@@ -9805,6 +9830,7 @@ async function jstestDescribe(description, testFunction) {
|
|
|
9805
9830
|
|
|
9806
9831
|
let message;
|
|
9807
9832
|
let result;
|
|
9833
|
+
let timerTimeout;
|
|
9808
9834
|
|
|
9809
9835
|
// Init jstestTimeStart.
|
|
9810
9836
|
|
|
@@ -9820,7 +9846,9 @@ async function jstestDescribe(description, testFunction) {
|
|
|
9820
9846
|
|
|
9821
9847
|
// Wait for jstestItList to resolve.
|
|
9822
9848
|
|
|
9849
|
+
timerTimeout = setTimeout(noop, 0x7fffffff);
|
|
9823
9850
|
result = await Promise.all(jstestItList);
|
|
9851
|
+
clearTimeout(timerTimeout);
|
|
9824
9852
|
|
|
9825
9853
|
// Print test results.
|
|
9826
9854
|
|
|
@@ -11092,15 +11120,13 @@ function sentinel() {}
|
|
|
11092
11120
|
processArgElem[1] = processArgElem.slice(1).join("=");
|
|
11093
11121
|
switch (processArgElem[0]) {
|
|
11094
11122
|
|
|
11095
|
-
// PR-371
|
|
11096
|
-
// Add cli-option `--exclude=...`.
|
|
11123
|
+
// PR-371 - Add cli-option `--exclude=...`.
|
|
11097
11124
|
|
|
11098
11125
|
case "--exclude":
|
|
11099
11126
|
excludeList.push(processArgElem[1]);
|
|
11100
11127
|
break;
|
|
11101
11128
|
|
|
11102
|
-
// PR-371
|
|
11103
|
-
// Add cli-option `--include=...`
|
|
11129
|
+
// PR-371 - Add cli-option `--include=...`
|
|
11104
11130
|
|
|
11105
11131
|
case "--include":
|
|
11106
11132
|
includeList.push(processArgElem[1]);
|
|
@@ -11200,15 +11226,13 @@ function sentinel() {}
|
|
|
11200
11226
|
pathnameDict[pathname] = scriptCov;
|
|
11201
11227
|
});
|
|
11202
11228
|
|
|
11203
|
-
// PR-400
|
|
11204
|
-
// Filter directory `node_modules`.
|
|
11229
|
+
// PR-400 - Filter directory `node_modules`.
|
|
11205
11230
|
|
|
11206
11231
|
if (!modeIncludeNodeModules) {
|
|
11207
11232
|
excludeList.push("node_modules/");
|
|
11208
11233
|
}
|
|
11209
11234
|
|
|
11210
|
-
// PR-400
|
|
11211
|
-
// Filter files by glob-patterns in excludeList, includeList.
|
|
11235
|
+
// PR-400 - Filter files by glob-patterns in excludeList, includeList.
|
|
11212
11236
|
|
|
11213
11237
|
data.result = globExclude({
|
|
11214
11238
|
excludeList,
|
package/package.json
CHANGED