Skip to content

Commit

Permalink
- jslint - Allow destructuring-assignment after function-definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhu256 committed Mar 19, 2024
1 parent 5000907 commit 943ba64
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- jslint - try to improve parser to be able to parse jquery.js without stopping.

# v2024.3.1-beta
- jslint - Allow destructuring-assignment after function-definition.
- ci - Replace npm-package used to auto-build vscode-plugin, vsce to @vscode/vsce.
- test - Update test-function jstestDescribe() to wait awhile for imports to initialize before running tests.
- ci - Fix tmpdir in shell-function shBrowserScreenshot().
Expand Down
6 changes: 4 additions & 2 deletions jslint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5487,13 +5487,15 @@ function jslint_phase3_parse(state) {
if (
token_nxt.id === "."
|| token_nxt.id === "?."
|| token_nxt.id === "["

// PR-459 - Allow destructuring-assignment after function-definition.

// || token_nxt.id === "["
) {

// test_cause:
// ["function aa(){}\n.aa", "prefix_function", "unexpected_a", ".", 1]
// ["function aa(){}\n?.aa", "prefix_function", "unexpected_a", "?.", 1]
// ["function aa(){}\n[]", "prefix_function", "unexpected_a", "[", 1]

warn("unexpected_a");
}
Expand Down
13 changes: 12 additions & 1 deletion test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,18 @@ jstestDescribe((
].map(function (directive) {
return [
"let [\n aa, bb = 0\n] = 0;\naa();\nbb();",
"let [...aa] = [...aa];\naa();",
"let aa = 0;\nlet [...bb] = [...aa];\nbb();",

// PR-459 - Allow destructuring-assignment after function-definition.

(
"let aa;\n"
+ "let bb;\n"
+ "function cc() {\n"
+ " return;\n"
+ "}\n"
+ "[aa, bb] = cc();\n"
),
"let constructor = 0;\nconstructor();",
"let {\n aa: bb\n} = 0;\nbb();",
"let {\n aa: bb,\n bb: cc\n} = 0;\nbb();\ncc();",
Expand Down

0 comments on commit 943ba64

Please sign in to comment.