Skip to content

Commit ee1029d

Browse files
authored
- bugfix - fix jslint not-recognizing option-chaining when comparing operands of binary operator (#403)
- allow array-literals to directly call [...].flat() and [...].flatMap()
1 parent 33cca73 commit ee1029d

File tree

5 files changed

+62
-46
lines changed

5 files changed

+62
-46
lines changed

.ci.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ import moduleFs from "fs";
189189
let versionBeta;
190190
let versionMaster;
191191
await Promise.all([
192+
".ci.sh",
192193
"CHANGELOG.md",
193194
"README.md",
194195
"index.html",
@@ -199,7 +200,7 @@ import moduleFs from "fs";
199200
fileDict[file] = await moduleFs.promises.readFile(file, "utf8");
200201
}));
201202
Array.from(fileDict["CHANGELOG.md"].matchAll(
202-
/\n\n# (v\d\d\d\d\.\d\d?\.\d\d?(.*?)?)\n/g
203+
/\n\n# v(\d\d\d\d\.\d\d?\.\d\d?(-.*?)?)\n/g
203204
)).slice(0, 2).forEach(function ([
204205
ignore, version, isBeta
205206
]) {
@@ -208,6 +209,12 @@ import moduleFs from "fs";
208209
});
209210
await Promise.all([
210211
{
212+
file: ".ci.sh",
213+
// update version
214+
src: fileDict[".ci.sh"].replace((
215+
/ "version": "\d\d\d\d\.\d\d?\.\d\d?(?:-.*?)?"/
216+
), ` "version": "${versionBeta}"`)
217+
}, {
211218
file: "README.md",
212219
src: fileDict["README.md"].replace((
213220
/\n```html <!-- jslint_wrapper_codemirror.html -->\n[\S\s]*?\n```\n/
@@ -227,10 +234,10 @@ import moduleFs from "fs";
227234
})
228235
}, {
229236
file: "jslint.mjs",
230-
// inline css-assets
237+
// update version
231238
src: fileDict["jslint.mjs"].replace((
232239
/^let jslint_edition = ".*?";$/m
233-
), `let jslint_edition = "${versionBeta}";`)
240+
), `let jslint_edition = "v${versionBeta}";`)
234241
}, {
235242
file: "jslint_ci.sh",
236243
// update coverage-code
@@ -405,7 +412,7 @@ import moduleFs from "fs";
405412
"type": "git",
406413
"url": "https://github.com/jslint-org/jslint.git"
407414
},
408-
"version": "2022.5.1"
415+
"version": "2022.6.1-beta"
409416
}, undefined, 4)
410417
}
411418
].map(async function ({

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

33
# Todo
4+
- jslint - allow alias `nomen` for jslint-directive `name`
5+
- wrapper - add vscode-command to suppress minor warnings on given line
6+
- doc - document jslint directives and supported/unsupported es6+ features
47
- cli - remove cli-option `--mode-vim-plugin`
58
- coverage - add macros `/*coverage-disable*/` and `/*coverage-enable*/`.
69
- jslint - add html and css linting back into jslint.
@@ -12,6 +15,10 @@
1215
- jslint - add new warning "Expected Object.create(null) instead of {}"
1316
- node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
1417

18+
# v2022.6.1-beta
19+
- bugfix - fix jslint not-recognizing option-chaining when comparing operands of binary operator
20+
- allow array-literals to directly call [...].flat() and [...].flatMap()
21+
1522
# v2022.5.20
1623
- coverage-report - disable default-coverage of directory `node_modules`, but allow override with cli-option `--include-node-modules=1`
1724
- coverage-report - add function globExclude() to revamp coverage-report to exclude files using glob-pattern-matching

jslint.mjs

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@
9494

9595
/*jslint beta, node*/
9696
/*property
97-
excludeList,
98-
globExclude,
99-
import_meta_url, includeList,
100-
pathnameList,
10197
JSLINT_BETA, NODE_V8_COVERAGE, a, all, argv, arity, artifact,
10298
assertErrorThrownAsync, assertJsonEqual, assertOrThrow, assign, async, b,
10399
beta, bitwise, block, body, browser, c, calls, catch, catch_list,
@@ -106,39 +102,39 @@
106102
convert, count, coverageDir, create, cwd, d, dead, debugInline, default,
107103
delta, devel, directive, directive_list, directive_quiet, directives,
108104
dirname, disrupt, dot, edition, elem_list, ellipsis, else, end, endOffset,
109-
endsWith, entries, env, error, eval, every, example_list, exec, execArgv,
110-
exit, exitCode, export_dict, exports, expression, extra, file, fileList,
111-
fileURLToPath, filter, finally, flag, floor, for, forEach,
105+
endsWith, entries, env, error, eval, every, example_list, excludeList, exec,
106+
execArgv, exit, exitCode, export_dict, exports, expression, extra, file,
107+
fileList, fileURLToPath, filter, finally, flag, floor, for, forEach,
112108
formatted_message, free, freeze, from, froms, fsWriteFileWithParents,
113109
fud_stmt, functionName, function_list, function_stack, functions, get,
114-
getset, github_repo, global, global_dict, global_list, holeList, htmlEscape,
115-
id, identifier, import, import_list, inc, indent2, index, indexOf, init,
116-
initial, isArray, isBlockCoverage, isHole, isNaN, is_equal, is_fart,
117-
is_weird, join, jslint, jslint_apidoc, jslint_assert, jslint_charset_ascii,
118-
jslint_cli, jslint_edition, jslint_phase1_split, jslint_phase2_lex,
119-
jslint_phase3_parse, jslint_phase4_walk, jslint_phase5_whitage,
120-
jslint_report, json, jstestDescribe, jstestIt, jstestOnExit, keys, label,
121-
lbp, led_infix, length, level, line, lineList, line_list, line_offset,
122-
line_source, lines, linesCovered, linesTotal, live, log, long, loop, m, map,
123-
margin, match, max, message, meta, min, mkdir, modeCoverageIgnoreFile,
124-
modeIndex, mode_cli, mode_conditional, mode_json, mode_module, mode_noop,
125-
mode_property, mode_shebang, mode_stop, module, moduleFsInit, moduleName,
126-
module_list, name, names, node, noop, now, nr, nud_prefix,
127-
objectDeepCopyWithKeysSorted, ok, on, open, opening, option, option_dict,
128-
order, package_name, padEnd, padStart, parameters, parent, parentIi, parse,
129-
pathname, platform, pop, processArgv, process_argv, process_env,
130-
process_exit, promises, property, property_dict, push, quote, ranges,
131-
readFile, readdir, readonly, recursive, reduce, repeat, replace, resolve,
132-
result, reverse, role, round, scriptId, search, set, shebang, shift,
133-
signature, single, slice, some, sort, source, spawn, splice, split, stack,
134-
stack_trace, start, startOffset, startsWith, statement, statement_prv,
135-
stdio, stop, stop_at, stringify, switch, syntax_dict, tenure, test,
136-
test_cause, test_internal_error, this, thru, toString, token, token_global,
137-
token_list, token_nxt, token_tree, tokens, trace, tree, trim, trimEnd,
138-
trimRight, try, type, unlink, unordered, unshift, url, used,
139-
v8CoverageListMerge, v8CoverageReportCreate, value, variable, version,
140-
versions, warn, warn_at, warning, warning_list, warnings, white, wrapped,
141-
writeFile
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, noop, now, nr, nud_prefix, objectDeepCopyWithKeysSorted,
124+
ok, on, open, opening, option, option_dict, order, package_name, padEnd,
125+
padStart, parameters, parent, parentIi, parse, pathname, pathnameList,
126+
platform, pop, processArgv, process_argv, process_env, process_exit,
127+
promises, property, property_dict, push, quote, ranges, readFile, readdir,
128+
readonly, recursive, reduce, repeat, replace, resolve, result, reverse,
129+
role, round, scriptId, search, set, shebang, shift, signature, single,
130+
slice, some, sort, source, spawn, splice, split, stack, stack_trace, start,
131+
startOffset, startsWith, statement, statement_prv, stdio, stop, stop_at,
132+
stringify, switch, syntax_dict, tenure, test, test_cause,
133+
test_internal_error, this, thru, toString, token, token_global, token_list,
134+
token_nxt, token_tree, tokens, trace, tree, trim, trimEnd, trimRight, try,
135+
type, unlink, unordered, unshift, url, used, v8CoverageListMerge,
136+
v8CoverageReportCreate, value, variable, version, versions, warn, warn_at,
137+
warning, warning_list, warnings, white, wrapped, writeFile
142138
*/
143139

144140
// init debugInline
@@ -168,7 +164,7 @@ let jslint_charset_ascii = (
168164
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
169165
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
170166
);
171-
let jslint_edition = "v2022.5.20";
167+
let jslint_edition = "v2022.6.1-beta";
172168
let jslint_export; // The jslint object to be exported.
173169
let jslint_fudge = 1; // Fudge starting line and starting
174170
// ... column to 1.
@@ -716,10 +712,11 @@ function jslint(
716712
return false;
717713
}
718714
if (aa.arity === bb.arity && aa.id === bb.id) {
719-
if (aa.id === ".") {
715+
if (aa.id === "." || aa.id === "?.") {
720716

721717
// test_cause:
722718
// ["aa.bb&&aa.bb", "is_equal", "recurse_arity_id", "", 0]
719+
// ["aa?.bb&&aa?.bb", "is_equal", "recurse_arity_id", "", 0]
723720

724721
test_cause("recurse_arity_id");
725722
return (
@@ -4487,6 +4484,8 @@ function jslint_phase3_parse(state) {
44874484
left.id !== "["
44884485
|| (
44894486
name.id !== "concat"
4487+
&& name.id !== "flat"
4488+
&& name.id !== "flatMap"
44904489
&& name.id !== "forEach"
44914490
&& name.id !== "join"
44924491
&& name.id !== "map"
@@ -9805,6 +9804,7 @@ async function jstestDescribe(description, testFunction) {
98059804

98069805
let message;
98079806
let result;
9807+
let timerTimeout;
98089808

98099809
// Init jstestTimeStart.
98109810

@@ -9820,7 +9820,9 @@ async function jstestDescribe(description, testFunction) {
98209820

98219821
// Wait for jstestItList to resolve.
98229822

9823+
timerTimeout = setTimeout(noop, 0x7fffffff);
98239824
result = await Promise.all(jstestItList);
9825+
clearTimeout(timerTimeout);
98249826

98259827
// Print test results.
98269828

jslint_ci.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ import moduleFs from "fs";
437437
fileDict[file] = await moduleFs.promises.readFile(file, "utf8");
438438
}));
439439
Array.from(fileDict["CHANGELOG.md"].matchAll(
440-
/\n\n# (v\d\d\d\d\.\d\d?\.\d\d?(.*?)?)\n/g
440+
/\n\n# v(\d\d\d\d\.\d\d?\.\d\d?(-.*?)?)\n/g
441441
)).slice(0, 2).forEach(function ([
442442
ignore, version, isBeta
443443
]) {
@@ -449,12 +449,12 @@ import moduleFs from "fs";
449449
file: "README.md",
450450
src: fileDict["README.md"].replace((
451451
/\bv\d\d\d\d\.\d\d?\.\d\d?\b/m
452-
), versionMaster)
452+
), `v${versionMaster}`)
453453
}, {
454454
file: "package.json",
455455
src: fileDict["package.json"].replace((
456-
/("version": )".*?"/
457-
), "$1" + JSON.stringify(versionBeta.slice(1)))
456+
/ "version": "\d\d\d\d\.\d\d?\.\d\d?(?:-.*?)?"/
457+
), ` "version": "${versionBeta}"`)
458458
}
459459
].map(async function ({
460460
file,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
"test2": "sh jslint_ci.sh shCiBase"
3434
},
3535
"type": "module",
36-
"version": "2022.5.20"
36+
"version": "2022.6.1-beta"
3737
}

0 commit comments

Comments
 (0)