@jslint-org/jslint 2023.1.29 → 2023.5.23

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 CHANGED
@@ -5,9 +5,31 @@
5
5
  - coverage - add macros `/*coverage-disable*/` and `/*coverage-enable*/`.
6
6
  - jslint - add html and css linting back into jslint.
7
7
  - jslint - add new warning requiring paren around plus-separated concatenations.
8
- - jslint - require regexp to use open-form.
9
8
  - jslint - try to improve parser to be able to parse jquery.js without stopping.
10
- - jslint - unify analysis of variable-assignment/function-parameters into one function
9
+
10
+ # v2023.5.23
11
+ - jslint - Check exported properties are ordered.
12
+ - jslint - Add grammar for "export async function ...".
13
+ - python - Add shell-function shLintPython().
14
+ - jslint - Add grammar for regexp-named-capture-group and regexp-named-backreference.
15
+ - jslint - Add grammar for side-effect import-statement.
16
+ - ci - Rename shell-function shRawLibFetch() to shRollupFetch().
17
+ - doc - document devop procedures to maintain jslint-repo
18
+
19
+ # v2023.4.29
20
+ - vscode - Add manual lint-on-save command to vscode-jslint extension.
21
+ - ci - add custom-shell-ci hooks to script jslint_ci.sh:
22
+ shCiArtifactUploadCustom()
23
+ shCiBaseCustom()
24
+ shCiBaseCustom2()
25
+ shCiLintCustom()
26
+ shCiLintCustom2()
27
+ shCiNpmPublishCustom()
28
+ shCiPreCustom()
29
+ shCiPreCustom2()
30
+ - ci - housekeeping of ci-file jslint_ci.sh
31
+ - ci - update shell-function shGitCommitPushOrSquash() to be able to save to specified filename
32
+ - ci - remove little-used shell-function shCiBranchPromote()
11
33
 
12
34
  # v2023.1.29
13
35
  - ci - in windows-ci-env, alias node=node.exe instead of using winpty for pipes
package/README.md CHANGED
@@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>
3
3
 
4
4
 
5
5
  # Status
6
- | Branch | [master<br>(v2023.1.29)](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) |
6
+ | Branch | [master<br>(v2023.5.23)](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 | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jslint-org/jslint/actions?query=branch%3Amaster) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=beta)](https://github.com/jslint-org/jslint/actions?query=branch%3Abeta) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=alpha)](https://github.com/jslint-org/jslint/actions?query=branch%3Aalpha) |
9
9
  | Coverage | [![coverage](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/index.html) |
@@ -73,6 +73,12 @@ Douglas Crockford <douglas@crockford.com>
73
73
 
74
74
  12. [License](#license)
75
75
 
76
+ 13. [Devops Instruction](#devops-instruction)
77
+ - [branch-master commit](#branch-master-commit)
78
+ - [branch-master publish](#branch-master-publish)
79
+ - [pull-request merge](#pull-request-merge)
80
+ - [vscode-jslint publish](#vscode-jslint-publish)
81
+
76
82
 
77
83
  <br><br>
78
84
  # Web Demo
@@ -895,6 +901,96 @@ eval("1"); //jslint-ignore-line
895
901
  - CodeMirror editor is under [MIT License](https://github.com/codemirror/codemirror5/blob/d0e3b2e727c41aa4fd89fbad0adfb3815339174c/LICENSE).
896
902
  - Function `v8CoverageListMerge` is derived from [MIT Licensed v8-coverage](https://github.com/demurgos/v8-coverage/blob/73446087dc38f61b09832c9867122a23f8577099/ts/LICENSE.md).
897
903
 
904
+
905
+ <br><br>
906
+ # Devops Instruction
907
+
908
+
909
+ <br><br>
910
+ ### branch-master commit
911
+ - $ `shGitSquashPop <commit-beta> '# v20yy.mm.dd\n<release notes from CHANGELOG.md>'`
912
+ - verify correct-year `20yy`
913
+ - $ `git push origin alpha:branch-v20yy.mm.dd`
914
+ - $ `git push upstream alpha -f`
915
+ - verify ci-success for upstream-branch-alpha
916
+ - https://github.com/jslint-org/jslint/actions/workflows/ci.yml
917
+ - goto https://github.com/kaizhu256/jslint/pulls
918
+ - click `New pull request`
919
+ - click `base repository: jslint-org/jslint base:beta`
920
+ - click `head repository: kaizhu256/jslint compare:branch-v20yy.mm.dd`
921
+ - click `Create pull request`
922
+ - verify ci-success for pull-request
923
+ - https://github.com/jslint-org/jslint/actions/workflows/on_pull_request.yml
924
+ - click `Rebase and merge`
925
+ - verify ci-success for upstream-branch-beta
926
+ - https://github.com/jslint-org/jslint/actions/workflows/ci.yml
927
+ ```shell
928
+ git fetch upstream beta
929
+ git diff alpha..upstream/beta
930
+ # verify no diff between alpha..upstream/beta
931
+ git reset upstream/beta
932
+ git push origin alpha -f
933
+ git push origin alpha:beta
934
+ git push upstream alpha -f
935
+ git push origin :branch-v20yy.mm.dd -f
936
+ ```
937
+ - verify ci-success for origin-branch-alpha
938
+ - https://github.com/kaizhu256/jslint/actions/workflows/ci.yml
939
+ - verify ci-success for upstream-branch-alpha
940
+ - https://github.com/jslint-org/jslint/actions/workflows/ci.yml
941
+
942
+
943
+ <br><br>
944
+ ### branch-master publish
945
+ - $ `git push upstream beta:master`
946
+ - verify ci-success for upstream-branch-master
947
+ - https://github.com/jslint-org/jslint/actions/workflows/ci.yml
948
+ - goto https://github.com/jslint-org/jslint/releases/new
949
+ - input tag `v20yy.mm.dd`
950
+ - click `Create new tag: v20yy.mm.dd on publish`
951
+ - verify correct-year `20yy`
952
+ - click `Target: master`
953
+ - input `Release title: v20yy.mm.dd - <description>`
954
+ - copy-paste release notes from CHANGELOG.md
955
+ - click `Generate release notes`
956
+ - click `Set as the latest release`
957
+ - click `Publish release`
958
+ - verify ci-success for upstream-branch-publish
959
+ - https://github.com/jslint-org/jslint/actions/workflows/ci.yml
960
+ - verify email-notification `Successfully published @jslint-org/jslint@20yy.mm.dd`
961
+
962
+
963
+ <br><br>
964
+ ### pull-request merge
965
+ - find highest issue-number at https://github.com/jslint-org/jslint/issues/, and add +1 to it for PR-xxx
966
+ - verify `commit into jslint-org:beta`
967
+ - verify ci-success for pull-request
968
+ - https://github.com/jslint-org/jslint/actions/workflows/on_pull_request.yml
969
+ - click `Rebase and merge`
970
+ - verify ci-success for upstream-branch-beta
971
+ - https://github.com/jslint-org/jslint/actions/workflows/ci.yml
972
+ ```shell
973
+ git fetch upstream beta
974
+ git diff upstream/beta
975
+ git reset upstream/beta
976
+ git push -f origin alpha alpha:beta
977
+ shMyciUpdate
978
+ git push -f upstream alpha
979
+ ```
980
+
981
+
982
+ <br><br>
983
+ ### vscode-jslint publish
984
+ - goto https://github.com/jslint-org/jslint/tree/gh-pages/branch-beta/.artifact/jslint_wrapper_vscode
985
+ - click `vscode-jslint-20yy.mm.dd.vsix`
986
+ - click `Download`
987
+ - goto https://marketplace.visualstudio.com/manage/publishers/jslint
988
+ - right-click `Update`
989
+ - drag-and-drop downloaded `vscode-jslint-20yy.mm.dd.vsix`
990
+ - click 'Upload'
991
+ - verify email-notification `[Succeeded] Extension publish on Visual Studio Marketplace - vscode-jslint`
992
+
993
+
898
994
  <!--
899
995
  Coverage-hack
900
996
  node --eval '
@@ -1,6 +1,6 @@
1
1
  /*jslint-disable*/
2
2
  /*
3
- shRawLibFetch
3
+ shRollupFetch
4
4
  {
5
5
  "fetchList": [
6
6
  {
package/jslint.mjs CHANGED
@@ -165,7 +165,7 @@ let jslint_charset_ascii = (
165
165
  + "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
166
166
  + "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
167
167
  );
168
- let jslint_edition = "v2023.1.29";
168
+ let jslint_edition = "v2023.5.23";
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.
@@ -1584,7 +1584,9 @@ ${name}<span class="apidocSignatureSpan">${signature}</span>
1584
1584
  ), "\n");
1585
1585
  return result;
1586
1586
  }));
1587
- // init module_list
1587
+
1588
+ // Init module_list.
1589
+
1588
1590
  module_list = await Promise.all(module_list.map(async function ({
1589
1591
  pathname
1590
1592
  }) {
@@ -1990,8 +1992,11 @@ async function jslint_cli({
1990
1992
  ).test(process_argv[1])
1991
1993
  || mode_cli
1992
1994
  )
1993
- && moduleUrl.fileURLToPath(import_meta_url)
1994
- === modulePath.resolve(process_argv[1])
1995
+ && (
1996
+ moduleUrl.fileURLToPath(import_meta_url)
1997
+ ===
1998
+ modulePath.resolve(process_argv[1])
1999
+ )
1995
2000
  )
1996
2001
  && !mode_cli
1997
2002
  ) {
@@ -2810,20 +2815,30 @@ function jslint_phase2_lex(state) {
2810
2815
  // Match a group that starts with left paren.
2811
2816
 
2812
2817
  char_after("(");
2813
- if (char === "?") {
2814
- char_after("?");
2815
- if (char === "=" || char === "!") {
2816
- char_after();
2817
- } else {
2818
- char_after(":");
2819
- }
2820
- } else if (char === ":") {
2818
+ switch (char) {
2819
+ case ":":
2821
2820
 
2822
2821
  // test_cause:
2823
2822
  // ["aa=/(:)/", "lex_regexp_group", "expected_a_before_b", ":", 6]
2824
2823
  // ["aa=/?/", "lex_regexp_group", "expected_a_before_b", "?", 5]
2825
2824
 
2826
2825
  warn_at("expected_a_before_b", line, column, "?", ":");
2826
+ break;
2827
+ case "?":
2828
+ char_after("?");
2829
+ switch (char) {
2830
+ case "!":
2831
+
2832
+ // PR-437 - Add grammar for regexp-named-capture-group.
2833
+
2834
+ case "<":
2835
+ case "=":
2836
+ char_after();
2837
+ break;
2838
+ default:
2839
+ char_after(":");
2840
+ }
2841
+ break;
2827
2842
  }
2828
2843
 
2829
2844
  // RegExp
@@ -2857,7 +2872,10 @@ function jslint_phase2_lex(state) {
2857
2872
  // ["aa=/\\/", "lex_regexp_group", "escape", "", 0]
2858
2873
 
2859
2874
  test_cause("escape");
2860
- char_after_escape("BbDdSsWw^${}[]():=!.|*+?");
2875
+
2876
+ // PR-437 - Add grammar for regexp-named-backreference.
2877
+
2878
+ char_after_escape("BbDdSsWw^${}[]():=!.|*+?k");
2861
2879
  break;
2862
2880
  case "^":
2863
2881
  if (snippet !== "^") {
@@ -6170,7 +6188,8 @@ function jslint_phase3_parse(state) {
6170
6188
  }
6171
6189
 
6172
6190
  function stmt_export() {
6173
- const the_export = token_now;
6191
+ let export_list = [];
6192
+ let the_export = token_now;
6174
6193
  let the_id;
6175
6194
  let the_name;
6176
6195
  let the_thing;
@@ -6214,9 +6233,13 @@ function jslint_phase3_parse(state) {
6214
6233
  export_dict.default = the_thing;
6215
6234
  the_export.expression.push(the_thing);
6216
6235
  } else {
6217
- if (token_nxt.id === "function") {
6236
+
6237
+ // PR-439 - Add grammar for "export async function ...".
6238
+
6239
+ if (token_nxt.id === "function" || token_nxt.id === "async") {
6218
6240
 
6219
6241
  // test_cause:
6242
+ // ["export async function aa(){}", "stmt_export", "freeze_exports", "async", 8]
6220
6243
  // ["export function aa(){}", "stmt_export", "freeze_exports", "function", 8]
6221
6244
 
6222
6245
  warn("freeze_exports");
@@ -6266,6 +6289,7 @@ function jslint_phase3_parse(state) {
6266
6289
  stop("expected_identifier_a");
6267
6290
  }
6268
6291
  the_id = token_nxt.id;
6292
+ export_list.push(token_nxt);
6269
6293
  the_name = token_global.context[the_id];
6270
6294
  if (the_name === undefined) {
6271
6295
 
@@ -6292,6 +6316,13 @@ function jslint_phase3_parse(state) {
6292
6316
  break;
6293
6317
  }
6294
6318
  }
6319
+
6320
+ // PR-439 - Check exported properties are ordered.
6321
+
6322
+ // test_cause:
6323
+ // ["export {bb, aa}", "check_ordered", "expected_a_b_before_c_d", "aa", 13]
6324
+
6325
+ check_ordered("export", export_list);
6295
6326
  advance("}");
6296
6327
  semicolon();
6297
6328
  } else {
@@ -6441,6 +6472,20 @@ function jslint_phase3_parse(state) {
6441
6472
  // }
6442
6473
 
6443
6474
  state.mode_module = true;
6475
+
6476
+ // PR-436 - Add grammar for side-effect import-statement.
6477
+
6478
+ if (token_nxt.id === "(string)") {
6479
+
6480
+ // test_cause:
6481
+ // ["import \"./aa.mjs\";", "stmt_import", "import_side_effect", "", 0]
6482
+
6483
+ test_cause("import_side_effect");
6484
+ warn("expected_a_b", token_nxt, "{", artifact());
6485
+ advance();
6486
+ semicolon();
6487
+ return the_import;
6488
+ }
6444
6489
  if (token_nxt.identifier) {
6445
6490
  name = token_nxt;
6446
6491
  advance();
@@ -11231,35 +11276,41 @@ function sentinel() {}
11231
11276
  if ((
11232
11277
  /^coverage-\d+?-\d+?-\d+?\.json$/
11233
11278
  ).test(file)) {
11234
- console.error("rm file " + coverageDir + file);
11279
+ consoleError("rm file " + coverageDir + file);
11235
11280
  await moduleFs.promises.unlink(coverageDir + file);
11236
11281
  }
11237
11282
  }));
11238
11283
  exitCode = await new Promise(function (resolve) {
11239
- moduleChildProcess.spawn((
11240
- processArgv[0] === "npm"
11284
+ moduleChildProcess.spawn(
11285
+ (
11286
+ processArgv[0] === "npm"
11241
11287
 
11242
11288
  // If win32 environment, then replace program npm with npm.cmd.
11243
11289
  // Coverage-hack - Ugly-hack to get test-coverage under both win32 and linux.
11244
11290
 
11245
- ? process.platform.replace("win32", "npm.cmd").replace(
11246
- process.platform,
11247
- "npm"
11248
- )
11249
- : processArgv[0]
11250
- ), processArgv.slice(1), {
11251
- env: Object.assign({}, process.env, {
11252
- NODE_V8_COVERAGE: coverageDir
11253
- }),
11254
- stdio: [
11255
- "ignore", 1, 2
11256
- ]
11257
- }).on("exit", resolve);
11291
+ ? process.platform.replace("win32", "npm.cmd").replace(
11292
+ process.platform,
11293
+ "npm"
11294
+ )
11295
+ : processArgv[0]
11296
+ ),
11297
+ processArgv.slice(1),
11298
+ {
11299
+ env: Object.assign({}, process.env, {
11300
+ NODE_V8_COVERAGE: coverageDir
11301
+ }),
11302
+ stdio: ["ignore", 1, 2]
11303
+ }
11304
+ ).on("exit", resolve);
11258
11305
  });
11306
+ consoleError(
11307
+ `v8CoverageReportCreate - program exited with exitCode=${exitCode}`
11308
+ );
11259
11309
  }
11260
11310
 
11261
11311
  // 2. Merge JSON v8-coverage-files in <coverageDir>.
11262
11312
 
11313
+ consoleError("v8CoverageReportCreate - merging coverage files...");
11263
11314
  v8CoverageObj = await moduleFs.promises.readdir(coverageDir);
11264
11315
  v8CoverageObj = v8CoverageObj.filter(function (file) {
11265
11316
  return (
@@ -11331,6 +11382,7 @@ function sentinel() {}
11331
11382
 
11332
11383
  // 3. Create html-coverage-reports in <coverageDir>.
11333
11384
 
11385
+ consoleError("v8CoverageReportCreate - creating html-coverage-report...");
11334
11386
  fileDict = Object.create(null);
11335
11387
  await Promise.all(v8CoverageObj.result.map(async function ({
11336
11388
  functions,
@@ -30,11 +30,12 @@
30
30
  /*property
31
31
  Diagnostic, DiagnosticSeverity, ProgressLocation, Warning, Window, activate,
32
32
  cancellable, character, clear, column, commands, createDiagnosticCollection,
33
- document, end, endsWith, exports, getText, increment, insert, isEmpty,
34
- jslint, languages, line, lineAt, location, map, message, module, push,
35
- range, rangeIncludingLineBreak, readFileSync, registerTextEditorCommand,
36
- replace, report, runInNewContext, selection, set, slice, start,
37
- subscriptions, title, uri, warnings, window, withProgress
33
+ document, end, endsWith, exports, fsPath, getText, increment, insert,
34
+ isEmpty, jslint, languages, line, lineAt, location, map, message, module,
35
+ promises, push, range, rangeIncludingLineBreak, readFileSync,
36
+ registerTextEditorCommand, replace, report, runInNewContext, selection, set,
37
+ slice, start, subscriptions, title, uri, warnings, window, withProgress,
38
+ writeFile
38
39
  */
39
40
 
40
41
  "use strict";
@@ -182,6 +183,20 @@ function activate({
182
183
  });
183
184
  }
184
185
 
186
+ // PR-429 - Add manual lint-on-save command.
187
+
188
+ async function jslintLintAndSave({
189
+ document
190
+ }) {
191
+ jslintLint({
192
+ document
193
+ });
194
+ await require("fs").promises.writeFile(
195
+ document.uri.fsPath,
196
+ document.getText()
197
+ );
198
+ }
199
+
185
200
  // Initialize vscode and jslint.
186
201
 
187
202
  vscode = require("vscode");
@@ -222,6 +237,9 @@ function activate({
222
237
  subscriptions.push(vscode.commands.registerTextEditorCommand((
223
238
  "jslint.lint"
224
239
  ), jslintLint));
240
+ subscriptions.push(vscode.commands.registerTextEditorCommand((
241
+ "jslint.lintAndSave"
242
+ ), jslintLintAndSave));
225
243
  }
226
244
 
227
245
  exports.activate = activate;
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "shCiArtifactUpload": 1,
36
36
  "shCiNpmPublish": 1,
37
37
  "type": "module",
38
- "version": "2023.1.29"
38
+ "version": "2023.5.23"
39
39
  }