sqlmath 2022.4.28 → 2022.8.20
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/.npmignore +1 -0
- package/CHANGELOG.md +83 -1
- package/LICENSE +2 -2
- package/README.md +25 -3
- package/_binary_sqlmath_napi8_darwin_x64.node +0 -0
- package/_binary_sqlmath_napi8_linux_x64.node +0 -0
- package/_binary_sqlmath_napi8_win32_x64.node +0 -0
- package/_binary_sqlmath_shell_darwin_x64 +0 -0
- package/_binary_sqlmath_shell_linux_x64 +0 -0
- package/_binary_sqlmath_shell_win32_x64.exe +0 -0
- package/jslint.mjs +477 -155
- package/package.json +4 -4
- package/sqlmath.mjs +836 -1702
package/jslint.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// #!/usr/bin/env node
|
|
2
2
|
// JSLint
|
|
3
|
-
// Original Author: Douglas Crockford (https://www.jslint.com).
|
|
4
3
|
|
|
4
|
+
// The Unlicense
|
|
5
|
+
//
|
|
5
6
|
// This is free and unencumbered software released into the public domain.
|
|
6
|
-
|
|
7
|
+
//
|
|
7
8
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
8
9
|
// distribute this software, either in source code form or as a compiled
|
|
9
10
|
// binary, for any purpose, commercial or non-commercial, and by any
|
|
10
11
|
// means.
|
|
11
|
-
|
|
12
|
+
//
|
|
12
13
|
// In jurisdictions that recognize copyright laws, the author or authors
|
|
13
14
|
// of this software dedicate any and all copyright interest in the
|
|
14
15
|
// software to the public domain. We make this dedication for the benefit
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
// successors. We intend this dedication to be an overt act of
|
|
17
18
|
// relinquishment in perpetuity of all present and future rights to this
|
|
18
19
|
// software under copyright law.
|
|
19
|
-
|
|
20
|
+
//
|
|
20
21
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
21
22
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
22
23
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
25
26
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
26
27
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
-
|
|
28
|
+
//
|
|
28
29
|
// For more information, please refer to <https://unlicense.org/>
|
|
29
30
|
|
|
30
31
|
|
|
@@ -92,7 +93,6 @@
|
|
|
92
93
|
// WARNING: JSLint will hurt your feelings.
|
|
93
94
|
|
|
94
95
|
/*jslint beta, node*/
|
|
95
|
-
|
|
96
96
|
/*property
|
|
97
97
|
JSLINT_BETA, NODE_V8_COVERAGE, a, all, argv, arity, artifact,
|
|
98
98
|
assertErrorThrownAsync, assertJsonEqual, assertOrThrow, assign, async, b,
|
|
@@ -100,59 +100,60 @@
|
|
|
100
100
|
catch_stack, causes, char, children, clear, closer, closure, code, column,
|
|
101
101
|
concat, consoleError, console_error, console_log, constant, context,
|
|
102
102
|
convert, count, coverageDir, create, cwd, d, dead, debugInline, default,
|
|
103
|
-
delta, devel, directive,
|
|
103
|
+
delta, devel, directive, directive_ignore_line, directive_list, directives,
|
|
104
104
|
dirname, disrupt, dot, edition, elem_list, ellipsis, else, end, endOffset,
|
|
105
|
-
endsWith, entries, env, error, eval, every, example_list,
|
|
106
|
-
exit, exitCode, export_dict, exports, expression, extra, file,
|
|
107
|
-
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,
|
|
108
108
|
formatted_message, free, freeze, from, froms, fsWriteFileWithParents,
|
|
109
109
|
fud_stmt, functionName, function_list, function_stack, functions, get,
|
|
110
|
-
getset, github_repo, global, global_dict, global_list,
|
|
111
|
-
id, identifier, import, import_list,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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,
|
|
123
124
|
objectDeepCopyWithKeysSorted, ok, on, open, opening, option, option_dict,
|
|
124
125
|
order, package_name, padEnd, padStart, parameters, parent, parentIi, parse,
|
|
125
|
-
pathname, platform, pop, processArgv, process_argv,
|
|
126
|
-
process_exit, promises, property, property_dict, push, quote,
|
|
127
|
-
readFile, readdir, readonly, recursive, reduce, repeat, replace,
|
|
128
|
-
result, reverse, role, round, scriptId, search, set, shebang,
|
|
129
|
-
signature, single, slice, some, sort, source, spawn, splice, split,
|
|
130
|
-
stack_trace, start, startOffset, startsWith, statement,
|
|
131
|
-
stdio, stop, stop_at, stringify,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
versions, warn, warn_at, warning, warning_list, warnings,
|
|
137
|
-
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
|
|
138
139
|
*/
|
|
139
140
|
|
|
140
141
|
// init debugInline
|
|
141
142
|
let debugInline = (function () {
|
|
142
|
-
let
|
|
143
|
+
let __consoleError = function () {
|
|
143
144
|
return;
|
|
144
145
|
};
|
|
145
146
|
function debug(...argv) {
|
|
146
147
|
|
|
147
148
|
// This function will print <argv> to stderr and then return <argv>[0].
|
|
148
149
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
__consoleError("\n\ndebugInline");
|
|
151
|
+
__consoleError(...argv);
|
|
152
|
+
__consoleError("\n");
|
|
152
153
|
return argv[0];
|
|
153
154
|
}
|
|
154
155
|
debug(); // Coverage-hack.
|
|
155
|
-
|
|
156
|
+
__consoleError = console.error; //jslint-ignore-line
|
|
156
157
|
return debug;
|
|
157
158
|
}());
|
|
158
159
|
let jslint_charset_ascii = (
|
|
@@ -164,7 +165,7 @@ let jslint_charset_ascii = (
|
|
|
164
165
|
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
|
165
166
|
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
|
|
166
167
|
);
|
|
167
|
-
let jslint_edition = "v2022.
|
|
168
|
+
let jslint_edition = "v2022.7.20";
|
|
168
169
|
let jslint_export; // The jslint object to be exported.
|
|
169
170
|
let jslint_fudge = 1; // Fudge starting line and starting
|
|
170
171
|
// ... column to 1.
|
|
@@ -251,6 +252,9 @@ let jslint_rgx_token = new RegExp(
|
|
|
251
252
|
+ ")"
|
|
252
253
|
+ "(.*)$"
|
|
253
254
|
);
|
|
255
|
+
let jslint_rgx_url_search_window_jslint = (
|
|
256
|
+
/[&?]window_jslint=1(?:$|&)/m
|
|
257
|
+
);
|
|
254
258
|
let jslint_rgx_weird_property = (
|
|
255
259
|
/^_|\$|Sync$|_$/m
|
|
256
260
|
);
|
|
@@ -349,6 +353,226 @@ async function fsWriteFileWithParents(pathname, data) {
|
|
|
349
353
|
console.error("wrote file " + pathname);
|
|
350
354
|
}
|
|
351
355
|
|
|
356
|
+
function globExclude({
|
|
357
|
+
excludeList = [],
|
|
358
|
+
includeList = [],
|
|
359
|
+
pathnameList = []
|
|
360
|
+
}) {
|
|
361
|
+
|
|
362
|
+
// This function will
|
|
363
|
+
// 1. Exclude pathnames in <pathnameList> that don't match glob-patterns in
|
|
364
|
+
// <includeList>.
|
|
365
|
+
// 2. Exclude pathnames in <pathnameList> that match glob-patterns in
|
|
366
|
+
// <excludeList>.
|
|
367
|
+
|
|
368
|
+
function globAssertNotWeird(list, name) {
|
|
369
|
+
|
|
370
|
+
// This function will check if <list> of strings contain weird characters.
|
|
371
|
+
|
|
372
|
+
[
|
|
373
|
+
[
|
|
374
|
+
"\n", (
|
|
375
|
+
/^.*?([\u0000-\u0007\r]).*/gm
|
|
376
|
+
)
|
|
377
|
+
],
|
|
378
|
+
[
|
|
379
|
+
"\r", (
|
|
380
|
+
/^.*?([\n]).*/gm
|
|
381
|
+
)
|
|
382
|
+
]
|
|
383
|
+
].forEach(function ([
|
|
384
|
+
separator, rgx
|
|
385
|
+
]) {
|
|
386
|
+
list.join(separator).replace(rgx, function (match0, char) {
|
|
387
|
+
throw new Error(
|
|
388
|
+
"Weird character "
|
|
389
|
+
+ JSON.stringify(char)
|
|
390
|
+
+ " found in " + name + " "
|
|
391
|
+
+ JSON.stringify(match0)
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function globToRegexp(pattern) {
|
|
398
|
+
|
|
399
|
+
// This function will translate glob <pattern> to javascript-regexp,
|
|
400
|
+
// which javascript can then use to "glob" pathnames.
|
|
401
|
+
|
|
402
|
+
let ii = 0;
|
|
403
|
+
let isClass = false;
|
|
404
|
+
let strClass = "";
|
|
405
|
+
let strRegex = "";
|
|
406
|
+
pattern = pattern.replace((
|
|
407
|
+
/\/\/+/g
|
|
408
|
+
), "/");
|
|
409
|
+
pattern = pattern.replace((
|
|
410
|
+
/\*\*\*+/g
|
|
411
|
+
), "**");
|
|
412
|
+
pattern.replace((
|
|
413
|
+
/\\\\|\\\[|\\\]|\[|\]|./g
|
|
414
|
+
), function (match0) {
|
|
415
|
+
switch (match0) {
|
|
416
|
+
case "[":
|
|
417
|
+
if (isClass) {
|
|
418
|
+
strClass += "[";
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
strClass += "\u0000";
|
|
422
|
+
strRegex += "\u0000";
|
|
423
|
+
isClass = true;
|
|
424
|
+
return;
|
|
425
|
+
case "]":
|
|
426
|
+
if (isClass) {
|
|
427
|
+
isClass = false;
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
strRegex += "]";
|
|
431
|
+
return;
|
|
432
|
+
default:
|
|
433
|
+
if (isClass) {
|
|
434
|
+
strClass += match0;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
strRegex += match0;
|
|
438
|
+
}
|
|
439
|
+
return "";
|
|
440
|
+
});
|
|
441
|
+
strClass += "\u0000";
|
|
442
|
+
|
|
443
|
+
// An expression "[!...]" matches a single character, namely any character that
|
|
444
|
+
// is not matched by the expression obtained by removing the first '!' from it.
|
|
445
|
+
// (Thus, "[!a-]" matches any single character except 'a', and '-'.)
|
|
446
|
+
|
|
447
|
+
strClass = strClass.replace((
|
|
448
|
+
/\u0000!/g
|
|
449
|
+
), "\u0000^");
|
|
450
|
+
|
|
451
|
+
// One may include '-' in its literal meaning by making it the first or last
|
|
452
|
+
// character between the brackets.
|
|
453
|
+
|
|
454
|
+
strClass = strClass.replace((
|
|
455
|
+
/\u0000-/g
|
|
456
|
+
), "\u0000\\-");
|
|
457
|
+
strClass = strClass.replace((
|
|
458
|
+
/-\u0000/g
|
|
459
|
+
), "\\-\u0000");
|
|
460
|
+
|
|
461
|
+
// Escape brackets '[', ']' in character class.
|
|
462
|
+
|
|
463
|
+
strClass = strClass.replace((
|
|
464
|
+
/[\[\]]/g
|
|
465
|
+
), "\\$&");
|
|
466
|
+
|
|
467
|
+
// https://stackoverflow.com/questions/3561493
|
|
468
|
+
// /is-there-a-regexp-escape-function-in-javascript
|
|
469
|
+
// $()*+-./?[\]^{|}
|
|
470
|
+
|
|
471
|
+
strRegex = strRegex.replace((
|
|
472
|
+
|
|
473
|
+
// Ignore [-/].
|
|
474
|
+
|
|
475
|
+
/[$()*+.?\[\\\]\^{|}]/g
|
|
476
|
+
), "\\$&");
|
|
477
|
+
|
|
478
|
+
// Expand wildcard '**/*'.
|
|
479
|
+
|
|
480
|
+
strRegex = strRegex.replace((
|
|
481
|
+
/\\\*\\\*\/(?:\\\*)+/g
|
|
482
|
+
), ".*?");
|
|
483
|
+
|
|
484
|
+
// Expand wildcard '**'.
|
|
485
|
+
|
|
486
|
+
strRegex = strRegex.replace((
|
|
487
|
+
/(^|\/)\\\*\\\*(\/|$)/gm
|
|
488
|
+
), "$1.*?$2");
|
|
489
|
+
|
|
490
|
+
// Expand wildcard '*'.
|
|
491
|
+
|
|
492
|
+
strRegex = strRegex.replace((
|
|
493
|
+
/(?:\\\*)+/g
|
|
494
|
+
), "[^\\/]*?");
|
|
495
|
+
|
|
496
|
+
// Expand wildcard '?'.
|
|
497
|
+
|
|
498
|
+
strRegex = strRegex.replace((
|
|
499
|
+
/\\\?/g
|
|
500
|
+
), "[^\\/]");
|
|
501
|
+
|
|
502
|
+
// Expand directory-with-trailing-slash '.../'.
|
|
503
|
+
|
|
504
|
+
strRegex = strRegex.replace((
|
|
505
|
+
/\/$/gm
|
|
506
|
+
), "\\/.*?");
|
|
507
|
+
|
|
508
|
+
// Merge strClass into strRegex.
|
|
509
|
+
|
|
510
|
+
ii = 0;
|
|
511
|
+
strClass = strClass.split("\u0000");
|
|
512
|
+
strRegex = strRegex.replace((
|
|
513
|
+
/\u0000/g
|
|
514
|
+
), function () {
|
|
515
|
+
ii += 1;
|
|
516
|
+
if (strClass[ii] === "") {
|
|
517
|
+
return "";
|
|
518
|
+
}
|
|
519
|
+
return "[" + strClass[ii] + "]";
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// Change strRegex from string to regexp.
|
|
523
|
+
|
|
524
|
+
strRegex = new RegExp("^" + strRegex + "$", "gm");
|
|
525
|
+
return strRegex;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// Validate excludeList, includeList, pathnameList.
|
|
529
|
+
|
|
530
|
+
globAssertNotWeird(excludeList, "pattern");
|
|
531
|
+
globAssertNotWeird(includeList, "pattern");
|
|
532
|
+
globAssertNotWeird(pathnameList, "pathname");
|
|
533
|
+
|
|
534
|
+
// Optimization
|
|
535
|
+
// Concat pathnames into a single, newline-separated string,
|
|
536
|
+
// whose pathnames can all be filtered with a single, regexp-pass.
|
|
537
|
+
|
|
538
|
+
pathnameList = pathnameList.join("\n");
|
|
539
|
+
|
|
540
|
+
// 1. Exclude pathnames in <pathnameList> that don't match glob-patterns in
|
|
541
|
+
// <includeList>.
|
|
542
|
+
|
|
543
|
+
if (includeList.length > 0) {
|
|
544
|
+
includeList = includeList.map(globToRegexp);
|
|
545
|
+
includeList.forEach(function (pattern) {
|
|
546
|
+
pathnameList = pathnameList.replace(pattern, "\u0000$&");
|
|
547
|
+
});
|
|
548
|
+
pathnameList = pathnameList.replace((
|
|
549
|
+
/^[^\u0000].*/gm
|
|
550
|
+
), "");
|
|
551
|
+
pathnameList = pathnameList.replace((
|
|
552
|
+
/^\u0000+/gm
|
|
553
|
+
), "");
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// 2. Exclude pathnames in <pathnameList> that match glob-patterns in
|
|
557
|
+
// <excludeList>.
|
|
558
|
+
|
|
559
|
+
excludeList = excludeList.map(globToRegexp);
|
|
560
|
+
excludeList.forEach(function (pattern) {
|
|
561
|
+
pathnameList = pathnameList.replace(pattern, "");
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
// Split newline-separated pathnames back to list.
|
|
565
|
+
|
|
566
|
+
pathnameList = pathnameList.split("\n").filter(function (elem) {
|
|
567
|
+
return elem;
|
|
568
|
+
});
|
|
569
|
+
return {
|
|
570
|
+
excludeList,
|
|
571
|
+
includeList,
|
|
572
|
+
pathnameList
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
|
|
352
576
|
function htmlEscape(str) {
|
|
353
577
|
|
|
354
578
|
// This function will make <str> html-safe by escaping & < >.
|
|
@@ -491,10 +715,11 @@ function jslint(
|
|
|
491
715
|
return false;
|
|
492
716
|
}
|
|
493
717
|
if (aa.arity === bb.arity && aa.id === bb.id) {
|
|
494
|
-
if (aa.id === ".") {
|
|
718
|
+
if (aa.id === "." || aa.id === "?.") {
|
|
495
719
|
|
|
496
720
|
// test_cause:
|
|
497
721
|
// ["aa.bb&&aa.bb", "is_equal", "recurse_arity_id", "", 0]
|
|
722
|
+
// ["aa?.bb&&aa?.bb", "is_equal", "recurse_arity_id", "", 0]
|
|
498
723
|
|
|
499
724
|
test_cause("recurse_arity_id");
|
|
500
725
|
return (
|
|
@@ -635,11 +860,22 @@ function jslint(
|
|
|
635
860
|
c,
|
|
636
861
|
d
|
|
637
862
|
);
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
863
|
+
|
|
864
|
+
// Issue #408
|
|
865
|
+
// Warnings that should be ignored sometimes suppress legitimate warnings.
|
|
866
|
+
|
|
867
|
+
if (the_warning.directive_ignore_line) {
|
|
868
|
+
return the_warning;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// If there is already a warning on this token, suppress the new one. It is
|
|
872
|
+
// likely that the first warning will be the most meaningful.
|
|
873
|
+
|
|
874
|
+
if (the_token.warning) {
|
|
641
875
|
warning_list.pop();
|
|
876
|
+
return the_warning;
|
|
642
877
|
}
|
|
878
|
+
the_token.warning = the_warning;
|
|
643
879
|
return the_warning;
|
|
644
880
|
}
|
|
645
881
|
|
|
@@ -789,6 +1025,7 @@ function jslint(
|
|
|
789
1025
|
break;
|
|
790
1026
|
|
|
791
1027
|
// PR-347 - Disable warning "missing_browser".
|
|
1028
|
+
//
|
|
792
1029
|
// case "missing_browser":
|
|
793
1030
|
// mm = `/*global*/ requires the Assume a browser option.`;
|
|
794
1031
|
// break;
|
|
@@ -873,6 +1110,7 @@ function jslint(
|
|
|
873
1110
|
break;
|
|
874
1111
|
|
|
875
1112
|
// PR-347 - Disable warning "unexpected_directive_a".
|
|
1113
|
+
//
|
|
876
1114
|
// case "unexpected_directive_a":
|
|
877
1115
|
// mm = `When using modules, don't use directive '/\u002a${a}'.`;
|
|
878
1116
|
// break;
|
|
@@ -994,12 +1232,12 @@ function jslint(
|
|
|
994
1232
|
if (option_dict.trace) {
|
|
995
1233
|
warning.stack_trace = new Error().stack;
|
|
996
1234
|
}
|
|
997
|
-
if (warning.
|
|
1235
|
+
if (warning.directive_ignore_line) {
|
|
998
1236
|
|
|
999
1237
|
// test_cause:
|
|
1000
|
-
// ["0 //jslint-
|
|
1238
|
+
// ["0 //jslint-ignore-line", "semicolon", "directive_ignore_line", "", 0]
|
|
1001
1239
|
|
|
1002
|
-
test_cause("
|
|
1240
|
+
test_cause("directive_ignore_line");
|
|
1003
1241
|
return warning;
|
|
1004
1242
|
}
|
|
1005
1243
|
warning_list.push(warning);
|
|
@@ -1033,7 +1271,7 @@ function jslint(
|
|
|
1033
1271
|
mode_json: false, // true if parsing JSON.
|
|
1034
1272
|
mode_module: false, // true if import or export was used.
|
|
1035
1273
|
mode_property: false, // true if directive /*property*/ is
|
|
1036
|
-
// used.
|
|
1274
|
+
// ... used.
|
|
1037
1275
|
mode_shebang: false, // true if #! is seen on the first line.
|
|
1038
1276
|
option_dict,
|
|
1039
1277
|
property_dict,
|
|
@@ -1103,6 +1341,7 @@ function jslint(
|
|
|
1103
1341
|
);
|
|
1104
1342
|
|
|
1105
1343
|
// PR-347 - Disable warning "missing_browser".
|
|
1344
|
+
//
|
|
1106
1345
|
// if (!option_dict.browser) {
|
|
1107
1346
|
// directive_list.forEach(function (comment) {
|
|
1108
1347
|
// if (comment.directive === "global") {
|
|
@@ -1537,6 +1776,7 @@ async function jslint_cli({
|
|
|
1537
1776
|
console_error,
|
|
1538
1777
|
console_log,
|
|
1539
1778
|
file,
|
|
1779
|
+
import_meta_url,
|
|
1540
1780
|
mode_cli,
|
|
1541
1781
|
mode_noop,
|
|
1542
1782
|
option,
|
|
@@ -1705,11 +1945,26 @@ async function jslint_cli({
|
|
|
1705
1945
|
return count;
|
|
1706
1946
|
}
|
|
1707
1947
|
|
|
1948
|
+
// PR-396 - window.jslint
|
|
1949
|
+
// Check import.meta.url for directive to export jslint to window-object.
|
|
1950
|
+
// Useful for ES5-era browser-scripts that rely on window.jslint,
|
|
1951
|
+
// like CodeMirror.
|
|
1952
|
+
//
|
|
1953
|
+
// Example usage:
|
|
1954
|
+
// <script type="module" src="./jslint.mjs?window_jslint=1"></script>
|
|
1955
|
+
|
|
1956
|
+
import_meta_url = import_meta_url || jslint_import_meta_url;
|
|
1957
|
+
if (
|
|
1958
|
+
jslint_rgx_url_search_window_jslint.test(import_meta_url)
|
|
1959
|
+
&& (typeof globalThis === "object" && globalThis)
|
|
1960
|
+
) {
|
|
1961
|
+
globalThis.jslint = jslint;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1708
1964
|
// Feature-detect nodejs.
|
|
1709
1965
|
|
|
1710
1966
|
if (!(
|
|
1711
|
-
typeof process === "object"
|
|
1712
|
-
&& process
|
|
1967
|
+
(typeof process === "object" && process)
|
|
1713
1968
|
&& process.versions
|
|
1714
1969
|
&& typeof process.versions.node === "string"
|
|
1715
1970
|
&& !mode_noop
|
|
@@ -1735,7 +1990,7 @@ async function jslint_cli({
|
|
|
1735
1990
|
).test(process_argv[1])
|
|
1736
1991
|
|| mode_cli
|
|
1737
1992
|
)
|
|
1738
|
-
&& moduleUrl.fileURLToPath(
|
|
1993
|
+
&& moduleUrl.fileURLToPath(import_meta_url)
|
|
1739
1994
|
=== modulePath.resolve(process_argv[1])
|
|
1740
1995
|
)
|
|
1741
1996
|
&& !mode_cli
|
|
@@ -1881,7 +2136,9 @@ async function jslint_cli({
|
|
|
1881
2136
|
option
|
|
1882
2137
|
});
|
|
1883
2138
|
if (mode_report) {
|
|
1884
|
-
|
|
2139
|
+
result = jslint.jslint_report(result);
|
|
2140
|
+
result = `<body class="JSLINT_ JSLINT_REPORT_">\n${result}</body>\n`;
|
|
2141
|
+
await fsWriteFileWithParents(mode_report, result);
|
|
1885
2142
|
}
|
|
1886
2143
|
process_exit(exit_code);
|
|
1887
2144
|
return exit_code;
|
|
@@ -2170,7 +2427,7 @@ function jslint_phase2_lex(state) {
|
|
|
2170
2427
|
if (!option_dict.devel && jslint_rgx_todo.test(snippet)) {
|
|
2171
2428
|
|
|
2172
2429
|
// test_cause:
|
|
2173
|
-
// ["//todo", "lex_comment", "todo_comment", "(comment)", 1] //jslint-
|
|
2430
|
+
// ["//todo", "lex_comment", "todo_comment", "(comment)", 1] //jslint-ignore-line
|
|
2174
2431
|
|
|
2175
2432
|
warn("todo_comment", the_comment);
|
|
2176
2433
|
}
|
|
@@ -2230,6 +2487,7 @@ function jslint_phase2_lex(state) {
|
|
|
2230
2487
|
global_dict[key] = "user-defined";
|
|
2231
2488
|
|
|
2232
2489
|
// PR-347 - Disable warning "unexpected_directive_a".
|
|
2490
|
+
//
|
|
2233
2491
|
// state.mode_module = the_comment;
|
|
2234
2492
|
|
|
2235
2493
|
break;
|
|
@@ -2456,6 +2714,7 @@ function jslint_phase2_lex(state) {
|
|
|
2456
2714
|
return char_after("]");
|
|
2457
2715
|
|
|
2458
2716
|
// PR-362 - Relax regexp-warning against using <space>.
|
|
2717
|
+
//
|
|
2459
2718
|
// case " ":
|
|
2460
2719
|
//
|
|
2461
2720
|
// // test_cause:
|
|
@@ -2536,6 +2795,7 @@ function jslint_phase2_lex(state) {
|
|
|
2536
2795
|
return;
|
|
2537
2796
|
|
|
2538
2797
|
// PR-362 - Relax regexp-warning against using <space>.
|
|
2798
|
+
//
|
|
2539
2799
|
// case " ":
|
|
2540
2800
|
//
|
|
2541
2801
|
// // test_cause:
|
|
@@ -3045,9 +3305,10 @@ function jslint_phase2_lex(state) {
|
|
|
3045
3305
|
case "getset": // Allow get() and set().
|
|
3046
3306
|
case "indent2": // Use 2-space indent.
|
|
3047
3307
|
case "long": // Allow long lines.
|
|
3048
|
-
case "name": // Allow weird property names.
|
|
3049
3308
|
case "node": // Assume Node.js environment.
|
|
3309
|
+
case "nomen": // Allow weird property names.
|
|
3050
3310
|
case "single": // Allow single-quote strings.
|
|
3311
|
+
case "subscript": // Allow identifier in subscript-notation.
|
|
3051
3312
|
case "test_cause": // Test jslint's causes.
|
|
3052
3313
|
case "test_internal_error": // Test jslint's internal-error
|
|
3053
3314
|
// ... handling-ability.
|
|
@@ -3060,6 +3321,16 @@ function jslint_phase2_lex(state) {
|
|
|
3060
3321
|
case "white": // Allow messy whitespace.
|
|
3061
3322
|
option_dict[key] = val;
|
|
3062
3323
|
break;
|
|
3324
|
+
|
|
3325
|
+
// PR-404 - Alias "evil" to jslint-directive "eval" for backwards-compat.
|
|
3326
|
+
|
|
3327
|
+
case "evil":
|
|
3328
|
+
return option_set_item("eval", val);
|
|
3329
|
+
|
|
3330
|
+
// PR-404 - Alias "nomen" to jslint-directive "name" for backwards-compat.
|
|
3331
|
+
|
|
3332
|
+
case "name":
|
|
3333
|
+
return option_set_item("nomen", val);
|
|
3063
3334
|
default:
|
|
3064
3335
|
return false;
|
|
3065
3336
|
}
|
|
@@ -3081,12 +3352,16 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
|
|
|
3081
3352
|
|
|
3082
3353
|
"AbortController",
|
|
3083
3354
|
// "Buffer",
|
|
3084
|
-
"
|
|
3355
|
+
// "Crypto",
|
|
3356
|
+
// "CryptoKey",
|
|
3085
3357
|
"Event",
|
|
3086
3358
|
"EventTarget",
|
|
3087
3359
|
"MessageChannel",
|
|
3088
3360
|
"MessageEvent",
|
|
3089
3361
|
"MessagePort",
|
|
3362
|
+
// "Request",
|
|
3363
|
+
// "Response",
|
|
3364
|
+
// "SubtleCrypto",
|
|
3090
3365
|
"TextDecoder",
|
|
3091
3366
|
"TextEncoder",
|
|
3092
3367
|
"URL",
|
|
@@ -3100,7 +3375,9 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
|
|
|
3100
3375
|
"clearInterval",
|
|
3101
3376
|
"clearTimeout",
|
|
3102
3377
|
// "console",
|
|
3378
|
+
// "crypto",
|
|
3103
3379
|
// "exports",
|
|
3380
|
+
// "fetch",
|
|
3104
3381
|
// "global",
|
|
3105
3382
|
// "module",
|
|
3106
3383
|
"performance",
|
|
@@ -3110,7 +3387,6 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
|
|
|
3110
3387
|
// "setImmediate",
|
|
3111
3388
|
"setInterval",
|
|
3112
3389
|
"setTimeout",
|
|
3113
|
-
"structuredClone",
|
|
3114
3390
|
|
|
3115
3391
|
// Web worker only.
|
|
3116
3392
|
// https://github.com/mdn/content/blob/main/files/en-us/web/api
|
|
@@ -3148,10 +3424,12 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
|
|
|
3148
3424
|
"location",
|
|
3149
3425
|
// "name",
|
|
3150
3426
|
"navigator",
|
|
3427
|
+
"postMessage",
|
|
3151
3428
|
// "screen",
|
|
3152
3429
|
"sessionStorage",
|
|
3153
3430
|
// "setInterval",
|
|
3154
3431
|
// "setTimeout",
|
|
3432
|
+
"structuredClone",
|
|
3155
3433
|
"window"
|
|
3156
3434
|
], "browser");
|
|
3157
3435
|
break;
|
|
@@ -3213,6 +3491,7 @@ import https from "https";
|
|
|
3213
3491
|
|
|
3214
3492
|
case "ecma":
|
|
3215
3493
|
object_assign_from_list(global_dict, [
|
|
3494
|
+
"AggregateError",
|
|
3216
3495
|
"Array",
|
|
3217
3496
|
"ArrayBuffer",
|
|
3218
3497
|
"Atomics",
|
|
@@ -3283,7 +3562,7 @@ import moduleHttps from "https";
|
|
|
3283
3562
|
let result = "";
|
|
3284
3563
|
await new Promise(function (resolve) {
|
|
3285
3564
|
moduleHttps.get((
|
|
3286
|
-
"https://raw.githubusercontent.com/nodejs/node/
|
|
3565
|
+
"https://raw.githubusercontent.com/nodejs/node/v16.x/doc/api"
|
|
3287
3566
|
+ "/globals.md"
|
|
3288
3567
|
), function (res) {
|
|
3289
3568
|
res.on("data", function (chunk) {
|
|
@@ -3306,12 +3585,16 @@ import moduleHttps from "https";
|
|
|
3306
3585
|
object_assign_from_list(global_dict, [
|
|
3307
3586
|
"AbortController",
|
|
3308
3587
|
"Buffer",
|
|
3309
|
-
"
|
|
3588
|
+
// "Crypto",
|
|
3589
|
+
// "CryptoKey",
|
|
3310
3590
|
"Event",
|
|
3311
3591
|
"EventTarget",
|
|
3312
3592
|
"MessageChannel",
|
|
3313
3593
|
"MessageEvent",
|
|
3314
3594
|
"MessagePort",
|
|
3595
|
+
// "Request",
|
|
3596
|
+
// "Response",
|
|
3597
|
+
// "SubtleCrypto",
|
|
3315
3598
|
"TextDecoder",
|
|
3316
3599
|
"TextEncoder",
|
|
3317
3600
|
"URL",
|
|
@@ -3325,7 +3608,9 @@ import moduleHttps from "https";
|
|
|
3325
3608
|
"clearInterval",
|
|
3326
3609
|
"clearTimeout",
|
|
3327
3610
|
"console",
|
|
3611
|
+
// "crypto",
|
|
3328
3612
|
"exports",
|
|
3613
|
+
// "fetch",
|
|
3329
3614
|
"global",
|
|
3330
3615
|
"module",
|
|
3331
3616
|
"performance",
|
|
@@ -3334,8 +3619,7 @@ import moduleHttps from "https";
|
|
|
3334
3619
|
"require",
|
|
3335
3620
|
"setImmediate",
|
|
3336
3621
|
"setInterval",
|
|
3337
|
-
"setTimeout"
|
|
3338
|
-
"structuredClone"
|
|
3622
|
+
"setTimeout"
|
|
3339
3623
|
], "Node.js");
|
|
3340
3624
|
break;
|
|
3341
3625
|
}
|
|
@@ -3402,7 +3686,7 @@ import moduleHttps from "https";
|
|
|
3402
3686
|
) {
|
|
3403
3687
|
|
|
3404
3688
|
// test_cause:
|
|
3405
|
-
// ["/////////////////////////////////////////////////////////////////////////////////", "read_line", "too_long", "", 1] //jslint-
|
|
3689
|
+
// ["/////////////////////////////////////////////////////////////////////////////////", "read_line", "too_long", "", 1] //jslint-ignore-line
|
|
3406
3690
|
|
|
3407
3691
|
warn_at("too_long", line);
|
|
3408
3692
|
}
|
|
@@ -3420,7 +3704,7 @@ import moduleHttps from "https";
|
|
|
3420
3704
|
// Scan each line for following ignore-directives:
|
|
3421
3705
|
// "/*jslint-disable*/"
|
|
3422
3706
|
// "/*jslint-enable*/"
|
|
3423
|
-
// "//jslint-
|
|
3707
|
+
// "//jslint-ignore-line"
|
|
3424
3708
|
|
|
3425
3709
|
if (line_source === "/*jslint-disable*/") {
|
|
3426
3710
|
|
|
@@ -3438,13 +3722,16 @@ import moduleHttps from "https";
|
|
|
3438
3722
|
stop_at("unopened_enable", line);
|
|
3439
3723
|
}
|
|
3440
3724
|
line_disable = undefined;
|
|
3441
|
-
} else if (
|
|
3725
|
+
} else if (
|
|
3726
|
+
line_source.endsWith(" //jslint-ignore-line")
|
|
3727
|
+
|| line_source.endsWith(" //jslint-quiet")
|
|
3728
|
+
) {
|
|
3442
3729
|
|
|
3443
3730
|
// test_cause:
|
|
3444
|
-
// ["0 //jslint-
|
|
3731
|
+
// ["0 //jslint-ignore-line", "read_line", "jslint_ignore_line", "", 0]
|
|
3445
3732
|
|
|
3446
|
-
test_cause("
|
|
3447
|
-
line_list[line].
|
|
3733
|
+
test_cause("jslint_ignore_line");
|
|
3734
|
+
line_list[line].directive_ignore_line = true;
|
|
3448
3735
|
}
|
|
3449
3736
|
if (line_disable !== undefined) {
|
|
3450
3737
|
|
|
@@ -4244,6 +4531,8 @@ function jslint_phase3_parse(state) {
|
|
|
4244
4531
|
left.id !== "["
|
|
4245
4532
|
|| (
|
|
4246
4533
|
name.id !== "concat"
|
|
4534
|
+
&& name.id !== "flat"
|
|
4535
|
+
&& name.id !== "flatMap"
|
|
4247
4536
|
&& name.id !== "forEach"
|
|
4248
4537
|
&& name.id !== "join"
|
|
4249
4538
|
&& name.id !== "map"
|
|
@@ -4303,7 +4592,10 @@ function jslint_phase3_parse(state) {
|
|
|
4303
4592
|
let the_subscript = parse_expression(0);
|
|
4304
4593
|
if (the_subscript.id === "(string)" || the_subscript.id === "`") {
|
|
4305
4594
|
name = survey(the_subscript);
|
|
4306
|
-
|
|
4595
|
+
|
|
4596
|
+
// PR-404 - Add new directive "subscript" to play nice with Google Closure.
|
|
4597
|
+
|
|
4598
|
+
if (!option_dict.subscript && jslint_rgx_identifier.test(name)) {
|
|
4307
4599
|
|
|
4308
4600
|
// test_cause:
|
|
4309
4601
|
// ["aa[`aa`]", "infix_lbracket", "subscript_a", "aa", 4]
|
|
@@ -5032,10 +5324,13 @@ function jslint_phase3_parse(state) {
|
|
|
5032
5324
|
functionage.async += 1;
|
|
5033
5325
|
}
|
|
5034
5326
|
if (the_await.arity === "statement") {
|
|
5035
|
-
|
|
5327
|
+
|
|
5328
|
+
// PR-405 - Bugfix - fix expression after "await" mis-identified as statement.
|
|
5329
|
+
|
|
5330
|
+
the_await.expression = parse_expression(150);
|
|
5036
5331
|
semicolon();
|
|
5037
5332
|
} else {
|
|
5038
|
-
the_await.expression = parse_expression();
|
|
5333
|
+
the_await.expression = parse_expression(150);
|
|
5039
5334
|
}
|
|
5040
5335
|
return the_await;
|
|
5041
5336
|
}
|
|
@@ -6101,6 +6396,7 @@ function jslint_phase3_parse(state) {
|
|
|
6101
6396
|
let names;
|
|
6102
6397
|
|
|
6103
6398
|
// PR-347 - Disable warning "unexpected_directive_a".
|
|
6399
|
+
//
|
|
6104
6400
|
// if (typeof state.mode_module === "object") {
|
|
6105
6401
|
//
|
|
6106
6402
|
// // test_cause:
|
|
@@ -6458,12 +6754,16 @@ function jslint_phase3_parse(state) {
|
|
|
6458
6754
|
// Restore previous catch-scope after catch-block.
|
|
6459
6755
|
|
|
6460
6756
|
catchage = catch_stack.pop();
|
|
6461
|
-
} else {
|
|
6462
6757
|
|
|
6463
|
-
//
|
|
6464
|
-
//
|
|
6758
|
+
// PR-404 - Relax warning about missing `catch` in `try...finally` statement.
|
|
6759
|
+
//
|
|
6760
|
+
// } else {
|
|
6761
|
+
//
|
|
6762
|
+
// // test_cause:
|
|
6763
|
+
// // ["try{}finally{break;}", "stmt_try", "expected_a_before_b", "finally", 6]
|
|
6764
|
+
//
|
|
6765
|
+
// warn("expected_a_before_b", token_nxt, "catch", artifact());
|
|
6465
6766
|
|
|
6466
|
-
warn("expected_a_before_b", token_nxt, "catch", artifact());
|
|
6467
6767
|
}
|
|
6468
6768
|
if (token_nxt.id === "finally") {
|
|
6469
6769
|
functionage.finally += 1;
|
|
@@ -6584,12 +6884,14 @@ function jslint_phase3_parse(state) {
|
|
|
6584
6884
|
return stop("expected_identifier_a");
|
|
6585
6885
|
}
|
|
6586
6886
|
|
|
6587
|
-
// PR-363 - Bugfix
|
|
6588
|
-
// <uninitialized 'bb'> in code
|
|
6887
|
+
// PR-363 - Bugfix
|
|
6888
|
+
// Add test against false-warning <uninitialized 'bb'> in code
|
|
6889
|
+
// '/*jslint node*/\nlet {aa:bb} = {}; bb();'.
|
|
6890
|
+
//
|
|
6891
|
+
// token_nxt.label = name;
|
|
6892
|
+
// the_variable.names.push(token_nxt);
|
|
6893
|
+
// enroll(token_nxt, "variable", mode_const);
|
|
6589
6894
|
|
|
6590
|
-
// token_nxt.label = name;
|
|
6591
|
-
// the_variable.names.push(token_nxt);
|
|
6592
|
-
// enroll(token_nxt, "variable", mode_const);
|
|
6593
6895
|
name = token_nxt;
|
|
6594
6896
|
the_variable.names.push(name);
|
|
6595
6897
|
survey(name);
|
|
@@ -6812,7 +7114,7 @@ function jslint_phase3_parse(state) {
|
|
|
6812
7114
|
warn("unregistered_property_a", name);
|
|
6813
7115
|
}
|
|
6814
7116
|
} else if (
|
|
6815
|
-
!option_dict.
|
|
7117
|
+
!option_dict.nomen
|
|
6816
7118
|
&& name.identifier
|
|
6817
7119
|
&& jslint_rgx_weird_property.test(id)
|
|
6818
7120
|
) {
|
|
@@ -8225,9 +8527,6 @@ function jslint_phase4_walk(state) {
|
|
|
8225
8527
|
// ["+[]", "walk_statement", "unexpected_expression_a", "+", 1]
|
|
8226
8528
|
// ["+new aa()", "walk_statement", "unexpected_expression_a", "+", 1]
|
|
8227
8529
|
// ["0", "walk_statement", "unexpected_expression_a", "0", 1]
|
|
8228
|
-
// ["
|
|
8229
|
-
// async function aa(){await 0;}
|
|
8230
|
-
// ", "walk_statement", "unexpected_expression_a", "0", 27]
|
|
8231
8530
|
// ["typeof 0", "walk_statement", "unexpected_expression_a", "typeof", 1]
|
|
8232
8531
|
|
|
8233
8532
|
warn("unexpected_expression_a", thing);
|
|
@@ -8969,6 +9268,7 @@ function jslint_report({
|
|
|
8969
9268
|
|
|
8970
9269
|
// This function will create human-readable, html-report
|
|
8971
9270
|
// for warnings, properties, and functions from jslint-result-object.
|
|
9271
|
+
//
|
|
8972
9272
|
// Example usage:
|
|
8973
9273
|
// let result = jslint("console.log('hello world')");
|
|
8974
9274
|
// let html = jslint_report(result);
|
|
@@ -9001,7 +9301,6 @@ function jslint_report({
|
|
|
9001
9301
|
);
|
|
9002
9302
|
}
|
|
9003
9303
|
|
|
9004
|
-
html += "<div class=\"JSLINT_\" id=\"JSLINT_REPORT_HTML\">\n";
|
|
9005
9304
|
html += String(`
|
|
9006
9305
|
<style class="JSLINT_REPORT_STYLE">
|
|
9007
9306
|
/* jslint utility2:true */
|
|
@@ -9150,19 +9449,38 @@ pyNj+JctcQLXenBOCms46aMkenIx45WpXqxxVJQLz/vgpmAVa0fmDv6Pue9xVTBPfVxCUGfj\
|
|
|
9150
9449
|
/7xoEqvL+2E8VOyCTuT/7j269Zy4jUtN+g4="
|
|
9151
9450
|
) format("woff2");
|
|
9152
9451
|
}
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9452
|
+
.JSLINT_,
|
|
9453
|
+
.JSLINT_ address,
|
|
9454
|
+
.JSLINT_ button,
|
|
9455
|
+
.JSLINT_ cite,
|
|
9456
|
+
.JSLINT_ dd,
|
|
9457
|
+
.JSLINT_ dfn,
|
|
9458
|
+
.JSLINT_ dl,
|
|
9459
|
+
.JSLINT_ dt,
|
|
9460
|
+
.JSLINT_ fieldset,
|
|
9461
|
+
.JSLINT_ fieldset > div,
|
|
9462
|
+
.JSLINT_ input,
|
|
9463
|
+
.JSLINT_ label,
|
|
9464
|
+
.JSLINT_ legend,
|
|
9465
|
+
.JSLINT_ ol,
|
|
9466
|
+
.JSLINT_ samp,
|
|
9467
|
+
.JSLINT_ style,
|
|
9468
|
+
.JSLINT_ textarea,
|
|
9469
|
+
.JSLINT_ ul {
|
|
9156
9470
|
border: 0;
|
|
9157
9471
|
box-sizing: border-box;
|
|
9158
9472
|
margin: 0;
|
|
9159
9473
|
padding: 0;
|
|
9160
9474
|
}
|
|
9475
|
+
/* disable text inflation algorithm used on some smartphones and tablets */
|
|
9161
9476
|
.JSLINT_ {
|
|
9162
9477
|
-ms-text-size-adjust: none;
|
|
9163
9478
|
-webkit-text-size-adjust: none;
|
|
9164
9479
|
text-size-adjust: none;
|
|
9165
9480
|
}
|
|
9481
|
+
.JSLINT_REPORT_ div {
|
|
9482
|
+
box-sizing: border-box;
|
|
9483
|
+
}
|
|
9166
9484
|
/*csslint ignore:end*/
|
|
9167
9485
|
|
|
9168
9486
|
/* css - jslint_report - font */
|
|
@@ -9196,7 +9514,7 @@ pyNj+JctcQLXenBOCms46aMkenIx45WpXqxxVJQLz/vgpmAVa0fmDv6Pue9xVTBPfVxCUGfj\
|
|
|
9196
9514
|
}
|
|
9197
9515
|
|
|
9198
9516
|
/* css - jslint_report - general */
|
|
9199
|
-
|
|
9517
|
+
.JSLINT_ {
|
|
9200
9518
|
background: antiquewhite;
|
|
9201
9519
|
}
|
|
9202
9520
|
.JSLINT_ fieldset {
|
|
@@ -9533,7 +9851,6 @@ body {
|
|
|
9533
9851
|
});
|
|
9534
9852
|
html += "</div>\n";
|
|
9535
9853
|
html += "</fieldset>\n";
|
|
9536
|
-
html += "</div>\n";
|
|
9537
9854
|
return html;
|
|
9538
9855
|
}
|
|
9539
9856
|
|
|
@@ -9544,6 +9861,7 @@ async function jstestDescribe(description, testFunction) {
|
|
|
9544
9861
|
|
|
9545
9862
|
let message;
|
|
9546
9863
|
let result;
|
|
9864
|
+
let timerTimeout;
|
|
9547
9865
|
|
|
9548
9866
|
// Init jstestTimeStart.
|
|
9549
9867
|
|
|
@@ -9559,7 +9877,9 @@ async function jstestDescribe(description, testFunction) {
|
|
|
9559
9877
|
|
|
9560
9878
|
// Wait for jstestItList to resolve.
|
|
9561
9879
|
|
|
9880
|
+
timerTimeout = setTimeout(noop, 0x7fffffff);
|
|
9562
9881
|
result = await Promise.all(jstestItList);
|
|
9882
|
+
clearTimeout(timerTimeout);
|
|
9563
9883
|
|
|
9564
9884
|
// Print test results.
|
|
9565
9885
|
|
|
@@ -9925,7 +10245,7 @@ function v8CoverageListMerge(processCovs) {
|
|
|
9925
10245
|
let resultTree;
|
|
9926
10246
|
let rightChildren;
|
|
9927
10247
|
|
|
9928
|
-
// TODO(perf): Binary search (check overhead) //jslint-
|
|
10248
|
+
// TODO(perf): Binary search (check overhead) //jslint-ignore-line
|
|
9929
10249
|
|
|
9930
10250
|
while (ii < tree.children.length) {
|
|
9931
10251
|
child = tree.children[ii];
|
|
@@ -10003,7 +10323,7 @@ function v8CoverageListMerge(processCovs) {
|
|
|
10003
10323
|
|
|
10004
10324
|
// This function will normalize-and-sort <funcCov>.ranges.
|
|
10005
10325
|
// Sorts the ranges (pre-order sort).
|
|
10006
|
-
// TODO: Tree-based normalization of the ranges. //jslint-
|
|
10326
|
+
// TODO: Tree-based normalization of the ranges. //jslint-ignore-line
|
|
10007
10327
|
// @param funcCov Function coverage to normalize.
|
|
10008
10328
|
|
|
10009
10329
|
funcCov.ranges = treeToRanges(treeFromSortedRanges(
|
|
@@ -10349,11 +10669,11 @@ async function v8CoverageReportCreate({
|
|
|
10349
10669
|
// 3. Create html-coverage-reports in <coverageDir>.
|
|
10350
10670
|
|
|
10351
10671
|
let cwd;
|
|
10672
|
+
let excludeList = [];
|
|
10352
10673
|
let exitCode = 0;
|
|
10353
10674
|
let fileDict;
|
|
10354
|
-
let
|
|
10355
|
-
let
|
|
10356
|
-
let fileIncludeNodeModules;
|
|
10675
|
+
let includeList = [];
|
|
10676
|
+
let modeIncludeNodeModules;
|
|
10357
10677
|
let processArgElem;
|
|
10358
10678
|
let promiseList = [];
|
|
10359
10679
|
let v8CoverageObj;
|
|
@@ -10378,9 +10698,19 @@ async function v8CoverageReportCreate({
|
|
|
10378
10698
|
<style>
|
|
10379
10699
|
/* jslint utility2:true */
|
|
10380
10700
|
/*csslint ignore:start*/
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10701
|
+
.coverage,
|
|
10702
|
+
.coverage a,
|
|
10703
|
+
.coverage div,
|
|
10704
|
+
.coverage pre,
|
|
10705
|
+
.coverage span,
|
|
10706
|
+
.coverage table,
|
|
10707
|
+
.coverage tbody,
|
|
10708
|
+
.coverage td,
|
|
10709
|
+
.coverage th,
|
|
10710
|
+
.coverage thead,
|
|
10711
|
+
.coverage tr {
|
|
10712
|
+
box-sizing: border-box;
|
|
10713
|
+
font-family: monospace;
|
|
10384
10714
|
}
|
|
10385
10715
|
/*csslint ignore:end*/
|
|
10386
10716
|
|
|
@@ -10526,6 +10856,7 @@ body {
|
|
|
10526
10856
|
}
|
|
10527
10857
|
txtBorder = (
|
|
10528
10858
|
"+" + "-".repeat(padPathname + 2) + "+"
|
|
10859
|
+
+ "-".repeat(padLines + 2) + "+"
|
|
10529
10860
|
+ "-".repeat(padLines + 2) + "+\n"
|
|
10530
10861
|
);
|
|
10531
10862
|
txt = "";
|
|
@@ -10533,7 +10864,8 @@ body {
|
|
|
10533
10864
|
txt += txtBorder;
|
|
10534
10865
|
txt += (
|
|
10535
10866
|
"| " + String("Files covered").padEnd(padPathname, " ") + " | "
|
|
10536
|
-
+ String("Lines").padStart(padLines, " ") + "
|
|
10867
|
+
+ String("Lines").padStart(padLines, " ") + " | "
|
|
10868
|
+
+ String("Remaining").padStart(padLines, " ") + " |\n"
|
|
10537
10869
|
);
|
|
10538
10870
|
txt += txtBorder;
|
|
10539
10871
|
fileList.forEach(function ({
|
|
@@ -10613,7 +10945,8 @@ body {
|
|
|
10613
10945
|
+ String("./" + pathname).padEnd(padPathname, " ") + " | "
|
|
10614
10946
|
+ String(
|
|
10615
10947
|
modeCoverageIgnoreFile + " " + coveragePct + " %"
|
|
10616
|
-
).padStart(padLines, " ") + "
|
|
10948
|
+
).padStart(padLines, " ") + " | "
|
|
10949
|
+
+ " ".repeat(padLines) + " |\n"
|
|
10617
10950
|
);
|
|
10618
10951
|
txt += (
|
|
10619
10952
|
"| " + "*".repeat(
|
|
@@ -10621,6 +10954,9 @@ body {
|
|
|
10621
10954
|
).padEnd(padPathname, "_") + " | "
|
|
10622
10955
|
+ String(
|
|
10623
10956
|
linesCovered + " / " + linesTotal
|
|
10957
|
+
).padStart(padLines, " ") + " | "
|
|
10958
|
+
+ String(
|
|
10959
|
+
(linesTotal - linesCovered) + " / " + linesTotal
|
|
10624
10960
|
).padStart(padLines, " ") + " |\n"
|
|
10625
10961
|
);
|
|
10626
10962
|
txt += txtBorder;
|
|
@@ -10784,21 +11120,6 @@ ${String(count || "-0").padStart(7, " ")}
|
|
|
10784
11120
|
), txt));
|
|
10785
11121
|
}
|
|
10786
11122
|
|
|
10787
|
-
function pathnameRelativeCwd(pathname) {
|
|
10788
|
-
|
|
10789
|
-
// This function will if <pathname> is inside <cwd>,
|
|
10790
|
-
// return it relative to <cwd>, else empty-string.
|
|
10791
|
-
|
|
10792
|
-
pathname = modulePath.resolve(pathname).replace((
|
|
10793
|
-
/\\/g
|
|
10794
|
-
), "/");
|
|
10795
|
-
if (!pathname.startsWith(cwd)) {
|
|
10796
|
-
return;
|
|
10797
|
-
}
|
|
10798
|
-
pathname = pathname.slice(cwd.length);
|
|
10799
|
-
return pathname;
|
|
10800
|
-
}
|
|
10801
|
-
|
|
10802
11123
|
/*
|
|
10803
11124
|
function sentinel() {}
|
|
10804
11125
|
*/
|
|
@@ -10830,28 +11151,26 @@ function sentinel() {}
|
|
|
10830
11151
|
processArgElem[1] = processArgElem.slice(1).join("=");
|
|
10831
11152
|
switch (processArgElem[0]) {
|
|
10832
11153
|
|
|
10833
|
-
// PR-371 -
|
|
11154
|
+
// PR-371 - Add cli-option `--exclude=...`.
|
|
10834
11155
|
|
|
10835
11156
|
case "--exclude":
|
|
10836
|
-
|
|
10837
|
-
processArgElem[1].split(",")
|
|
10838
|
-
);
|
|
11157
|
+
excludeList.push(processArgElem[1]);
|
|
10839
11158
|
break;
|
|
10840
11159
|
|
|
10841
|
-
// PR-371 -
|
|
11160
|
+
// PR-371 - Add cli-option `--include=...`
|
|
10842
11161
|
|
|
10843
|
-
case "--
|
|
10844
|
-
|
|
10845
|
-
/0|false|null|undefined/
|
|
10846
|
-
).test(processArgElem[1]);
|
|
11162
|
+
case "--include":
|
|
11163
|
+
includeList.push(processArgElem[1]);
|
|
10847
11164
|
break;
|
|
10848
11165
|
|
|
10849
|
-
// PR-
|
|
11166
|
+
// PR-400
|
|
11167
|
+
// Disable default-coverage of directory `node_modules`,
|
|
11168
|
+
// but allow override with cli-option `--include-node-modules=1`.
|
|
10850
11169
|
|
|
10851
|
-
case "--include":
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
);
|
|
11170
|
+
case "--include-node-modules":
|
|
11171
|
+
modeIncludeNodeModules = !(
|
|
11172
|
+
/0|false|null|undefined/
|
|
11173
|
+
).test(processArgElem[1]);
|
|
10855
11174
|
break;
|
|
10856
11175
|
}
|
|
10857
11176
|
}
|
|
@@ -10905,9 +11224,11 @@ function sentinel() {}
|
|
|
10905
11224
|
).test(file);
|
|
10906
11225
|
});
|
|
10907
11226
|
v8CoverageObj = await Promise.all(v8CoverageObj.map(async function (file) {
|
|
10908
|
-
let data
|
|
11227
|
+
let data;
|
|
11228
|
+
let pathnameDict = Object.create(null);
|
|
11229
|
+
data = await moduleFs.promises.readFile(coverageDir + file, "utf8");
|
|
10909
11230
|
data = JSON.parse(data);
|
|
10910
|
-
data.result
|
|
11231
|
+
data.result.forEach(function (scriptCov) {
|
|
10911
11232
|
let pathname = scriptCov.url;
|
|
10912
11233
|
|
|
10913
11234
|
// Filter out internal coverages.
|
|
@@ -10918,38 +11239,38 @@ function sentinel() {}
|
|
|
10918
11239
|
|
|
10919
11240
|
// Normalize pathname.
|
|
10920
11241
|
|
|
10921
|
-
pathname =
|
|
10922
|
-
|
|
11242
|
+
pathname = moduleUrl.fileURLToPath(pathname);
|
|
11243
|
+
pathname = modulePath.resolve(pathname).replace((
|
|
11244
|
+
/\\/g
|
|
11245
|
+
), "/");
|
|
10923
11246
|
|
|
10924
11247
|
// Filter files outside of cwd.
|
|
10925
11248
|
|
|
10926
|
-
|
|
10927
|
-
|
|
11249
|
+
if (pathname.indexOf("[") >= 0 || !pathname.startsWith(cwd)) {
|
|
11250
|
+
return;
|
|
11251
|
+
}
|
|
10928
11252
|
|
|
10929
|
-
//
|
|
11253
|
+
// Normalize pathname relative to cwd.
|
|
10930
11254
|
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
).test(pathname)
|
|
10936
|
-
)
|
|
11255
|
+
pathname = pathname.slice(cwd.length);
|
|
11256
|
+
scriptCov.url = pathname;
|
|
11257
|
+
pathnameDict[pathname] = scriptCov;
|
|
11258
|
+
});
|
|
10937
11259
|
|
|
10938
|
-
// PR-
|
|
11260
|
+
// PR-400 - Filter directory `node_modules`.
|
|
10939
11261
|
|
|
10940
|
-
|
|
11262
|
+
if (!modeIncludeNodeModules) {
|
|
11263
|
+
excludeList.push("node_modules/");
|
|
11264
|
+
}
|
|
10941
11265
|
|
|
10942
|
-
// PR-
|
|
11266
|
+
// PR-400 - Filter files by glob-patterns in excludeList, includeList.
|
|
10943
11267
|
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
}
|
|
10951
|
-
scriptCov.url = pathname;
|
|
10952
|
-
return true;
|
|
11268
|
+
data.result = globExclude({
|
|
11269
|
+
excludeList,
|
|
11270
|
+
includeList,
|
|
11271
|
+
pathnameList: Object.keys(pathnameDict)
|
|
11272
|
+
}).pathnameList.map(function (pathname) {
|
|
11273
|
+
return pathnameDict[pathname];
|
|
10953
11274
|
});
|
|
10954
11275
|
return data;
|
|
10955
11276
|
}));
|
|
@@ -10958,7 +11279,7 @@ function sentinel() {}
|
|
|
10958
11279
|
|
|
10959
11280
|
v8CoverageObj = v8CoverageListMerge(v8CoverageObj);
|
|
10960
11281
|
|
|
10961
|
-
//
|
|
11282
|
+
// Debug v8CoverageObj.
|
|
10962
11283
|
|
|
10963
11284
|
await fsWriteFileWithParents(
|
|
10964
11285
|
coverageDir + "v8_coverage_merged.json",
|
|
@@ -11098,6 +11419,7 @@ jslint_export = Object.freeze(Object.assign(jslint, {
|
|
|
11098
11419
|
assertOrThrow,
|
|
11099
11420
|
debugInline,
|
|
11100
11421
|
fsWriteFileWithParents,
|
|
11422
|
+
globExclude,
|
|
11101
11423
|
htmlEscape,
|
|
11102
11424
|
jslint,
|
|
11103
11425
|
jslint_apidoc,
|