@jslint-org/jslint 2022.7.20 → 2022.11.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/CHANGELOG.md +9 -1
- package/README.md +27 -15
- package/asset_codemirror_rollup.js +97 -86
- package/jslint.mjs +177 -142
- package/package.json +2 -2
package/jslint.mjs
CHANGED
|
@@ -103,14 +103,14 @@
|
|
|
103
103
|
delta, devel, directive, directive_ignore_line, directive_list, directives,
|
|
104
104
|
dirname, disrupt, dot, edition, elem_list, ellipsis, else, end, endOffset,
|
|
105
105
|
endsWith, entries, env, error, eval, every, example_list, excludeList, exec,
|
|
106
|
-
execArgv, exit, exitCode, export_dict, exports, expression, extra,
|
|
107
|
-
fileList, fileURLToPath, filter, finally, flag, floor, for, forEach,
|
|
106
|
+
execArgv, exit, exitCode, export_dict, exports, expression, extra, fart,
|
|
107
|
+
file, 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
110
|
getset, github_repo, globExclude, global, global_dict, global_list,
|
|
111
111
|
holeList, htmlEscape, id, identifier, import, import_list, import_meta_url,
|
|
112
112
|
inc, includeList, indent2, index, indexOf, init, initial, isArray,
|
|
113
|
-
isBlockCoverage, isHole, isNaN, is_equal,
|
|
113
|
+
isBlockCoverage, isHole, isNaN, is_equal, is_weird, join, jslint,
|
|
114
114
|
jslint_apidoc, jslint_assert, jslint_charset_ascii, jslint_cli,
|
|
115
115
|
jslint_edition, jslint_phase1_split, jslint_phase2_lex, jslint_phase3_parse,
|
|
116
116
|
jslint_phase4_walk, jslint_phase5_whitage, jslint_report, json,
|
|
@@ -165,7 +165,7 @@ let jslint_charset_ascii = (
|
|
|
165
165
|
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
|
166
166
|
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
|
|
167
167
|
);
|
|
168
|
-
let jslint_edition = "v2022.
|
|
168
|
+
let jslint_edition = "v2022.11.20";
|
|
169
169
|
let jslint_export; // The jslint object to be exported.
|
|
170
170
|
let jslint_fudge = 1; // Fudge starting line and starting
|
|
171
171
|
// ... column to 1.
|
|
@@ -2038,13 +2038,6 @@ async function jslint_cli({
|
|
|
2038
2038
|
return;
|
|
2039
2039
|
}
|
|
2040
2040
|
|
|
2041
|
-
// PR-349 - Detect cli-option --mode-vim-plugin.
|
|
2042
|
-
|
|
2043
|
-
mode_wrapper_vim = (
|
|
2044
|
-
process_argv.slice(2).indexOf("--mode-vim-plugin") >= 0
|
|
2045
|
-
|| mode_wrapper_vim
|
|
2046
|
-
);
|
|
2047
|
-
|
|
2048
2041
|
// Normalize file relative to process.cwd().
|
|
2049
2042
|
|
|
2050
2043
|
process_argv.slice(2).some(function (arg) {
|
|
@@ -3294,19 +3287,20 @@ function jslint_phase2_lex(state) {
|
|
|
3294
3287
|
|
|
3295
3288
|
switch (key) {
|
|
3296
3289
|
case "beta": // Enable experimental warnings.
|
|
3297
|
-
case "bitwise": // Allow bitwise
|
|
3290
|
+
case "bitwise": // Allow bitwise operator.
|
|
3298
3291
|
case "browser": // Assume browser environment.
|
|
3299
|
-
case "convert": // Allow conversion
|
|
3292
|
+
case "convert": // Allow conversion operator.
|
|
3300
3293
|
case "couch": // Assume CouchDb environment.
|
|
3301
3294
|
case "devel": // Allow console.log() and friends.
|
|
3302
3295
|
case "ecma": // Assume ECMAScript environment.
|
|
3303
3296
|
case "eval": // Allow eval().
|
|
3297
|
+
case "fart": // Allow complex fat-arrow.
|
|
3304
3298
|
case "for": // Allow for-statement.
|
|
3305
3299
|
case "getset": // Allow get() and set().
|
|
3306
3300
|
case "indent2": // Use 2-space indent.
|
|
3307
3301
|
case "long": // Allow long lines.
|
|
3308
3302
|
case "node": // Assume Node.js environment.
|
|
3309
|
-
case "nomen": // Allow weird property
|
|
3303
|
+
case "nomen": // Allow weird property name.
|
|
3310
3304
|
case "single": // Allow single-quote strings.
|
|
3311
3305
|
case "subscript": // Allow identifier in subscript-notation.
|
|
3312
3306
|
case "test_cause": // Test jslint's causes.
|
|
@@ -3770,7 +3764,6 @@ import moduleHttps from "https";
|
|
|
3770
3764
|
from,
|
|
3771
3765
|
id,
|
|
3772
3766
|
identifier: Boolean(identifier),
|
|
3773
|
-
is_fart: false,
|
|
3774
3767
|
line,
|
|
3775
3768
|
nr: token_list.length,
|
|
3776
3769
|
thru: column,
|
|
@@ -3835,7 +3828,7 @@ import moduleHttps from "https";
|
|
|
3835
3828
|
token_prv_expr.id === ")"
|
|
3836
3829
|
&& paren_backtrack_list[paren_depth]
|
|
3837
3830
|
) {
|
|
3838
|
-
paren_backtrack_list[paren_depth].
|
|
3831
|
+
paren_backtrack_list[paren_depth].fart = the_token;
|
|
3839
3832
|
}
|
|
3840
3833
|
break;
|
|
3841
3834
|
}
|
|
@@ -3936,7 +3929,11 @@ function jslint_phase3_parse(state) {
|
|
|
3936
3929
|
|
|
3937
3930
|
// Attempt to give helpful names to anonymous functions.
|
|
3938
3931
|
|
|
3939
|
-
if (
|
|
3932
|
+
if (
|
|
3933
|
+
token_now.identifier
|
|
3934
|
+
&& token_now.id !== "function"
|
|
3935
|
+
&& token_now.id !== "async"
|
|
3936
|
+
) {
|
|
3940
3937
|
anon = token_now.id;
|
|
3941
3938
|
} else if (
|
|
3942
3939
|
token_now.id === "(string)"
|
|
@@ -4869,17 +4866,21 @@ function jslint_phase3_parse(state) {
|
|
|
4869
4866
|
return left;
|
|
4870
4867
|
}
|
|
4871
4868
|
|
|
4872
|
-
function parse_fart() {
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4869
|
+
function parse_fart(the_fart) {
|
|
4870
|
+
|
|
4871
|
+
// Give the function properties storing its names and for observing the depth
|
|
4872
|
+
// of loops and switches.
|
|
4873
|
+
|
|
4874
|
+
Object.assign(the_fart, {
|
|
4875
|
+
arity: "binary",
|
|
4876
|
+
context: empty(),
|
|
4877
|
+
finally: 0,
|
|
4878
|
+
level: functionage.level + 1,
|
|
4879
|
+
loop: 0,
|
|
4880
|
+
name: anon,
|
|
4881
|
+
switch: 0,
|
|
4882
|
+
try: 0
|
|
4883
|
+
});
|
|
4883
4884
|
|
|
4884
4885
|
// PR-384 - Relax warning "function_in_loop".
|
|
4885
4886
|
//
|
|
@@ -4891,45 +4892,27 @@ function jslint_phase3_parse(state) {
|
|
|
4891
4892
|
// warn("function_in_loop", the_fart);
|
|
4892
4893
|
// }
|
|
4893
4894
|
|
|
4894
|
-
// Give the function properties storing its names and for observing the depth
|
|
4895
|
-
// of loops and switches.
|
|
4896
|
-
|
|
4897
|
-
the_fart.context = empty();
|
|
4898
|
-
the_fart.finally = 0;
|
|
4899
|
-
the_fart.loop = 0;
|
|
4900
|
-
the_fart.parameters = parameters;
|
|
4901
|
-
the_fart.signature = signature;
|
|
4902
|
-
the_fart.switch = 0;
|
|
4903
|
-
the_fart.try = 0;
|
|
4904
|
-
|
|
4905
4895
|
// Push the current function context and establish a new one.
|
|
4906
4896
|
|
|
4897
|
+
function_list.push(the_fart);
|
|
4907
4898
|
function_stack.push(functionage);
|
|
4908
4899
|
functionage = the_fart;
|
|
4909
|
-
the_fart.parameters.forEach(function enroll_parameter(name) {
|
|
4910
|
-
if (name.identifier) {
|
|
4911
|
-
enroll(name, "parameter", true);
|
|
4912
|
-
} else {
|
|
4913
|
-
|
|
4914
|
-
// PR-385 - Bugfix - Fixes issue #382 - fix warnings against destructured fart.
|
|
4915
4900
|
|
|
4916
|
-
//
|
|
4917
|
-
// ["([aa])=>0", "enroll_parameter", "use_function_not_fart", "=>", 7]
|
|
4918
|
-
// ["({aa})=>0", "enroll_parameter", "use_function_not_fart", "=>", 7]
|
|
4901
|
+
// Parse the parameter list.
|
|
4919
4902
|
|
|
4920
|
-
|
|
4903
|
+
prefix_function_parameter(the_fart);
|
|
4904
|
+
advance("=>");
|
|
4921
4905
|
|
|
4922
|
-
//
|
|
4906
|
+
// The function's body is a block.
|
|
4923
4907
|
|
|
4924
|
-
name.names.forEach(enroll_parameter);
|
|
4925
|
-
}
|
|
4926
|
-
});
|
|
4927
4908
|
if (token_nxt.id === "{") {
|
|
4909
|
+
if (!option_dict.fart) {
|
|
4928
4910
|
|
|
4929
4911
|
// test_cause:
|
|
4930
4912
|
// ["()=>{}", "parse_fart", "use_function_not_fart", "=>", 3]
|
|
4931
4913
|
|
|
4932
|
-
|
|
4914
|
+
warn("use_function_not_fart", the_fart);
|
|
4915
|
+
}
|
|
4933
4916
|
the_fart.block = block("body");
|
|
4934
4917
|
} else if (
|
|
4935
4918
|
syntax_dict[token_nxt.id] !== undefined
|
|
@@ -4942,9 +4925,15 @@ function jslint_phase3_parse(state) {
|
|
|
4942
4925
|
// ["()=>delete aa", "parse_fart", "unexpected_a_after_b", "=>", 5]
|
|
4943
4926
|
|
|
4944
4927
|
stop("unexpected_a_after_b", token_nxt, token_nxt.id, "=>");
|
|
4928
|
+
|
|
4929
|
+
// The function's body is an expression.
|
|
4930
|
+
|
|
4945
4931
|
} else {
|
|
4946
4932
|
the_fart.expression = parse_expression(0);
|
|
4947
4933
|
}
|
|
4934
|
+
|
|
4935
|
+
// Restore the previous context.
|
|
4936
|
+
|
|
4948
4937
|
functionage = function_stack.pop();
|
|
4949
4938
|
return the_fart;
|
|
4950
4939
|
}
|
|
@@ -5287,15 +5276,35 @@ function jslint_phase3_parse(state) {
|
|
|
5287
5276
|
}
|
|
5288
5277
|
|
|
5289
5278
|
function prefix_async() {
|
|
5290
|
-
let the_async;
|
|
5279
|
+
let the_async = token_now;
|
|
5291
5280
|
let the_function;
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5281
|
+
token_nxt.arity = the_async.arity;
|
|
5282
|
+
|
|
5283
|
+
// PR-414 - Parse async fart.
|
|
5284
|
+
|
|
5285
|
+
if (token_nxt.fart) {
|
|
5286
|
+
advance("(");
|
|
5287
|
+
the_function = Object.assign(token_now.fart, {
|
|
5288
|
+
async: 1
|
|
5289
|
+
});
|
|
5290
|
+
if (!option_dict.fart) {
|
|
5291
|
+
|
|
5292
|
+
// test_cause:
|
|
5293
|
+
// ["async()=>0", "prefix_async", "use_function_not_fart", "=>", 8]
|
|
5294
|
+
|
|
5295
|
+
warn("use_function_not_fart", the_function);
|
|
5296
|
+
}
|
|
5297
|
+
prefix_lparen();
|
|
5298
|
+
|
|
5299
|
+
// Parse async function.
|
|
5300
|
+
|
|
5301
|
+
} else {
|
|
5302
|
+
advance("function");
|
|
5303
|
+
the_function = Object.assign(token_now, {
|
|
5304
|
+
async: 1
|
|
5305
|
+
});
|
|
5306
|
+
prefix_function();
|
|
5307
|
+
}
|
|
5299
5308
|
if (the_function.async === 1) {
|
|
5300
5309
|
|
|
5301
5310
|
// test_cause:
|
|
@@ -5382,7 +5391,6 @@ function jslint_phase3_parse(state) {
|
|
|
5382
5391
|
}
|
|
5383
5392
|
}
|
|
5384
5393
|
}
|
|
5385
|
-
the_function.level = functionage.level + 1;
|
|
5386
5394
|
|
|
5387
5395
|
// Probably deadcode.
|
|
5388
5396
|
// if (mode_mega) {
|
|
@@ -5412,6 +5420,7 @@ function jslint_phase3_parse(state) {
|
|
|
5412
5420
|
async: the_function.async || 0,
|
|
5413
5421
|
context: empty(),
|
|
5414
5422
|
finally: 0,
|
|
5423
|
+
level: functionage.level + 1,
|
|
5415
5424
|
loop: 0,
|
|
5416
5425
|
statement_prv: undefined,
|
|
5417
5426
|
switch: 0,
|
|
@@ -5420,43 +5429,27 @@ function jslint_phase3_parse(state) {
|
|
|
5420
5429
|
if (the_function.arity !== "statement" && typeof name === "object") {
|
|
5421
5430
|
|
|
5422
5431
|
// test_cause:
|
|
5423
|
-
// ["let aa=function bb(){return;};", "prefix_function", "expression", "", 0]
|
|
5432
|
+
// ["let aa=function bb(){return;};", "prefix_function", "expression", "bb", 0]
|
|
5424
5433
|
|
|
5425
|
-
test_cause("expression");
|
|
5434
|
+
test_cause("expression", name.id);
|
|
5426
5435
|
enroll(name, "function", true);
|
|
5427
5436
|
name.dead = false;
|
|
5428
5437
|
name.init = true;
|
|
5429
5438
|
name.used = 1;
|
|
5430
5439
|
}
|
|
5431
5440
|
|
|
5432
|
-
// Bugfix - fix function-
|
|
5441
|
+
// PR-334 - Bugfix - fix function-redefinition not warned inside function-call.
|
|
5433
5442
|
// Push the current function context and establish a new one.
|
|
5434
5443
|
|
|
5435
|
-
function_stack.push(functionage);
|
|
5436
5444
|
function_list.push(the_function);
|
|
5445
|
+
function_stack.push(functionage);
|
|
5437
5446
|
functionage = the_function;
|
|
5438
5447
|
|
|
5439
5448
|
// Parse the parameter list.
|
|
5440
5449
|
|
|
5441
5450
|
advance("(");
|
|
5442
|
-
|
|
5443
|
-
// test_cause:
|
|
5444
|
-
// ["function aa(){}", "prefix_function", "opener", "", 0]
|
|
5445
|
-
|
|
5446
|
-
test_cause("opener");
|
|
5447
|
-
token_now.free = false;
|
|
5448
5451
|
token_now.arity = "function";
|
|
5449
|
-
|
|
5450
|
-
functionage.parameters.forEach(function enroll_parameter(name) {
|
|
5451
|
-
if (name.identifier) {
|
|
5452
|
-
enroll(name, "parameter", false);
|
|
5453
|
-
} else {
|
|
5454
|
-
|
|
5455
|
-
// Recurse enroll_parameter().
|
|
5456
|
-
|
|
5457
|
-
name.names.forEach(enroll_parameter);
|
|
5458
|
-
}
|
|
5459
|
-
});
|
|
5452
|
+
prefix_function_parameter(the_function);
|
|
5460
5453
|
|
|
5461
5454
|
// The function's body is a block.
|
|
5462
5455
|
|
|
@@ -5507,19 +5500,40 @@ function jslint_phase3_parse(state) {
|
|
|
5507
5500
|
return the_function;
|
|
5508
5501
|
}
|
|
5509
5502
|
|
|
5510
|
-
function
|
|
5511
|
-
|
|
5512
|
-
|
|
5503
|
+
function prefix_function_parameter(the_function) {
|
|
5504
|
+
|
|
5505
|
+
// This function will parse input <parameters> at beginning of <the_function>
|
|
5506
|
+
|
|
5513
5507
|
let optional;
|
|
5508
|
+
let parameters = [];
|
|
5509
|
+
let signature = ["("];
|
|
5514
5510
|
let subparam;
|
|
5515
|
-
function
|
|
5511
|
+
function param_enroll(name) {
|
|
5512
|
+
if (name.identifier) {
|
|
5513
|
+
enroll(name, "parameter", false);
|
|
5514
|
+
} else {
|
|
5515
|
+
|
|
5516
|
+
// test_cause:
|
|
5517
|
+
// ["([aa])=>0", "param_enroll", "use_function_not_fart", "=>", 7]
|
|
5518
|
+
// ["({aa})=>0", "param_enroll", "use_function_not_fart", "=>", 7]
|
|
5519
|
+
|
|
5520
|
+
if (the_function.id === "=>" && !option_dict.fart) {
|
|
5521
|
+
warn("use_function_not_fart", the_function);
|
|
5522
|
+
}
|
|
5523
|
+
|
|
5524
|
+
// Recurse param_enroll().
|
|
5525
|
+
|
|
5526
|
+
name.names.forEach(param_enroll);
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
function param_parse() {
|
|
5516
5530
|
let ellipsis = false;
|
|
5517
5531
|
let param;
|
|
5518
5532
|
if (token_nxt.id === "{") {
|
|
5519
5533
|
if (optional !== undefined) {
|
|
5520
5534
|
|
|
5521
5535
|
// test_cause:
|
|
5522
|
-
// ["function aa(aa=0,{}){}", "
|
|
5536
|
+
// ["function aa(aa=0,{}){}", "param_parse", "required_a_optional_b", "aa", 18]
|
|
5523
5537
|
|
|
5524
5538
|
warn(
|
|
5525
5539
|
"required_a_optional_b",
|
|
@@ -5537,8 +5551,8 @@ function jslint_phase3_parse(state) {
|
|
|
5537
5551
|
if (!subparam.identifier) {
|
|
5538
5552
|
|
|
5539
5553
|
// test_cause:
|
|
5540
|
-
// ["function aa(aa=0,{}){}", "
|
|
5541
|
-
// ["function aa({0}){}", "
|
|
5554
|
+
// ["function aa(aa=0,{}){}", "param_parse", "expected_identifier_a", "}", 19]
|
|
5555
|
+
// ["function aa({0}){}", "param_parse", "expected_identifier_a", "0", 14]
|
|
5542
5556
|
|
|
5543
5557
|
return stop("expected_identifier_a");
|
|
5544
5558
|
}
|
|
@@ -5553,7 +5567,7 @@ function jslint_phase3_parse(state) {
|
|
|
5553
5567
|
if (!subparam.identifier) {
|
|
5554
5568
|
|
|
5555
5569
|
// test_cause:
|
|
5556
|
-
// ["function aa({aa:0}){}", "
|
|
5570
|
+
// ["function aa({aa:0}){}", "param_parse", "expected_identifier_a", "}", 18]
|
|
5557
5571
|
|
|
5558
5572
|
return stop(
|
|
5559
5573
|
"expected_identifier_a",
|
|
@@ -5563,7 +5577,7 @@ function jslint_phase3_parse(state) {
|
|
|
5563
5577
|
}
|
|
5564
5578
|
|
|
5565
5579
|
// test_cause:
|
|
5566
|
-
// ["function aa({aa=aa},aa){}", "
|
|
5580
|
+
// ["function aa({aa=aa},aa){}", "param_parse", "equal", "", 0]
|
|
5567
5581
|
|
|
5568
5582
|
test_cause("equal");
|
|
5569
5583
|
if (token_nxt.id === "=") {
|
|
@@ -5579,7 +5593,7 @@ function jslint_phase3_parse(state) {
|
|
|
5579
5593
|
break;
|
|
5580
5594
|
}
|
|
5581
5595
|
}
|
|
5582
|
-
|
|
5596
|
+
parameters.push(param);
|
|
5583
5597
|
|
|
5584
5598
|
// test_cause:
|
|
5585
5599
|
// ["
|
|
@@ -5592,13 +5606,14 @@ function jslint_phase3_parse(state) {
|
|
|
5592
5606
|
if (token_nxt.id === ",") {
|
|
5593
5607
|
advance(",");
|
|
5594
5608
|
signature.push(", ");
|
|
5595
|
-
|
|
5609
|
+
param_parse();
|
|
5610
|
+
return;
|
|
5596
5611
|
}
|
|
5597
5612
|
} else if (token_nxt.id === "[") {
|
|
5598
5613
|
if (optional !== undefined) {
|
|
5599
5614
|
|
|
5600
5615
|
// test_cause:
|
|
5601
|
-
// ["function aa(aa=0,[]){}", "
|
|
5616
|
+
// ["function aa(aa=0,[]){}", "param_parse", "required_a_optional_b", "aa", 18]
|
|
5602
5617
|
|
|
5603
5618
|
warn(
|
|
5604
5619
|
"required_a_optional_b",
|
|
@@ -5616,7 +5631,7 @@ function jslint_phase3_parse(state) {
|
|
|
5616
5631
|
if (!subparam.identifier) {
|
|
5617
5632
|
|
|
5618
5633
|
// test_cause:
|
|
5619
|
-
// ["function aa(aa=0,[]){}", "
|
|
5634
|
+
// ["function aa(aa=0,[]){}", "param_parse", "expected_identifier_a", "]", 19]
|
|
5620
5635
|
|
|
5621
5636
|
return stop("expected_identifier_a");
|
|
5622
5637
|
}
|
|
@@ -5624,7 +5639,7 @@ function jslint_phase3_parse(state) {
|
|
|
5624
5639
|
param.names.push(subparam);
|
|
5625
5640
|
|
|
5626
5641
|
// test_cause:
|
|
5627
|
-
// ["function aa([aa=aa],aa){}", "
|
|
5642
|
+
// ["function aa([aa=aa],aa){}", "param_parse", "id", "", 0]
|
|
5628
5643
|
|
|
5629
5644
|
test_cause("id");
|
|
5630
5645
|
if (token_nxt.id === "=") {
|
|
@@ -5638,12 +5653,13 @@ function jslint_phase3_parse(state) {
|
|
|
5638
5653
|
break;
|
|
5639
5654
|
}
|
|
5640
5655
|
}
|
|
5641
|
-
|
|
5656
|
+
parameters.push(param);
|
|
5642
5657
|
advance("]");
|
|
5643
5658
|
if (token_nxt.id === ",") {
|
|
5644
5659
|
advance(",");
|
|
5645
5660
|
signature.push(", ");
|
|
5646
|
-
|
|
5661
|
+
param_parse();
|
|
5662
|
+
return;
|
|
5647
5663
|
}
|
|
5648
5664
|
} else {
|
|
5649
5665
|
if (token_nxt.id === "...") {
|
|
@@ -5653,7 +5669,7 @@ function jslint_phase3_parse(state) {
|
|
|
5653
5669
|
if (optional !== undefined) {
|
|
5654
5670
|
|
|
5655
5671
|
// test_cause:
|
|
5656
|
-
// ["function aa(aa=0,...){}", "
|
|
5672
|
+
// ["function aa(aa=0,...){}", "param_parse", "required_a_optional_b", "aa", 21]
|
|
5657
5673
|
|
|
5658
5674
|
warn(
|
|
5659
5675
|
"required_a_optional_b",
|
|
@@ -5666,12 +5682,12 @@ function jslint_phase3_parse(state) {
|
|
|
5666
5682
|
if (!token_nxt.identifier) {
|
|
5667
5683
|
|
|
5668
5684
|
// test_cause:
|
|
5669
|
-
// ["function aa(0){}", "
|
|
5685
|
+
// ["function aa(0){}", "param_parse", "expected_identifier_a", "0", 13]
|
|
5670
5686
|
|
|
5671
5687
|
return stop("expected_identifier_a");
|
|
5672
5688
|
}
|
|
5673
5689
|
param = token_nxt;
|
|
5674
|
-
|
|
5690
|
+
parameters.push(param);
|
|
5675
5691
|
advance();
|
|
5676
5692
|
signature.push(param.id);
|
|
5677
5693
|
if (ellipsis) {
|
|
@@ -5685,7 +5701,7 @@ function jslint_phase3_parse(state) {
|
|
|
5685
5701
|
if (optional !== undefined) {
|
|
5686
5702
|
|
|
5687
5703
|
// test_cause:
|
|
5688
|
-
// ["function aa(aa=0,bb){}", "
|
|
5704
|
+
// ["function aa(aa=0,bb){}", "param_parse", "required_a_optional_b", "aa", 18]
|
|
5689
5705
|
|
|
5690
5706
|
warn(
|
|
5691
5707
|
"required_a_optional_b",
|
|
@@ -5698,17 +5714,26 @@ function jslint_phase3_parse(state) {
|
|
|
5698
5714
|
if (token_nxt.id === ",") {
|
|
5699
5715
|
advance(",");
|
|
5700
5716
|
signature.push(", ");
|
|
5701
|
-
|
|
5717
|
+
param_parse();
|
|
5718
|
+
return;
|
|
5702
5719
|
}
|
|
5703
5720
|
}
|
|
5704
5721
|
}
|
|
5705
5722
|
}
|
|
5723
|
+
|
|
5724
|
+
// test_cause:
|
|
5725
|
+
// ["function aa(){}", "prefix_function_parameter", "opener", "(", 0]
|
|
5726
|
+
|
|
5727
|
+
test_cause("opener", token_now.id);
|
|
5728
|
+
token_now.free = false;
|
|
5706
5729
|
if (token_nxt.id !== ")" && token_nxt.id !== "(end)") {
|
|
5707
|
-
|
|
5730
|
+
param_parse();
|
|
5708
5731
|
}
|
|
5709
5732
|
advance(")");
|
|
5710
5733
|
signature.push(")");
|
|
5711
|
-
|
|
5734
|
+
parameters.forEach(param_enroll);
|
|
5735
|
+
the_function.parameters = parameters;
|
|
5736
|
+
the_function.signature = signature.join("");
|
|
5712
5737
|
}
|
|
5713
5738
|
|
|
5714
5739
|
function prefix_lbrace() {
|
|
@@ -5919,9 +5944,8 @@ function jslint_phase3_parse(state) {
|
|
|
5919
5944
|
|
|
5920
5945
|
// PR-385 - Bugfix - Fixes issue #382 - failure to detect destructured fart.
|
|
5921
5946
|
|
|
5922
|
-
if (token_now.
|
|
5923
|
-
|
|
5924
|
-
return parse_fart();
|
|
5947
|
+
if (token_now.fart) {
|
|
5948
|
+
return parse_fart(token_now.fart);
|
|
5925
5949
|
}
|
|
5926
5950
|
|
|
5927
5951
|
// test_cause:
|
|
@@ -7451,7 +7475,7 @@ function jslint_phase4_walk(state) {
|
|
|
7451
7475
|
i_set = a_set[the_token.id];
|
|
7452
7476
|
if (i_set !== undefined) {
|
|
7453
7477
|
i_set.forEach(function (task) {
|
|
7454
|
-
|
|
7478
|
+
task(the_token);
|
|
7455
7479
|
});
|
|
7456
7480
|
}
|
|
7457
7481
|
|
|
@@ -7460,7 +7484,7 @@ function jslint_phase4_walk(state) {
|
|
|
7460
7484
|
i_set = a_set["(all)"];
|
|
7461
7485
|
if (i_set !== undefined) {
|
|
7462
7486
|
i_set.forEach(function (task) {
|
|
7463
|
-
|
|
7487
|
+
task(the_token);
|
|
7464
7488
|
});
|
|
7465
7489
|
}
|
|
7466
7490
|
}
|
|
@@ -8453,12 +8477,16 @@ function jslint_phase4_walk(state) {
|
|
|
8453
8477
|
} else {
|
|
8454
8478
|
preamble(thing);
|
|
8455
8479
|
walk_expression(thing.expression);
|
|
8456
|
-
|
|
8480
|
+
|
|
8481
|
+
// PR-414 - Bugfix - fix fart-body not being walked.
|
|
8482
|
+
|
|
8483
|
+
if (thing.id === "function" || thing.id === "=>") {
|
|
8457
8484
|
|
|
8458
8485
|
// test_cause:
|
|
8459
|
-
// ["aa=
|
|
8486
|
+
// ["aa=()=>0", "walk_expression", "function", "=>", 0]
|
|
8487
|
+
// ["aa=function(){}", "walk_expression", "function", "function", 0]
|
|
8460
8488
|
|
|
8461
|
-
test_cause("function");
|
|
8489
|
+
test_cause("function", thing.id);
|
|
8462
8490
|
|
|
8463
8491
|
// Recurse walk_statement().
|
|
8464
8492
|
|
|
@@ -8494,33 +8522,36 @@ function jslint_phase4_walk(state) {
|
|
|
8494
8522
|
}
|
|
8495
8523
|
|
|
8496
8524
|
function walk_statement(thing) {
|
|
8497
|
-
if (thing) {
|
|
8498
|
-
|
|
8525
|
+
if (!thing) {
|
|
8526
|
+
return;
|
|
8527
|
+
}
|
|
8528
|
+
if (Array.isArray(thing)) {
|
|
8499
8529
|
|
|
8500
8530
|
// test_cause:
|
|
8501
8531
|
// ["+[]", "walk_statement", "isArray", "", 0]
|
|
8502
8532
|
|
|
8503
|
-
|
|
8533
|
+
test_cause("isArray");
|
|
8504
8534
|
|
|
8505
8535
|
// Recurse walk_statement().
|
|
8506
8536
|
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8537
|
+
thing.forEach(walk_statement);
|
|
8538
|
+
return;
|
|
8539
|
+
}
|
|
8540
|
+
preamble(thing);
|
|
8541
|
+
walk_expression(thing.expression);
|
|
8542
|
+
if (thing.arity === "binary") {
|
|
8543
|
+
if (thing.id !== "(") {
|
|
8513
8544
|
|
|
8514
8545
|
// test_cause:
|
|
8515
8546
|
// ["0&&0", "walk_statement", "unexpected_expression_a", "&&", 2]
|
|
8516
8547
|
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8548
|
+
warn("unexpected_expression_a", thing);
|
|
8549
|
+
}
|
|
8550
|
+
} else if (
|
|
8551
|
+
thing.arity !== "statement"
|
|
8552
|
+
&& thing.arity !== "assignment"
|
|
8553
|
+
&& thing.id !== "import"
|
|
8554
|
+
) {
|
|
8524
8555
|
|
|
8525
8556
|
// test_cause:
|
|
8526
8557
|
// ["!0", "walk_statement", "unexpected_expression_a", "!", 1]
|
|
@@ -8529,16 +8560,14 @@ function jslint_phase4_walk(state) {
|
|
|
8529
8560
|
// ["0", "walk_statement", "unexpected_expression_a", "0", 1]
|
|
8530
8561
|
// ["typeof 0", "walk_statement", "unexpected_expression_a", "typeof", 1]
|
|
8531
8562
|
|
|
8532
|
-
|
|
8533
|
-
|
|
8563
|
+
warn("unexpected_expression_a", thing);
|
|
8564
|
+
}
|
|
8534
8565
|
|
|
8535
8566
|
// Recurse walk_statement().
|
|
8536
8567
|
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
}
|
|
8541
|
-
}
|
|
8568
|
+
walk_statement(thing.block);
|
|
8569
|
+
walk_statement(thing.else);
|
|
8570
|
+
postamble(thing);
|
|
8542
8571
|
}
|
|
8543
8572
|
|
|
8544
8573
|
postaction = action(posts);
|
|
@@ -9217,6 +9246,7 @@ function jslint_phase5_whitage(state) {
|
|
|
9217
9246
|
)
|
|
9218
9247
|
|| left.id === "function"
|
|
9219
9248
|
|| left.id === ":"
|
|
9249
|
+
|| left.id === "async"
|
|
9220
9250
|
|| (
|
|
9221
9251
|
(
|
|
9222
9252
|
left.identifier
|
|
@@ -9773,6 +9803,7 @@ pyNj+JctcQLXenBOCms46aMkenIx45WpXqxxVJQLz/vgpmAVa0fmDv6Pue9xVTBPfVxCUGfj\
|
|
|
9773
9803
|
let {
|
|
9774
9804
|
context,
|
|
9775
9805
|
from,
|
|
9806
|
+
id,
|
|
9776
9807
|
level,
|
|
9777
9808
|
line,
|
|
9778
9809
|
name,
|
|
@@ -9789,14 +9820,18 @@ pyNj+JctcQLXenBOCms46aMkenIx45WpXqxxVJQLz/vgpmAVa0fmDv6Pue9xVTBPfVxCUGfj\
|
|
|
9789
9820
|
+ address(line, from + 1)
|
|
9790
9821
|
+ "<dfn>"
|
|
9791
9822
|
+ (
|
|
9792
|
-
|
|
9793
|
-
?
|
|
9823
|
+
id === "=>"
|
|
9824
|
+
? (
|
|
9825
|
+
"\u00ab" + htmlEscape(name) + "\u00bb"
|
|
9826
|
+
+ htmlEscape(signature)
|
|
9827
|
+
+ " =>"
|
|
9828
|
+
)
|
|
9794
9829
|
: (
|
|
9795
9830
|
typeof name === "string"
|
|
9796
9831
|
? "\u00ab" + htmlEscape(name) + "\u00bb"
|
|
9797
9832
|
: htmlEscape(name.id)
|
|
9798
|
-
)
|
|
9799
|
-
)
|
|
9833
|
+
) + htmlEscape(signature)
|
|
9834
|
+
)
|
|
9800
9835
|
+ "</dfn>"
|
|
9801
9836
|
);
|
|
9802
9837
|
params = [];
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"default": "./jslint_wrapper_cjs.cjs",
|
|
12
12
|
"import": "./jslint.mjs"
|
|
13
13
|
},
|
|
14
|
-
"fileCount":
|
|
14
|
+
"fileCount": 33,
|
|
15
15
|
"keywords": [
|
|
16
16
|
"coverage-report",
|
|
17
17
|
"javascript",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"test2": "sh jslint_ci.sh shCiBase"
|
|
34
34
|
},
|
|
35
35
|
"type": "module",
|
|
36
|
-
"version": "2022.
|
|
36
|
+
"version": "2022.11.20"
|
|
37
37
|
}
|