@jslint-org/jslint 2025.3.31 → 2025.12.28
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 +45 -6
- package/jslint.mjs +82 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
# Todo
|
|
4
4
|
- doc - document supported/unsupported es6+ features
|
|
5
|
-
- coverage - add macros `/*coverage-disable*/` and `/*coverage-enable*/`.
|
|
6
5
|
- jslint - add html and css linting back into jslint.
|
|
7
6
|
- jslint - add new warning requiring paren around plus-separated concatenations.
|
|
8
7
|
- jslint - try to improve parser to be able to parse jquery.js without stopping.
|
|
9
8
|
|
|
9
|
+
# v2025.12.28
|
|
10
|
+
- ci - Update file publish.yml to use trusted-publishing for npm packages.
|
|
11
|
+
- jslint - regression-fix - Warn about variable usage before initialization.
|
|
12
|
+
- jslint - Allow parenthesis after ellipsis inside a function call.
|
|
13
|
+
- ci - Upgrade nodejs used in ci to v24.
|
|
14
|
+
|
|
15
|
+
# v2025.10.31
|
|
16
|
+
- coverage - Add coverage-directives '/*coverage-disable*/', '/*coverage-enable*/'. '//coverage-ignore-line'.
|
|
17
|
+
|
|
10
18
|
# v2025.3.31
|
|
11
19
|
- ci - Upgrade nodejs used in ci to v22.
|
|
12
20
|
- ubuntu-ci - bugfix - Fix out-of-date apt-list when installing graphicsmagick.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# Status
|
|
6
|
-
| Branch | [master<br>(v2025.
|
|
6
|
+
| Branch | [master<br>(v2025.12.28)](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) |
|
|
@@ -66,6 +66,8 @@ Douglas Crockford <douglas@crockford.com>
|
|
|
66
66
|
- [Directive `/*property*/`](#directive-property)
|
|
67
67
|
- [Directive `/*jslint-disable*/.../*jslint-enable*/`](#directive-jslint-disablejslint-enable)
|
|
68
68
|
- [Directive `//jslint-ignore-line`](#directive-jslint-ignore-line)
|
|
69
|
+
- [Directive `/*coverage-disable*/.../*coverage-enable*/`](#directive-coverage-disablecoverage-enable)
|
|
70
|
+
- [Directive `//coverage-ignore-line`](#directive-coverage-ignore-line)
|
|
69
71
|
|
|
70
72
|
10. [Package Listing](#package-listing)
|
|
71
73
|
|
|
@@ -891,6 +893,34 @@ eval("1"); //jslint-ignore-line
|
|
|
891
893
|
```
|
|
892
894
|
|
|
893
895
|
|
|
896
|
+
<br><br>
|
|
897
|
+
### Directive `/*coverage-disable*/.../*coverage-enable*/`
|
|
898
|
+
|
|
899
|
+
```js
|
|
900
|
+
/*coverage-disable*/
|
|
901
|
+
|
|
902
|
+
// JSLint will ignore code-coverage in this region.
|
|
903
|
+
|
|
904
|
+
if (false) {
|
|
905
|
+
console.log("hello world");
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/*coverage-enable*/
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
<br><br>
|
|
913
|
+
### Directive `//coverage-ignore-line`
|
|
914
|
+
|
|
915
|
+
```js
|
|
916
|
+
// JSLint will ignore code-coverage at given line.
|
|
917
|
+
|
|
918
|
+
if (false) {
|
|
919
|
+
console.log("hello world"); //coverage-ignore-line
|
|
920
|
+
}
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
|
|
894
924
|
<br><br>
|
|
895
925
|
# Package Listing
|
|
896
926
|

|
|
@@ -917,13 +947,14 @@ eval("1"); //jslint-ignore-line
|
|
|
917
947
|
<br><br>
|
|
918
948
|
### pull-request merge
|
|
919
949
|
- find highest issue-number at https://github.com/jslint-org/jslint/issues/, https://github.com/jslint-org/jslint/pulls/, and add +1 to it for PR-xxx
|
|
950
|
+
- checkpoint local-branch-beta
|
|
920
951
|
- `shGitPullrequest beta beta`
|
|
921
952
|
- verify ci-success for origin-branch-alpha
|
|
922
953
|
- https://github.com/kaizhu256/jslint/actions
|
|
923
954
|
- `git push upstream alpha -f`
|
|
924
955
|
- verify ci-success for upstream-branch-alpha
|
|
925
956
|
- https://github.com/jslint-org/jslint/actions
|
|
926
|
-
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-
|
|
957
|
+
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-p2025.12.14
|
|
927
958
|
- click `Create pull request`
|
|
928
959
|
- input `Add your description here...` with:
|
|
929
960
|
```
|
|
@@ -943,7 +974,7 @@ This PR will additionally:
|
|
|
943
974
|
- verify ci-success for pull-request
|
|
944
975
|
- https://github.com/jslint-org/jslint/actions/workflows/on_pull_request.yml
|
|
945
976
|
- wait awhile before continuing ...
|
|
946
|
-
- click `
|
|
977
|
+
- click `Squash and merge`
|
|
947
978
|
- verify ci-success for upstream-branch-beta
|
|
948
979
|
- https://github.com/jslint-org/jslint/actions
|
|
949
980
|
- `shGitPullrequestCleanup`
|
|
@@ -957,13 +988,15 @@ This PR will additionally:
|
|
|
957
988
|
|
|
958
989
|
<br><br>
|
|
959
990
|
### branch-master commit
|
|
960
|
-
-
|
|
991
|
+
- update ci.yml to latest nodejs-lts
|
|
992
|
+
- checkpoint local-branch-beta
|
|
993
|
+
- `shGitPullrequest master beta # re-run until version propagates`
|
|
961
994
|
- verify ci-success for origin-branch-alpha
|
|
962
995
|
- https://github.com/kaizhu256/jslint/actions
|
|
963
996
|
- `git push upstream alpha -f`
|
|
964
997
|
- verify ci-success for upstream-branch-alpha
|
|
965
998
|
- https://github.com/jslint-org/jslint/actions
|
|
966
|
-
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-v2025.
|
|
999
|
+
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-v2025.12.28
|
|
967
1000
|
- click `Create pull request`
|
|
968
1001
|
- input `Add a title` with: `# v20yy.mm.dd`
|
|
969
1002
|
- input `Add a description` with:
|
|
@@ -976,7 +1009,7 @@ This PR will additionally:
|
|
|
976
1009
|
- verify ci-success for pull-request
|
|
977
1010
|
- https://github.com/jslint-org/jslint/actions/workflows/on_pull_request.yml
|
|
978
1011
|
- wait awhile before continuing ...
|
|
979
|
-
- click `
|
|
1012
|
+
- click `Squash and merge`
|
|
980
1013
|
- verify ci-success for upstream-branch-beta
|
|
981
1014
|
- https://github.com/jslint-org/jslint/actions
|
|
982
1015
|
- `shGitPullrequestCleanup`
|
|
@@ -996,6 +1029,12 @@ This PR will additionally:
|
|
|
996
1029
|
|
|
997
1030
|
<br><br>
|
|
998
1031
|
### branch-master publish
|
|
1032
|
+
- goto https://www.npmjs.com/package/@jslint-org/jslint/access <!--no-validate-->
|
|
1033
|
+
- click `Github Actions`
|
|
1034
|
+
- input `Organization or user*` with: `jslint-org`
|
|
1035
|
+
- input `Repository*` with: `jslint`
|
|
1036
|
+
- input `Workflow filename*` with: `publish.yml`
|
|
1037
|
+
- click `Set up connection` or `Update Package Settings`
|
|
999
1038
|
- `git push upstream beta:master`
|
|
1000
1039
|
- verify ci-success for upstream-branch-master
|
|
1001
1040
|
- https://github.com/jslint-org/jslint/actions
|
package/jslint.mjs
CHANGED
|
@@ -106,9 +106,9 @@
|
|
|
106
106
|
formatted_message, free, freeze, from, froms, fsWriteFileWithParents,
|
|
107
107
|
fud_stmt, functionName, function_list, function_stack, functions, get,
|
|
108
108
|
getset, github_repo, globExclude, global, global_dict, global_list,
|
|
109
|
-
holeList, htmlEscape, id, identifier, import, import_list,
|
|
110
|
-
inc, includeList, indent2, index, indexOf, init, initial,
|
|
111
|
-
isBlockCoverage, isHole, isNaN, is_equal, is_weird, join, jslint,
|
|
109
|
+
holeList, htmlEscape, id, identifier, ignoreLine, import, import_list,
|
|
110
|
+
import_meta_url, inc, includeList, indent2, index, indexOf, init, initial,
|
|
111
|
+
isArray, isBlockCoverage, isHole, isNaN, is_equal, is_weird, join, jslint,
|
|
112
112
|
jslint_apidoc, jslint_assert, jslint_charset_ascii, jslint_cli,
|
|
113
113
|
jslint_edition, jslint_phase1_split, jslint_phase2_lex, jslint_phase3_parse,
|
|
114
114
|
jslint_phase4_walk, jslint_phase5_whitage, jslint_report, json,
|
|
@@ -163,7 +163,7 @@ let jslint_charset_ascii = (
|
|
|
163
163
|
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
|
164
164
|
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
|
|
165
165
|
);
|
|
166
|
-
let jslint_edition = "v2025.
|
|
166
|
+
let jslint_edition = "v2025.12.28";
|
|
167
167
|
let jslint_export; // The jslint object to be exported.
|
|
168
168
|
let jslint_fudge = 1; // Fudge starting line and starting
|
|
169
169
|
// ... column to 1.
|
|
@@ -4674,7 +4674,13 @@ function jslint_phase3_parse(state) {
|
|
|
4674
4674
|
|
|
4675
4675
|
test_cause("free");
|
|
4676
4676
|
the_paren.free = true;
|
|
4677
|
-
if (
|
|
4677
|
+
if (
|
|
4678
|
+
the_argument.wrapped === true
|
|
4679
|
+
|
|
4680
|
+
// PR-483 - Allow parenthesis after ellipsis inside a function call.
|
|
4681
|
+
|
|
4682
|
+
&& the_argument.ellipsis !== true
|
|
4683
|
+
) {
|
|
4678
4684
|
|
|
4679
4685
|
// test_cause:
|
|
4680
4686
|
// ["aa((0))", "infix_lparen", "unexpected_a", "(", 3]
|
|
@@ -5158,6 +5164,10 @@ function jslint_phase3_parse(state) {
|
|
|
5158
5164
|
the_label.dead = false;
|
|
5159
5165
|
the_label.init = true;
|
|
5160
5166
|
the_statement = parse_statement();
|
|
5167
|
+
|
|
5168
|
+
// Issue #458 - Regression - Warn about variable usage before initialization.
|
|
5169
|
+
|
|
5170
|
+
the_label.dead = true;
|
|
5161
5171
|
functionage.statement_prv = the_statement;
|
|
5162
5172
|
the_statement.label = the_label;
|
|
5163
5173
|
the_statement.statement = true;
|
|
@@ -5204,9 +5214,13 @@ function jslint_phase3_parse(state) {
|
|
|
5204
5214
|
}
|
|
5205
5215
|
semicolon();
|
|
5206
5216
|
}
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5217
|
+
|
|
5218
|
+
// Issue #458 - Regression - Warn about variable usage before initialization.
|
|
5219
|
+
|
|
5220
|
+
// if (the_label !== undefined) {
|
|
5221
|
+
// the_label.dead = true;
|
|
5222
|
+
// }
|
|
5223
|
+
|
|
5210
5224
|
return the_statement;
|
|
5211
5225
|
}
|
|
5212
5226
|
|
|
@@ -6987,8 +7001,16 @@ function jslint_phase3_parse(state) {
|
|
|
6987
7001
|
the_variable.names.push(name);
|
|
6988
7002
|
enroll(name, "variable", mode_const);
|
|
6989
7003
|
}
|
|
6990
|
-
|
|
7004
|
+
|
|
7005
|
+
// Issue #458 - Regression - Warn about variable usage before initialization.
|
|
7006
|
+
|
|
7007
|
+
// name.dead = false;
|
|
7008
|
+
|
|
6991
7009
|
name.init = true;
|
|
7010
|
+
|
|
7011
|
+
// test_cause:
|
|
7012
|
+
// ["const {aa}=bb;\nconst bb=0;", "lookup", "out_of_scope_a", "bb", 12]
|
|
7013
|
+
|
|
6992
7014
|
if (token_nxt.id === "=") {
|
|
6993
7015
|
|
|
6994
7016
|
// test_cause:
|
|
@@ -7039,8 +7061,16 @@ function jslint_phase3_parse(state) {
|
|
|
7039
7061
|
advance();
|
|
7040
7062
|
the_variable.names.push(name);
|
|
7041
7063
|
enroll(name, "variable", mode_const);
|
|
7042
|
-
|
|
7064
|
+
|
|
7065
|
+
// Issue #458 - Regression - Warn about variable usage before initialization.
|
|
7066
|
+
|
|
7067
|
+
// name.dead = false;
|
|
7068
|
+
|
|
7043
7069
|
name.init = true;
|
|
7070
|
+
|
|
7071
|
+
// test_cause:
|
|
7072
|
+
// ["const [aa]=bb;\nconst bb=0;", "lookup", "out_of_scope_a", "bb", 12]
|
|
7073
|
+
|
|
7044
7074
|
if (ellipsis) {
|
|
7045
7075
|
name.ellipsis = true;
|
|
7046
7076
|
break;
|
|
@@ -7073,8 +7103,16 @@ function jslint_phase3_parse(state) {
|
|
|
7073
7103
|
enroll(name, "variable", mode_const);
|
|
7074
7104
|
if (token_nxt.id === "=" || mode_const) {
|
|
7075
7105
|
advance("=");
|
|
7076
|
-
|
|
7106
|
+
|
|
7107
|
+
// Issue #458 - Regression - Warn about variable usage before initialization.
|
|
7108
|
+
|
|
7109
|
+
// name.dead = false;
|
|
7110
|
+
|
|
7077
7111
|
name.init = true;
|
|
7112
|
+
|
|
7113
|
+
// test_cause:
|
|
7114
|
+
// ["const aa=bb;\nconst bb=0;", "lookup", "out_of_scope_a", "bb", 10]
|
|
7115
|
+
|
|
7078
7116
|
name.expression = parse_expression(0);
|
|
7079
7117
|
}
|
|
7080
7118
|
the_variable.names.push(name);
|
|
@@ -10882,12 +10920,15 @@ body {
|
|
|
10882
10920
|
background: #9d9;
|
|
10883
10921
|
}
|
|
10884
10922
|
.coverage .count {
|
|
10885
|
-
color: #
|
|
10923
|
+
color: #333;
|
|
10886
10924
|
}
|
|
10887
10925
|
.coverage .coverageIgnore {
|
|
10888
10926
|
background: #ccc;
|
|
10889
10927
|
}
|
|
10890
10928
|
.coverage .coverageLow,
|
|
10929
|
+
.coverage .ignore {
|
|
10930
|
+
background: #ccc;
|
|
10931
|
+
}
|
|
10891
10932
|
.coverage .uncovered {
|
|
10892
10933
|
background: #ebb;
|
|
10893
10934
|
}
|
|
@@ -10911,6 +10952,10 @@ body {
|
|
|
10911
10952
|
.coverage tr:hover td {
|
|
10912
10953
|
background: #7d7;
|
|
10913
10954
|
}
|
|
10955
|
+
.coverage pre:hover span.ignore,
|
|
10956
|
+
.coverage tr:hover td.coverageIgnore {
|
|
10957
|
+
background: #ccc;
|
|
10958
|
+
}
|
|
10914
10959
|
.coverage pre:hover span.uncovered,
|
|
10915
10960
|
.coverage tr:hover td.coverageLow {
|
|
10916
10961
|
background: #f99;
|
|
@@ -11112,6 +11157,7 @@ body {
|
|
|
11112
11157
|
lineList.forEach(function ({
|
|
11113
11158
|
count,
|
|
11114
11159
|
holeList,
|
|
11160
|
+
ignoreLine,
|
|
11115
11161
|
line,
|
|
11116
11162
|
startOffset
|
|
11117
11163
|
}, ii) {
|
|
@@ -11159,7 +11205,11 @@ body {
|
|
|
11159
11205
|
// true.
|
|
11160
11206
|
|
|
11161
11207
|
if (isHole) {
|
|
11162
|
-
lineHtml +=
|
|
11208
|
+
lineHtml += (
|
|
11209
|
+
ignoreLine
|
|
11210
|
+
? " class=\"ignore\""
|
|
11211
|
+
: " class=\"uncovered\""
|
|
11212
|
+
);
|
|
11163
11213
|
}
|
|
11164
11214
|
lineHtml += ">";
|
|
11165
11215
|
chunk = "";
|
|
@@ -11179,7 +11229,9 @@ body {
|
|
|
11179
11229
|
</span>
|
|
11180
11230
|
<span class="count
|
|
11181
11231
|
${(
|
|
11182
|
-
count <= 0
|
|
11232
|
+
(count <= 0 && ignoreLine)
|
|
11233
|
+
? "ignore"
|
|
11234
|
+
: count <= 0
|
|
11183
11235
|
? "uncovered"
|
|
11184
11236
|
: ""
|
|
11185
11237
|
)}"
|
|
@@ -11416,6 +11468,7 @@ function sentinel() {}
|
|
|
11416
11468
|
functions,
|
|
11417
11469
|
url: pathname
|
|
11418
11470
|
}) {
|
|
11471
|
+
let ignoreBlock = false;
|
|
11419
11472
|
let lineList;
|
|
11420
11473
|
let linesCovered;
|
|
11421
11474
|
let linesTotal;
|
|
@@ -11425,14 +11478,23 @@ function sentinel() {}
|
|
|
11425
11478
|
source.replace((
|
|
11426
11479
|
/^.*$/gm
|
|
11427
11480
|
), function (line, startOffset) {
|
|
11481
|
+
if (line === "/*coverage-disable*/") {
|
|
11482
|
+
ignoreBlock = true;
|
|
11483
|
+
}
|
|
11428
11484
|
lineList[lineList.length - 1].endOffset = startOffset - 1;
|
|
11429
11485
|
lineList.push({
|
|
11430
11486
|
count: -1,
|
|
11431
11487
|
endOffset: 0,
|
|
11432
11488
|
holeList: [],
|
|
11489
|
+
ignoreLine: (
|
|
11490
|
+
ignoreBlock || line.endsWith("//coverage-ignore-line")
|
|
11491
|
+
),
|
|
11433
11492
|
line,
|
|
11434
11493
|
startOffset
|
|
11435
11494
|
});
|
|
11495
|
+
if (line === "/*coverage-enable*/") {
|
|
11496
|
+
ignoreBlock = false;
|
|
11497
|
+
}
|
|
11436
11498
|
return "";
|
|
11437
11499
|
});
|
|
11438
11500
|
lineList.shift();
|
|
@@ -11485,11 +11547,13 @@ function sentinel() {}
|
|
|
11485
11547
|
});
|
|
11486
11548
|
});
|
|
11487
11549
|
linesTotal = lineList.length;
|
|
11488
|
-
linesCovered =
|
|
11489
|
-
|
|
11550
|
+
linesCovered = 0;
|
|
11551
|
+
lineList.forEach(function ({
|
|
11552
|
+
count,
|
|
11553
|
+
ignoreLine
|
|
11490
11554
|
}) {
|
|
11491
|
-
|
|
11492
|
-
})
|
|
11555
|
+
linesCovered += count > 0 || ignoreLine;
|
|
11556
|
+
});
|
|
11493
11557
|
await moduleFs.promises.mkdir((
|
|
11494
11558
|
modulePath.dirname(coverageDir + pathname)
|
|
11495
11559
|
), {
|
package/package.json
CHANGED