@jslint-org/jslint 2022.7.20 → 2022.9.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 +3 -0
- package/README.md +18 -4
- package/jslint.mjs +177 -135
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
- jslint - add new warning "Expected Object.create(null) instead of {}"
|
|
14
14
|
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
|
|
15
15
|
|
|
16
|
+
# v2022.9.20
|
|
17
|
+
- directive - add new directive `fart` to allow complex fat-arrow
|
|
18
|
+
|
|
16
19
|
# v2022.7.20
|
|
17
20
|
- bugfix - warnings that should be ignored sometimes suppress legitimate warnings
|
|
18
21
|
- doc - document jslint directives
|
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.9.20)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
|
|
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) |
|
|
@@ -49,6 +49,7 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
49
49
|
- [`/*jslint couch*/`](#jslint-couch)
|
|
50
50
|
- [`/*jslint devel*/`](#jslint-devel)
|
|
51
51
|
- [`/*jslint eval*/`](#jslint-eval)
|
|
52
|
+
- [`/*jslint fart*/`](#jslint-fart)
|
|
52
53
|
- [`/*jslint for*/`](#jslint-for)
|
|
53
54
|
- [`/*jslint getset*/`](#jslint-getset)
|
|
54
55
|
- [`/*jslint indent2*/`](#jslint-indent2)
|
|
@@ -576,7 +577,7 @@ right so that you can focus your creative energy where it is most needed.
|
|
|
576
577
|
|
|
577
578
|
```js
|
|
578
579
|
/*jslint bitwise*/
|
|
579
|
-
// Allow bitwise
|
|
580
|
+
// Allow bitwise operator.
|
|
580
581
|
|
|
581
582
|
let foo = 0 | 1;
|
|
582
583
|
```
|
|
@@ -598,7 +599,7 @@ localStorage.getItem("foo");
|
|
|
598
599
|
|
|
599
600
|
```js
|
|
600
601
|
/*jslint convert*/
|
|
601
|
-
// Allow conversion
|
|
602
|
+
// Allow conversion operator.
|
|
602
603
|
|
|
603
604
|
let foo = new Date() + "";
|
|
604
605
|
let bar = !!0;
|
|
@@ -639,6 +640,19 @@ eval("1");
|
|
|
639
640
|
|
|
640
641
|
<br>
|
|
641
642
|
|
|
643
|
+
##### `/*jslint fart*/`
|
|
644
|
+
|
|
645
|
+
```js
|
|
646
|
+
/*jslint fart*/
|
|
647
|
+
// Allow complex fat-arrow.
|
|
648
|
+
|
|
649
|
+
let foo = async ({bar, baz}) => {
|
|
650
|
+
return await bar(baz);
|
|
651
|
+
};
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
<br>
|
|
655
|
+
|
|
642
656
|
##### `/*jslint for*/`
|
|
643
657
|
|
|
644
658
|
```js
|
|
@@ -716,7 +730,7 @@ require("fs");
|
|
|
716
730
|
|
|
717
731
|
```js
|
|
718
732
|
/*jslint nomen*/
|
|
719
|
-
// Allow weird property
|
|
733
|
+
// Allow weird property name.
|
|
720
734
|
|
|
721
735
|
let foo = {};
|
|
722
736
|
foo._bar = 1;
|
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.9.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.
|
|
@@ -3294,19 +3294,20 @@ function jslint_phase2_lex(state) {
|
|
|
3294
3294
|
|
|
3295
3295
|
switch (key) {
|
|
3296
3296
|
case "beta": // Enable experimental warnings.
|
|
3297
|
-
case "bitwise": // Allow bitwise
|
|
3297
|
+
case "bitwise": // Allow bitwise operator.
|
|
3298
3298
|
case "browser": // Assume browser environment.
|
|
3299
|
-
case "convert": // Allow conversion
|
|
3299
|
+
case "convert": // Allow conversion operator.
|
|
3300
3300
|
case "couch": // Assume CouchDb environment.
|
|
3301
3301
|
case "devel": // Allow console.log() and friends.
|
|
3302
3302
|
case "ecma": // Assume ECMAScript environment.
|
|
3303
3303
|
case "eval": // Allow eval().
|
|
3304
|
+
case "fart": // Allow complex fat-arrow.
|
|
3304
3305
|
case "for": // Allow for-statement.
|
|
3305
3306
|
case "getset": // Allow get() and set().
|
|
3306
3307
|
case "indent2": // Use 2-space indent.
|
|
3307
3308
|
case "long": // Allow long lines.
|
|
3308
3309
|
case "node": // Assume Node.js environment.
|
|
3309
|
-
case "nomen": // Allow weird property
|
|
3310
|
+
case "nomen": // Allow weird property name.
|
|
3310
3311
|
case "single": // Allow single-quote strings.
|
|
3311
3312
|
case "subscript": // Allow identifier in subscript-notation.
|
|
3312
3313
|
case "test_cause": // Test jslint's causes.
|
|
@@ -3770,7 +3771,6 @@ import moduleHttps from "https";
|
|
|
3770
3771
|
from,
|
|
3771
3772
|
id,
|
|
3772
3773
|
identifier: Boolean(identifier),
|
|
3773
|
-
is_fart: false,
|
|
3774
3774
|
line,
|
|
3775
3775
|
nr: token_list.length,
|
|
3776
3776
|
thru: column,
|
|
@@ -3835,7 +3835,7 @@ import moduleHttps from "https";
|
|
|
3835
3835
|
token_prv_expr.id === ")"
|
|
3836
3836
|
&& paren_backtrack_list[paren_depth]
|
|
3837
3837
|
) {
|
|
3838
|
-
paren_backtrack_list[paren_depth].
|
|
3838
|
+
paren_backtrack_list[paren_depth].fart = the_token;
|
|
3839
3839
|
}
|
|
3840
3840
|
break;
|
|
3841
3841
|
}
|
|
@@ -3936,7 +3936,11 @@ function jslint_phase3_parse(state) {
|
|
|
3936
3936
|
|
|
3937
3937
|
// Attempt to give helpful names to anonymous functions.
|
|
3938
3938
|
|
|
3939
|
-
if (
|
|
3939
|
+
if (
|
|
3940
|
+
token_now.identifier
|
|
3941
|
+
&& token_now.id !== "function"
|
|
3942
|
+
&& token_now.id !== "async"
|
|
3943
|
+
) {
|
|
3940
3944
|
anon = token_now.id;
|
|
3941
3945
|
} else if (
|
|
3942
3946
|
token_now.id === "(string)"
|
|
@@ -4869,17 +4873,21 @@ function jslint_phase3_parse(state) {
|
|
|
4869
4873
|
return left;
|
|
4870
4874
|
}
|
|
4871
4875
|
|
|
4872
|
-
function parse_fart() {
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4876
|
+
function parse_fart(the_fart) {
|
|
4877
|
+
|
|
4878
|
+
// Give the function properties storing its names and for observing the depth
|
|
4879
|
+
// of loops and switches.
|
|
4880
|
+
|
|
4881
|
+
Object.assign(the_fart, {
|
|
4882
|
+
arity: "binary",
|
|
4883
|
+
context: empty(),
|
|
4884
|
+
finally: 0,
|
|
4885
|
+
level: functionage.level + 1,
|
|
4886
|
+
loop: 0,
|
|
4887
|
+
name: anon,
|
|
4888
|
+
switch: 0,
|
|
4889
|
+
try: 0
|
|
4890
|
+
});
|
|
4883
4891
|
|
|
4884
4892
|
// PR-384 - Relax warning "function_in_loop".
|
|
4885
4893
|
//
|
|
@@ -4891,45 +4899,27 @@ function jslint_phase3_parse(state) {
|
|
|
4891
4899
|
// warn("function_in_loop", the_fart);
|
|
4892
4900
|
// }
|
|
4893
4901
|
|
|
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
4902
|
// Push the current function context and establish a new one.
|
|
4906
4903
|
|
|
4904
|
+
function_list.push(the_fart);
|
|
4907
4905
|
function_stack.push(functionage);
|
|
4908
4906
|
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
4907
|
|
|
4916
|
-
//
|
|
4917
|
-
// ["([aa])=>0", "enroll_parameter", "use_function_not_fart", "=>", 7]
|
|
4918
|
-
// ["({aa})=>0", "enroll_parameter", "use_function_not_fart", "=>", 7]
|
|
4908
|
+
// Parse the parameter list.
|
|
4919
4909
|
|
|
4920
|
-
|
|
4910
|
+
prefix_function_parameter(the_fart);
|
|
4911
|
+
advance("=>");
|
|
4921
4912
|
|
|
4922
|
-
//
|
|
4913
|
+
// The function's body is a block.
|
|
4923
4914
|
|
|
4924
|
-
name.names.forEach(enroll_parameter);
|
|
4925
|
-
}
|
|
4926
|
-
});
|
|
4927
4915
|
if (token_nxt.id === "{") {
|
|
4916
|
+
if (!option_dict.fart) {
|
|
4928
4917
|
|
|
4929
4918
|
// test_cause:
|
|
4930
4919
|
// ["()=>{}", "parse_fart", "use_function_not_fart", "=>", 3]
|
|
4931
4920
|
|
|
4932
|
-
|
|
4921
|
+
warn("use_function_not_fart", the_fart);
|
|
4922
|
+
}
|
|
4933
4923
|
the_fart.block = block("body");
|
|
4934
4924
|
} else if (
|
|
4935
4925
|
syntax_dict[token_nxt.id] !== undefined
|
|
@@ -4942,9 +4932,15 @@ function jslint_phase3_parse(state) {
|
|
|
4942
4932
|
// ["()=>delete aa", "parse_fart", "unexpected_a_after_b", "=>", 5]
|
|
4943
4933
|
|
|
4944
4934
|
stop("unexpected_a_after_b", token_nxt, token_nxt.id, "=>");
|
|
4935
|
+
|
|
4936
|
+
// The function's body is an expression.
|
|
4937
|
+
|
|
4945
4938
|
} else {
|
|
4946
4939
|
the_fart.expression = parse_expression(0);
|
|
4947
4940
|
}
|
|
4941
|
+
|
|
4942
|
+
// Restore the previous context.
|
|
4943
|
+
|
|
4948
4944
|
functionage = function_stack.pop();
|
|
4949
4945
|
return the_fart;
|
|
4950
4946
|
}
|
|
@@ -5287,15 +5283,35 @@ function jslint_phase3_parse(state) {
|
|
|
5287
5283
|
}
|
|
5288
5284
|
|
|
5289
5285
|
function prefix_async() {
|
|
5290
|
-
let the_async;
|
|
5286
|
+
let the_async = token_now;
|
|
5291
5287
|
let the_function;
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5288
|
+
token_nxt.arity = the_async.arity;
|
|
5289
|
+
|
|
5290
|
+
// PR-414 - Parse async fart.
|
|
5291
|
+
|
|
5292
|
+
if (token_nxt.fart) {
|
|
5293
|
+
advance("(");
|
|
5294
|
+
the_function = Object.assign(token_now.fart, {
|
|
5295
|
+
async: 1
|
|
5296
|
+
});
|
|
5297
|
+
if (!option_dict.fart) {
|
|
5298
|
+
|
|
5299
|
+
// test_cause:
|
|
5300
|
+
// ["async()=>0", "prefix_async", "use_function_not_fart", "=>", 8]
|
|
5301
|
+
|
|
5302
|
+
warn("use_function_not_fart", the_function);
|
|
5303
|
+
}
|
|
5304
|
+
prefix_lparen();
|
|
5305
|
+
|
|
5306
|
+
// Parse async function.
|
|
5307
|
+
|
|
5308
|
+
} else {
|
|
5309
|
+
advance("function");
|
|
5310
|
+
the_function = Object.assign(token_now, {
|
|
5311
|
+
async: 1
|
|
5312
|
+
});
|
|
5313
|
+
prefix_function();
|
|
5314
|
+
}
|
|
5299
5315
|
if (the_function.async === 1) {
|
|
5300
5316
|
|
|
5301
5317
|
// test_cause:
|
|
@@ -5382,7 +5398,6 @@ function jslint_phase3_parse(state) {
|
|
|
5382
5398
|
}
|
|
5383
5399
|
}
|
|
5384
5400
|
}
|
|
5385
|
-
the_function.level = functionage.level + 1;
|
|
5386
5401
|
|
|
5387
5402
|
// Probably deadcode.
|
|
5388
5403
|
// if (mode_mega) {
|
|
@@ -5412,6 +5427,7 @@ function jslint_phase3_parse(state) {
|
|
|
5412
5427
|
async: the_function.async || 0,
|
|
5413
5428
|
context: empty(),
|
|
5414
5429
|
finally: 0,
|
|
5430
|
+
level: functionage.level + 1,
|
|
5415
5431
|
loop: 0,
|
|
5416
5432
|
statement_prv: undefined,
|
|
5417
5433
|
switch: 0,
|
|
@@ -5420,43 +5436,27 @@ function jslint_phase3_parse(state) {
|
|
|
5420
5436
|
if (the_function.arity !== "statement" && typeof name === "object") {
|
|
5421
5437
|
|
|
5422
5438
|
// test_cause:
|
|
5423
|
-
// ["let aa=function bb(){return;};", "prefix_function", "expression", "", 0]
|
|
5439
|
+
// ["let aa=function bb(){return;};", "prefix_function", "expression", "bb", 0]
|
|
5424
5440
|
|
|
5425
|
-
test_cause("expression");
|
|
5441
|
+
test_cause("expression", name.id);
|
|
5426
5442
|
enroll(name, "function", true);
|
|
5427
5443
|
name.dead = false;
|
|
5428
5444
|
name.init = true;
|
|
5429
5445
|
name.used = 1;
|
|
5430
5446
|
}
|
|
5431
5447
|
|
|
5432
|
-
// Bugfix - fix function-
|
|
5448
|
+
// PR-334 - Bugfix - fix function-redefinition not warned inside function-call.
|
|
5433
5449
|
// Push the current function context and establish a new one.
|
|
5434
5450
|
|
|
5435
|
-
function_stack.push(functionage);
|
|
5436
5451
|
function_list.push(the_function);
|
|
5452
|
+
function_stack.push(functionage);
|
|
5437
5453
|
functionage = the_function;
|
|
5438
5454
|
|
|
5439
5455
|
// Parse the parameter list.
|
|
5440
5456
|
|
|
5441
5457
|
advance("(");
|
|
5442
|
-
|
|
5443
|
-
// test_cause:
|
|
5444
|
-
// ["function aa(){}", "prefix_function", "opener", "", 0]
|
|
5445
|
-
|
|
5446
|
-
test_cause("opener");
|
|
5447
|
-
token_now.free = false;
|
|
5448
5458
|
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
|
-
});
|
|
5459
|
+
prefix_function_parameter(the_function);
|
|
5460
5460
|
|
|
5461
5461
|
// The function's body is a block.
|
|
5462
5462
|
|
|
@@ -5507,19 +5507,40 @@ function jslint_phase3_parse(state) {
|
|
|
5507
5507
|
return the_function;
|
|
5508
5508
|
}
|
|
5509
5509
|
|
|
5510
|
-
function
|
|
5511
|
-
|
|
5512
|
-
|
|
5510
|
+
function prefix_function_parameter(the_function) {
|
|
5511
|
+
|
|
5512
|
+
// This function will parse input <parameters> at beginning of <the_function>
|
|
5513
|
+
|
|
5513
5514
|
let optional;
|
|
5515
|
+
let parameters = [];
|
|
5516
|
+
let signature = ["("];
|
|
5514
5517
|
let subparam;
|
|
5515
|
-
function
|
|
5518
|
+
function param_enroll(name) {
|
|
5519
|
+
if (name.identifier) {
|
|
5520
|
+
enroll(name, "parameter", false);
|
|
5521
|
+
} else {
|
|
5522
|
+
|
|
5523
|
+
// test_cause:
|
|
5524
|
+
// ["([aa])=>0", "param_enroll", "use_function_not_fart", "=>", 7]
|
|
5525
|
+
// ["({aa})=>0", "param_enroll", "use_function_not_fart", "=>", 7]
|
|
5526
|
+
|
|
5527
|
+
if (the_function.id === "=>" && !option_dict.fart) {
|
|
5528
|
+
warn("use_function_not_fart", the_function);
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5531
|
+
// Recurse param_enroll().
|
|
5532
|
+
|
|
5533
|
+
name.names.forEach(param_enroll);
|
|
5534
|
+
}
|
|
5535
|
+
}
|
|
5536
|
+
function param_parse() {
|
|
5516
5537
|
let ellipsis = false;
|
|
5517
5538
|
let param;
|
|
5518
5539
|
if (token_nxt.id === "{") {
|
|
5519
5540
|
if (optional !== undefined) {
|
|
5520
5541
|
|
|
5521
5542
|
// test_cause:
|
|
5522
|
-
// ["function aa(aa=0,{}){}", "
|
|
5543
|
+
// ["function aa(aa=0,{}){}", "param_parse", "required_a_optional_b", "aa", 18]
|
|
5523
5544
|
|
|
5524
5545
|
warn(
|
|
5525
5546
|
"required_a_optional_b",
|
|
@@ -5537,8 +5558,8 @@ function jslint_phase3_parse(state) {
|
|
|
5537
5558
|
if (!subparam.identifier) {
|
|
5538
5559
|
|
|
5539
5560
|
// test_cause:
|
|
5540
|
-
// ["function aa(aa=0,{}){}", "
|
|
5541
|
-
// ["function aa({0}){}", "
|
|
5561
|
+
// ["function aa(aa=0,{}){}", "param_parse", "expected_identifier_a", "}", 19]
|
|
5562
|
+
// ["function aa({0}){}", "param_parse", "expected_identifier_a", "0", 14]
|
|
5542
5563
|
|
|
5543
5564
|
return stop("expected_identifier_a");
|
|
5544
5565
|
}
|
|
@@ -5553,7 +5574,7 @@ function jslint_phase3_parse(state) {
|
|
|
5553
5574
|
if (!subparam.identifier) {
|
|
5554
5575
|
|
|
5555
5576
|
// test_cause:
|
|
5556
|
-
// ["function aa({aa:0}){}", "
|
|
5577
|
+
// ["function aa({aa:0}){}", "param_parse", "expected_identifier_a", "}", 18]
|
|
5557
5578
|
|
|
5558
5579
|
return stop(
|
|
5559
5580
|
"expected_identifier_a",
|
|
@@ -5563,7 +5584,7 @@ function jslint_phase3_parse(state) {
|
|
|
5563
5584
|
}
|
|
5564
5585
|
|
|
5565
5586
|
// test_cause:
|
|
5566
|
-
// ["function aa({aa=aa},aa){}", "
|
|
5587
|
+
// ["function aa({aa=aa},aa){}", "param_parse", "equal", "", 0]
|
|
5567
5588
|
|
|
5568
5589
|
test_cause("equal");
|
|
5569
5590
|
if (token_nxt.id === "=") {
|
|
@@ -5579,7 +5600,7 @@ function jslint_phase3_parse(state) {
|
|
|
5579
5600
|
break;
|
|
5580
5601
|
}
|
|
5581
5602
|
}
|
|
5582
|
-
|
|
5603
|
+
parameters.push(param);
|
|
5583
5604
|
|
|
5584
5605
|
// test_cause:
|
|
5585
5606
|
// ["
|
|
@@ -5592,13 +5613,14 @@ function jslint_phase3_parse(state) {
|
|
|
5592
5613
|
if (token_nxt.id === ",") {
|
|
5593
5614
|
advance(",");
|
|
5594
5615
|
signature.push(", ");
|
|
5595
|
-
|
|
5616
|
+
param_parse();
|
|
5617
|
+
return;
|
|
5596
5618
|
}
|
|
5597
5619
|
} else if (token_nxt.id === "[") {
|
|
5598
5620
|
if (optional !== undefined) {
|
|
5599
5621
|
|
|
5600
5622
|
// test_cause:
|
|
5601
|
-
// ["function aa(aa=0,[]){}", "
|
|
5623
|
+
// ["function aa(aa=0,[]){}", "param_parse", "required_a_optional_b", "aa", 18]
|
|
5602
5624
|
|
|
5603
5625
|
warn(
|
|
5604
5626
|
"required_a_optional_b",
|
|
@@ -5616,7 +5638,7 @@ function jslint_phase3_parse(state) {
|
|
|
5616
5638
|
if (!subparam.identifier) {
|
|
5617
5639
|
|
|
5618
5640
|
// test_cause:
|
|
5619
|
-
// ["function aa(aa=0,[]){}", "
|
|
5641
|
+
// ["function aa(aa=0,[]){}", "param_parse", "expected_identifier_a", "]", 19]
|
|
5620
5642
|
|
|
5621
5643
|
return stop("expected_identifier_a");
|
|
5622
5644
|
}
|
|
@@ -5624,7 +5646,7 @@ function jslint_phase3_parse(state) {
|
|
|
5624
5646
|
param.names.push(subparam);
|
|
5625
5647
|
|
|
5626
5648
|
// test_cause:
|
|
5627
|
-
// ["function aa([aa=aa],aa){}", "
|
|
5649
|
+
// ["function aa([aa=aa],aa){}", "param_parse", "id", "", 0]
|
|
5628
5650
|
|
|
5629
5651
|
test_cause("id");
|
|
5630
5652
|
if (token_nxt.id === "=") {
|
|
@@ -5638,12 +5660,13 @@ function jslint_phase3_parse(state) {
|
|
|
5638
5660
|
break;
|
|
5639
5661
|
}
|
|
5640
5662
|
}
|
|
5641
|
-
|
|
5663
|
+
parameters.push(param);
|
|
5642
5664
|
advance("]");
|
|
5643
5665
|
if (token_nxt.id === ",") {
|
|
5644
5666
|
advance(",");
|
|
5645
5667
|
signature.push(", ");
|
|
5646
|
-
|
|
5668
|
+
param_parse();
|
|
5669
|
+
return;
|
|
5647
5670
|
}
|
|
5648
5671
|
} else {
|
|
5649
5672
|
if (token_nxt.id === "...") {
|
|
@@ -5653,7 +5676,7 @@ function jslint_phase3_parse(state) {
|
|
|
5653
5676
|
if (optional !== undefined) {
|
|
5654
5677
|
|
|
5655
5678
|
// test_cause:
|
|
5656
|
-
// ["function aa(aa=0,...){}", "
|
|
5679
|
+
// ["function aa(aa=0,...){}", "param_parse", "required_a_optional_b", "aa", 21]
|
|
5657
5680
|
|
|
5658
5681
|
warn(
|
|
5659
5682
|
"required_a_optional_b",
|
|
@@ -5666,12 +5689,12 @@ function jslint_phase3_parse(state) {
|
|
|
5666
5689
|
if (!token_nxt.identifier) {
|
|
5667
5690
|
|
|
5668
5691
|
// test_cause:
|
|
5669
|
-
// ["function aa(0){}", "
|
|
5692
|
+
// ["function aa(0){}", "param_parse", "expected_identifier_a", "0", 13]
|
|
5670
5693
|
|
|
5671
5694
|
return stop("expected_identifier_a");
|
|
5672
5695
|
}
|
|
5673
5696
|
param = token_nxt;
|
|
5674
|
-
|
|
5697
|
+
parameters.push(param);
|
|
5675
5698
|
advance();
|
|
5676
5699
|
signature.push(param.id);
|
|
5677
5700
|
if (ellipsis) {
|
|
@@ -5685,7 +5708,7 @@ function jslint_phase3_parse(state) {
|
|
|
5685
5708
|
if (optional !== undefined) {
|
|
5686
5709
|
|
|
5687
5710
|
// test_cause:
|
|
5688
|
-
// ["function aa(aa=0,bb){}", "
|
|
5711
|
+
// ["function aa(aa=0,bb){}", "param_parse", "required_a_optional_b", "aa", 18]
|
|
5689
5712
|
|
|
5690
5713
|
warn(
|
|
5691
5714
|
"required_a_optional_b",
|
|
@@ -5698,17 +5721,26 @@ function jslint_phase3_parse(state) {
|
|
|
5698
5721
|
if (token_nxt.id === ",") {
|
|
5699
5722
|
advance(",");
|
|
5700
5723
|
signature.push(", ");
|
|
5701
|
-
|
|
5724
|
+
param_parse();
|
|
5725
|
+
return;
|
|
5702
5726
|
}
|
|
5703
5727
|
}
|
|
5704
5728
|
}
|
|
5705
5729
|
}
|
|
5730
|
+
|
|
5731
|
+
// test_cause:
|
|
5732
|
+
// ["function aa(){}", "prefix_function_parameter", "opener", "(", 0]
|
|
5733
|
+
|
|
5734
|
+
test_cause("opener", token_now.id);
|
|
5735
|
+
token_now.free = false;
|
|
5706
5736
|
if (token_nxt.id !== ")" && token_nxt.id !== "(end)") {
|
|
5707
|
-
|
|
5737
|
+
param_parse();
|
|
5708
5738
|
}
|
|
5709
5739
|
advance(")");
|
|
5710
5740
|
signature.push(")");
|
|
5711
|
-
|
|
5741
|
+
parameters.forEach(param_enroll);
|
|
5742
|
+
the_function.parameters = parameters;
|
|
5743
|
+
the_function.signature = signature.join("");
|
|
5712
5744
|
}
|
|
5713
5745
|
|
|
5714
5746
|
function prefix_lbrace() {
|
|
@@ -5919,9 +5951,8 @@ function jslint_phase3_parse(state) {
|
|
|
5919
5951
|
|
|
5920
5952
|
// PR-385 - Bugfix - Fixes issue #382 - failure to detect destructured fart.
|
|
5921
5953
|
|
|
5922
|
-
if (token_now.
|
|
5923
|
-
|
|
5924
|
-
return parse_fart();
|
|
5954
|
+
if (token_now.fart) {
|
|
5955
|
+
return parse_fart(token_now.fart);
|
|
5925
5956
|
}
|
|
5926
5957
|
|
|
5927
5958
|
// test_cause:
|
|
@@ -7451,7 +7482,7 @@ function jslint_phase4_walk(state) {
|
|
|
7451
7482
|
i_set = a_set[the_token.id];
|
|
7452
7483
|
if (i_set !== undefined) {
|
|
7453
7484
|
i_set.forEach(function (task) {
|
|
7454
|
-
|
|
7485
|
+
task(the_token);
|
|
7455
7486
|
});
|
|
7456
7487
|
}
|
|
7457
7488
|
|
|
@@ -7460,7 +7491,7 @@ function jslint_phase4_walk(state) {
|
|
|
7460
7491
|
i_set = a_set["(all)"];
|
|
7461
7492
|
if (i_set !== undefined) {
|
|
7462
7493
|
i_set.forEach(function (task) {
|
|
7463
|
-
|
|
7494
|
+
task(the_token);
|
|
7464
7495
|
});
|
|
7465
7496
|
}
|
|
7466
7497
|
}
|
|
@@ -8453,12 +8484,16 @@ function jslint_phase4_walk(state) {
|
|
|
8453
8484
|
} else {
|
|
8454
8485
|
preamble(thing);
|
|
8455
8486
|
walk_expression(thing.expression);
|
|
8456
|
-
|
|
8487
|
+
|
|
8488
|
+
// PR-414 - Bugfix - fix fart-body not being walked.
|
|
8489
|
+
|
|
8490
|
+
if (thing.id === "function" || thing.id === "=>") {
|
|
8457
8491
|
|
|
8458
8492
|
// test_cause:
|
|
8459
|
-
// ["aa=
|
|
8493
|
+
// ["aa=()=>0", "walk_expression", "function", "=>", 0]
|
|
8494
|
+
// ["aa=function(){}", "walk_expression", "function", "function", 0]
|
|
8460
8495
|
|
|
8461
|
-
test_cause("function");
|
|
8496
|
+
test_cause("function", thing.id);
|
|
8462
8497
|
|
|
8463
8498
|
// Recurse walk_statement().
|
|
8464
8499
|
|
|
@@ -8494,33 +8529,36 @@ function jslint_phase4_walk(state) {
|
|
|
8494
8529
|
}
|
|
8495
8530
|
|
|
8496
8531
|
function walk_statement(thing) {
|
|
8497
|
-
if (thing) {
|
|
8498
|
-
|
|
8532
|
+
if (!thing) {
|
|
8533
|
+
return;
|
|
8534
|
+
}
|
|
8535
|
+
if (Array.isArray(thing)) {
|
|
8499
8536
|
|
|
8500
8537
|
// test_cause:
|
|
8501
8538
|
// ["+[]", "walk_statement", "isArray", "", 0]
|
|
8502
8539
|
|
|
8503
|
-
|
|
8540
|
+
test_cause("isArray");
|
|
8504
8541
|
|
|
8505
8542
|
// Recurse walk_statement().
|
|
8506
8543
|
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8544
|
+
thing.forEach(walk_statement);
|
|
8545
|
+
return;
|
|
8546
|
+
}
|
|
8547
|
+
preamble(thing);
|
|
8548
|
+
walk_expression(thing.expression);
|
|
8549
|
+
if (thing.arity === "binary") {
|
|
8550
|
+
if (thing.id !== "(") {
|
|
8513
8551
|
|
|
8514
8552
|
// test_cause:
|
|
8515
8553
|
// ["0&&0", "walk_statement", "unexpected_expression_a", "&&", 2]
|
|
8516
8554
|
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8555
|
+
warn("unexpected_expression_a", thing);
|
|
8556
|
+
}
|
|
8557
|
+
} else if (
|
|
8558
|
+
thing.arity !== "statement"
|
|
8559
|
+
&& thing.arity !== "assignment"
|
|
8560
|
+
&& thing.id !== "import"
|
|
8561
|
+
) {
|
|
8524
8562
|
|
|
8525
8563
|
// test_cause:
|
|
8526
8564
|
// ["!0", "walk_statement", "unexpected_expression_a", "!", 1]
|
|
@@ -8529,16 +8567,14 @@ function jslint_phase4_walk(state) {
|
|
|
8529
8567
|
// ["0", "walk_statement", "unexpected_expression_a", "0", 1]
|
|
8530
8568
|
// ["typeof 0", "walk_statement", "unexpected_expression_a", "typeof", 1]
|
|
8531
8569
|
|
|
8532
|
-
|
|
8533
|
-
|
|
8570
|
+
warn("unexpected_expression_a", thing);
|
|
8571
|
+
}
|
|
8534
8572
|
|
|
8535
8573
|
// Recurse walk_statement().
|
|
8536
8574
|
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
}
|
|
8541
|
-
}
|
|
8575
|
+
walk_statement(thing.block);
|
|
8576
|
+
walk_statement(thing.else);
|
|
8577
|
+
postamble(thing);
|
|
8542
8578
|
}
|
|
8543
8579
|
|
|
8544
8580
|
postaction = action(posts);
|
|
@@ -9217,6 +9253,7 @@ function jslint_phase5_whitage(state) {
|
|
|
9217
9253
|
)
|
|
9218
9254
|
|| left.id === "function"
|
|
9219
9255
|
|| left.id === ":"
|
|
9256
|
+
|| left.id === "async"
|
|
9220
9257
|
|| (
|
|
9221
9258
|
(
|
|
9222
9259
|
left.identifier
|
|
@@ -9773,6 +9810,7 @@ pyNj+JctcQLXenBOCms46aMkenIx45WpXqxxVJQLz/vgpmAVa0fmDv6Pue9xVTBPfVxCUGfj\
|
|
|
9773
9810
|
let {
|
|
9774
9811
|
context,
|
|
9775
9812
|
from,
|
|
9813
|
+
id,
|
|
9776
9814
|
level,
|
|
9777
9815
|
line,
|
|
9778
9816
|
name,
|
|
@@ -9789,14 +9827,18 @@ pyNj+JctcQLXenBOCms46aMkenIx45WpXqxxVJQLz/vgpmAVa0fmDv6Pue9xVTBPfVxCUGfj\
|
|
|
9789
9827
|
+ address(line, from + 1)
|
|
9790
9828
|
+ "<dfn>"
|
|
9791
9829
|
+ (
|
|
9792
|
-
|
|
9793
|
-
?
|
|
9830
|
+
id === "=>"
|
|
9831
|
+
? (
|
|
9832
|
+
"\u00ab" + htmlEscape(name) + "\u00bb"
|
|
9833
|
+
+ htmlEscape(signature)
|
|
9834
|
+
+ " =>"
|
|
9835
|
+
)
|
|
9794
9836
|
: (
|
|
9795
9837
|
typeof name === "string"
|
|
9796
9838
|
? "\u00ab" + htmlEscape(name) + "\u00bb"
|
|
9797
9839
|
: htmlEscape(name.id)
|
|
9798
|
-
)
|
|
9799
|
-
)
|
|
9840
|
+
) + htmlEscape(signature)
|
|
9841
|
+
)
|
|
9800
9842
|
+ "</dfn>"
|
|
9801
9843
|
);
|
|
9802
9844
|
params = [];
|
package/package.json
CHANGED