@jslint-org/jslint 2022.6.21 → 2022.7.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 CHANGED
@@ -1,8 +1,7 @@
1
1
  # Changelog
2
2
 
3
3
  # Todo
4
- - wrapper - add vscode-command to suppress minor warnings on given line
5
- - doc - document jslint directives and supported/unsupported es6+ features
4
+ - doc - document supported/unsupported es6+ features
6
5
  - cli - remove cli-option `--mode-vim-plugin`
7
6
  - coverage - add macros `/*coverage-disable*/` and `/*coverage-enable*/`.
8
7
  - jslint - add html and css linting back into jslint.
@@ -14,6 +13,11 @@
14
13
  - jslint - add new warning "Expected Object.create(null) instead of {}"
15
14
  - node - after node-v14 is deprecated, remove shell-code `export "NODE_OPTIONS=--unhandled-rejections=strict"`.
16
15
 
16
+ # v2022.7.20
17
+ - bugfix - warnings that should be ignored sometimes suppress legitimate warnings
18
+ - doc - document jslint directives
19
+ - vscode - add extra contextmenu commands "JSLint - Do Not Lint Selected Region", "JSLint - Ignore Current Line"
20
+
17
21
  # v2022.6.21
18
22
  - directive - add new directive `subscript` for linting of scripts targeting Google Closure Compiler
19
23
  - bugfix - fix expression after "await" mis-identified as statement
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.21)](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>(v2022.7.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 | [![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) |
@@ -18,36 +18,59 @@ Douglas Crockford <douglas@crockford.com>
18
18
 
19
19
  2. [Web Demo Archived](#web-demo-archived)
20
20
 
21
- 3. [API Doc](#api-doc)
22
-
23
- 4. [Quickstart Install](#quickstart-install)
21
+ 3. [Quickstart Install](#quickstart-install)
24
22
  - [To install, just download and save https://www.jslint.com/jslint.mjs to file:](#to-install-just-download-and-save-httpswwwjslintcomjslintmjs-to-file)
25
23
  - [To run `jslint.mjs` in shell:](#to-run-jslintmjs-in-shell)
26
24
  - [To import `jslint.mjs` in ES Module environment:](#to-import-jslintmjs-in-es-module-environment)
27
25
  - [To import `jslint.mjs` in CommonJS environment:](#to-import-jslintmjs-in-commonjs-environment)
28
26
  - [To JSLint entire directory in shell:](#to-jslint-entire-directory-in-shell)
29
27
 
30
- 5. [Quickstart JSLint Report](#quickstart-jslint-report)
28
+ 4. [Quickstart JSLint Report](#quickstart-jslint-report)
31
29
  - [To create a JSLint report in shell:](#to-create-a-jslint-report-in-shell)
32
30
  - [To create a JSLint report in javascript:](#to-create-a-jslint-report-in-javascript)
33
31
 
34
- 6. [Quickstart V8 Coverage Report](#quickstart-v8-coverage-report)
32
+ 5. [Quickstart V8 Coverage Report](#quickstart-v8-coverage-report)
35
33
  - [To create V8 coverage report from Node.js / Npm program in shell:](#to-create-v8-coverage-report-from-nodejs--npm-program-in-shell)
36
34
  - [To create V8 coverage report from Node.js / Npm program in javascript:](#to-create-v8-coverage-report-from-nodejs--npm-program-in-javascript)
37
35
 
38
- 7. [Quickstart JSLint in CodeMirror](#quickstart-jslint-in-codemirror)
39
-
40
- 8. [Quickstart JSLint in Vim](#quickstart-jslint-in-vim)
41
-
42
- 9. [Quickstart JSLint in VSCode](#quickstart-jslint-in-vscode)
43
-
44
- 10. [Description](#description)
45
-
46
- 11. [Package Listing](#package-listing)
47
-
48
- 12. [Changelog](#changelog)
49
-
50
- 13. [License](#license)
36
+ 6. [Quickstart JSLint in CodeMirror](#quickstart-jslint-in-codemirror)
37
+
38
+ 7. [Quickstart JSLint in Vim](#quickstart-jslint-in-vim)
39
+
40
+ 8. [Quickstart JSLint in VSCode](#quickstart-jslint-in-vscode)
41
+
42
+ 9. [Documentation](#documentation)
43
+ - [API Doc](#api-doc)
44
+ - [Directive `/*jslint*/`](#directive-jslint)
45
+ - [`/*jslint beta*/`](#jslint-beta)
46
+ - [`/*jslint bitwise*/`](#jslint-bitwise)
47
+ - [`/*jslint browser*/`](#jslint-browser)
48
+ - [`/*jslint convert*/`](#jslint-convert)
49
+ - [`/*jslint couch*/`](#jslint-couch)
50
+ - [`/*jslint devel*/`](#jslint-devel)
51
+ - [`/*jslint eval*/`](#jslint-eval)
52
+ - [`/*jslint for*/`](#jslint-for)
53
+ - [`/*jslint getset*/`](#jslint-getset)
54
+ - [`/*jslint indent2*/`](#jslint-indent2)
55
+ - [`/*jslint long*/`](#jslint-long)
56
+ - [`/*jslint node*/`](#jslint-node)
57
+ - [`/*jslint nomen*/`](#jslint-nomen)
58
+ - [`/*jslint single*/`](#jslint-single)
59
+ - [`/*jslint subscript*/`](#jslint-subscript)
60
+ - [`/*jslint this*/`](#jslint-this)
61
+ - [`/*jslint trace*/`](#jslint-trace)
62
+ - [`/*jslint unordered*/`](#jslint-unordered)
63
+ - [`/*jslint white*/`](#jslint-white)
64
+ - [Directive `/*global*/`](#directive-global)
65
+ - [Directive `/*property*/`](#directive-property)
66
+ - [Directive `/*jslint-disable*/.../*jslint-enable*/`](#directive-jslint-disablejslint-enable)
67
+ - [Directive `//jslint-ignore-line`](#directive-jslint-ignore-line)
68
+
69
+ 10. [Package Listing](#package-listing)
70
+
71
+ 11. [Changelog](#changelog)
72
+
73
+ 12. [License](#license)
51
74
 
52
75
 
53
76
  <br><br>
@@ -64,13 +87,6 @@ Douglas Crockford <douglas@crockford.com>
64
87
  - [Web Demo 2013 (ES5, CSS, HTML)](https://www.jslint.com/branch-v2013.3.13/jslint.html)
65
88
 
66
89
 
67
- <br><br>
68
- # API Doc
69
- - https://www.jslint.com/apidoc.html
70
-
71
- [![screenshot](https://jslint-org.github.io/jslint/branch-beta/.artifact/screenshot_browser__2f.artifact_2fapidoc.html.png)](https://www.jslint.com/apidoc.html)
72
-
73
-
74
90
  <br><br>
75
91
  # Quickstart Install
76
92
 
@@ -504,7 +520,9 @@ window.addEventListener("load", function () {
504
520
 
505
521
 
506
522
  <br><br>
507
- # Description
523
+ # Documentation
524
+
525
+
508
526
  - [jslint.mjs](jslint.mjs) contains the jslint function. It parses and analyzes a source file, returning an object with information about the file. It can also take an object that sets options.
509
527
 
510
528
  - [index.html](index.html) runs the jslint.mjs function in a web page.
@@ -528,6 +546,324 @@ plays the part of a stern but benevolent editor, helping you to get the style
528
546
  right so that you can focus your creative energy where it is most needed.
529
547
 
530
548
 
549
+ <br><br>
550
+ ### API Doc
551
+ - https://www.jslint.com/apidoc.html
552
+
553
+ [![screenshot](https://jslint-org.github.io/jslint/branch-beta/.artifact/screenshot_browser__2f.artifact_2fapidoc.html.png)](https://www.jslint.com/apidoc.html)
554
+
555
+
556
+ <br><br>
557
+ ### Directive `/*jslint*/`
558
+
559
+ <br>
560
+
561
+ ##### `/*jslint beta*/`
562
+
563
+ ```js
564
+ /*jslint beta*/
565
+ // Enable experimental warnings.
566
+ // Warn if global variables are redefined.
567
+ // Warn if const / let statements are not declared at top of function or
568
+ // script, similar to var statements.
569
+ // Warn if const / let / var statements are not declared in ascii-order.
570
+ // Warn if named-functions are not declared in ascii-order.
571
+ ```
572
+
573
+ <br>
574
+
575
+ ##### `/*jslint bitwise*/`
576
+
577
+ ```js
578
+ /*jslint bitwise*/
579
+ // Allow bitwise operators.
580
+
581
+ let foo = 0 | 1;
582
+ ```
583
+
584
+ <br>
585
+
586
+ ##### `/*jslint browser*/`
587
+
588
+ ```js
589
+ /*jslint browser*/
590
+ // Assume browser environment.
591
+
592
+ localStorage.getItem("foo");
593
+ ```
594
+
595
+ <br>
596
+
597
+ ##### `/*jslint convert*/`
598
+
599
+ ```js
600
+ /*jslint convert*/
601
+ // Allow conversion operators.
602
+
603
+ let foo = new Date() + "";
604
+ let bar = !!0;
605
+ ```
606
+
607
+ <br>
608
+
609
+ ##### `/*jslint couch*/`
610
+
611
+ ```js
612
+ /*jslint couch*/
613
+ // Assume CouchDb environment.
614
+
615
+ registerType("text-json", "text/json");
616
+ ```
617
+
618
+ <br>
619
+
620
+ ##### `/*jslint devel*/`
621
+
622
+ ```js
623
+ /*jslint devel*/
624
+ // Allow console.log() and friends.
625
+
626
+ console.log("hello");
627
+ ```
628
+
629
+ <br>
630
+
631
+ ##### `/*jslint eval*/`
632
+
633
+ ```js
634
+ /*jslint eval*/
635
+ // Allow eval().
636
+
637
+ eval("1");
638
+ ```
639
+
640
+ <br>
641
+
642
+ ##### `/*jslint for*/`
643
+
644
+ ```js
645
+ /*jslint for*/
646
+ // Allow for-loop.
647
+
648
+ function foo() {
649
+ let ii;
650
+ for (ii = 0; ii < 10; ii += 1) {
651
+ foo();
652
+ }
653
+ }
654
+ ```
655
+
656
+ <br>
657
+
658
+ ##### `/*jslint getset*/`
659
+
660
+ ```js
661
+ /*jslint getset, this, devel*/
662
+ // Allow get() and set().
663
+
664
+ let foo = {
665
+ bar: 0,
666
+ get getBar() {
667
+ return this.bar;
668
+ },
669
+ set setBar(value) {
670
+ this.bar = value;
671
+ }
672
+ };
673
+ console.log(foo.getBar); // 0
674
+ foo.setBar = 1;
675
+ console.log(foo.getBar); // 1
676
+ ```
677
+
678
+ <br>
679
+
680
+ ##### `/*jslint indent2*/`
681
+
682
+ ```js
683
+ /*jslint indent2*/
684
+ // Use 2-space indent.
685
+
686
+ function foo() {
687
+ return;
688
+ }
689
+ ```
690
+
691
+ <br>
692
+
693
+ ##### `/*jslint long*/`
694
+
695
+ ```js
696
+ /*jslint long*/
697
+ // Allow long lines.
698
+
699
+ let foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
700
+ ```
701
+
702
+ <br>
703
+
704
+ ##### `/*jslint node*/`
705
+
706
+ ```js
707
+ /*jslint node*/
708
+ // Assume Node.js environment.
709
+
710
+ require("fs");
711
+ ```
712
+
713
+ <br>
714
+
715
+ ##### `/*jslint nomen*/`
716
+
717
+ ```js
718
+ /*jslint nomen*/
719
+ // Allow weird property names.
720
+
721
+ let foo = {};
722
+ foo._bar = 1;
723
+ ```
724
+
725
+ <br>
726
+
727
+ ##### `/*jslint single*/`
728
+
729
+ ```js
730
+ /*jslint single*/
731
+ // Allow single-quote strings.
732
+
733
+ let foo = '';
734
+ ```
735
+
736
+ <br>
737
+
738
+ ##### `/*jslint subscript*/`
739
+
740
+ ```js
741
+ /*jslint subscript*/
742
+ // Allow identifiers in subscript-notation.
743
+
744
+ let foo = {};
745
+ foo["bar"] = 1;
746
+ ```
747
+
748
+ <br>
749
+
750
+ ##### `/*jslint this*/`
751
+
752
+ ```js
753
+ /*jslint this*/
754
+ // Allow 'this'.
755
+
756
+ function foo() {
757
+ return this;
758
+ }
759
+ ```
760
+
761
+ <br>
762
+
763
+ ##### `/*jslint trace*/`
764
+
765
+ ```js
766
+ /*jslint trace*/
767
+ // Include jslint stack-trace in warnings.
768
+
769
+ console.log('hello world');
770
+ /*
771
+ 1. Undeclared 'console'.
772
+ console.log('hello world');
773
+ Error
774
+ at warn_at (...)
775
+ at warn (...)
776
+ at lookup (...)
777
+ at pre_v (...)
778
+ at jslint.mjs
779
+ 2. Use double quotes, not single quotes.
780
+ console.log(...);
781
+ Error
782
+ at warn_at (...)
783
+ at lex_string (...)
784
+ at lex_token (...)
785
+ at jslint_phase2_lex (...)
786
+ at Function.jslint (...)
787
+ at jslint.mjs
788
+ */
789
+ ```
790
+
791
+ <br>
792
+
793
+ ##### `/*jslint unordered*/`
794
+
795
+ ```js
796
+ /*jslint unordered*/
797
+ // Allow unordered cases, params, properties, and variables.
798
+
799
+ let foo = {bb: 1, aa: 0};
800
+
801
+ function bar({
802
+ bb = 1,
803
+ aa = 0
804
+ }) {
805
+ return aa + bb;
806
+ }
807
+ ```
808
+
809
+ <br>
810
+
811
+ ##### `/*jslint white*/`
812
+
813
+ ```js
814
+ /*jslint white*/
815
+ // Allow messy whitespace.
816
+
817
+ let foo = 1; let bar = 2;
818
+ ```
819
+
820
+
821
+ <br><br>
822
+ ### Directive `/*global*/`
823
+
824
+ ```js
825
+ /*global foo, bar*/
826
+ // Declare global variables foo, bar.
827
+
828
+ foo();
829
+ bar();
830
+ ```
831
+
832
+
833
+ <br><br>
834
+ ### Directive `/*property*/`
835
+
836
+ ```js
837
+ /*property foo, bar*/
838
+ // Restrict property-access to only .foo, .bar.
839
+
840
+ let aa = {bar: 1, foo: 2};
841
+ ```
842
+
843
+
844
+ <br><br>
845
+ ### Directive `/*jslint-disable*/.../*jslint-enable*/`
846
+
847
+ ```js
848
+ /*jslint-disable*/
849
+
850
+ JSLint will ignore and treat this region as blank-lines.
851
+ Syntax error.
852
+
853
+ /*jslint-enable*/
854
+ ```
855
+
856
+
857
+ <br><br>
858
+ ### Directive `//jslint-ignore-line`
859
+
860
+ ```js
861
+ // JSLint will ignore non-fatal warnings at given line.
862
+
863
+ eval("1"); //jslint-ignore-line
864
+ ```
865
+
866
+
531
867
  <br><br>
532
868
  # Package Listing
533
869
  ![screenshot_package_listing.svg](https://jslint-org.github.io/jslint/branch-beta/.artifact/screenshot_package_listing.svg)
package/jslint.mjs CHANGED
@@ -100,7 +100,7 @@
100
100
  catch_stack, causes, char, children, clear, closer, closure, code, column,
101
101
  concat, consoleError, console_error, console_log, constant, context,
102
102
  convert, count, coverageDir, create, cwd, d, dead, debugInline, default,
103
- delta, devel, directive, directive_list, directive_quiet, directives,
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
106
  execArgv, exit, exitCode, export_dict, exports, expression, extra, file,
@@ -153,7 +153,7 @@ let debugInline = (function () {
153
153
  return argv[0];
154
154
  }
155
155
  debug(); // Coverage-hack.
156
- __consoleError = console.error;
156
+ __consoleError = console.error; //jslint-ignore-line
157
157
  return debug;
158
158
  }());
159
159
  let jslint_charset_ascii = (
@@ -165,7 +165,7 @@ let jslint_charset_ascii = (
165
165
  + "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
166
166
  + "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
167
167
  );
168
- let jslint_edition = "v2022.6.21";
168
+ let jslint_edition = "v2022.7.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.
@@ -860,11 +860,22 @@ function jslint(
860
860
  c,
861
861
  d
862
862
  );
863
- if (the_token.warning === undefined) {
864
- the_token.warning = the_warning;
865
- } else {
863
+
864
+ // Issue #408
865
+ // Warnings that should be ignored sometimes suppress legitimate warnings.
866
+
867
+ if (the_warning.directive_ignore_line) {
868
+ return the_warning;
869
+ }
870
+
871
+ // If there is already a warning on this token, suppress the new one. It is
872
+ // likely that the first warning will be the most meaningful.
873
+
874
+ if (the_token.warning) {
866
875
  warning_list.pop();
876
+ return the_warning;
867
877
  }
878
+ the_token.warning = the_warning;
868
879
  return the_warning;
869
880
  }
870
881
 
@@ -1014,6 +1025,7 @@ function jslint(
1014
1025
  break;
1015
1026
 
1016
1027
  // PR-347 - Disable warning "missing_browser".
1028
+ //
1017
1029
  // case "missing_browser":
1018
1030
  // mm = `/*global*/ requires the Assume a browser option.`;
1019
1031
  // break;
@@ -1098,6 +1110,7 @@ function jslint(
1098
1110
  break;
1099
1111
 
1100
1112
  // PR-347 - Disable warning "unexpected_directive_a".
1113
+ //
1101
1114
  // case "unexpected_directive_a":
1102
1115
  // mm = `When using modules, don't use directive '/\u002a${a}'.`;
1103
1116
  // break;
@@ -1219,12 +1232,12 @@ function jslint(
1219
1232
  if (option_dict.trace) {
1220
1233
  warning.stack_trace = new Error().stack;
1221
1234
  }
1222
- if (warning.directive_quiet) {
1235
+ if (warning.directive_ignore_line) {
1223
1236
 
1224
1237
  // test_cause:
1225
- // ["0 //jslint-quiet", "semicolon", "directive_quiet", "", 0]
1238
+ // ["0 //jslint-ignore-line", "semicolon", "directive_ignore_line", "", 0]
1226
1239
 
1227
- test_cause("directive_quiet");
1240
+ test_cause("directive_ignore_line");
1228
1241
  return warning;
1229
1242
  }
1230
1243
  warning_list.push(warning);
@@ -1328,6 +1341,7 @@ function jslint(
1328
1341
  );
1329
1342
 
1330
1343
  // PR-347 - Disable warning "missing_browser".
1344
+ //
1331
1345
  // if (!option_dict.browser) {
1332
1346
  // directive_list.forEach(function (comment) {
1333
1347
  // if (comment.directive === "global") {
@@ -2413,7 +2427,7 @@ function jslint_phase2_lex(state) {
2413
2427
  if (!option_dict.devel && jslint_rgx_todo.test(snippet)) {
2414
2428
 
2415
2429
  // test_cause:
2416
- // ["//todo", "lex_comment", "todo_comment", "(comment)", 1] //jslint-quiet
2430
+ // ["//todo", "lex_comment", "todo_comment", "(comment)", 1] //jslint-ignore-line
2417
2431
 
2418
2432
  warn("todo_comment", the_comment);
2419
2433
  }
@@ -2700,6 +2714,7 @@ function jslint_phase2_lex(state) {
2700
2714
  return char_after("]");
2701
2715
 
2702
2716
  // PR-362 - Relax regexp-warning against using <space>.
2717
+ //
2703
2718
  // case " ":
2704
2719
  //
2705
2720
  // // test_cause:
@@ -2780,6 +2795,7 @@ function jslint_phase2_lex(state) {
2780
2795
  return;
2781
2796
 
2782
2797
  // PR-362 - Relax regexp-warning against using <space>.
2798
+ //
2783
2799
  // case " ":
2784
2800
  //
2785
2801
  // // test_cause:
@@ -3336,12 +3352,16 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
3336
3352
 
3337
3353
  "AbortController",
3338
3354
  // "Buffer",
3339
- "DOMException",
3355
+ // "Crypto",
3356
+ // "CryptoKey",
3340
3357
  "Event",
3341
3358
  "EventTarget",
3342
3359
  "MessageChannel",
3343
3360
  "MessageEvent",
3344
3361
  "MessagePort",
3362
+ // "Request",
3363
+ // "Response",
3364
+ // "SubtleCrypto",
3345
3365
  "TextDecoder",
3346
3366
  "TextEncoder",
3347
3367
  "URL",
@@ -3355,7 +3375,9 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
3355
3375
  "clearInterval",
3356
3376
  "clearTimeout",
3357
3377
  // "console",
3378
+ // "crypto",
3358
3379
  // "exports",
3380
+ // "fetch",
3359
3381
  // "global",
3360
3382
  // "module",
3361
3383
  "performance",
@@ -3365,7 +3387,6 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
3365
3387
  // "setImmediate",
3366
3388
  "setInterval",
3367
3389
  "setTimeout",
3368
- "structuredClone",
3369
3390
 
3370
3391
  // Web worker only.
3371
3392
  // https://github.com/mdn/content/blob/main/files/en-us/web/api
@@ -3408,6 +3429,7 @@ console.log(JSON.stringify(Object.keys(window).sort(), undefined, 4));
3408
3429
  "sessionStorage",
3409
3430
  // "setInterval",
3410
3431
  // "setTimeout",
3432
+ "structuredClone",
3411
3433
  "window"
3412
3434
  ], "browser");
3413
3435
  break;
@@ -3469,6 +3491,7 @@ import https from "https";
3469
3491
 
3470
3492
  case "ecma":
3471
3493
  object_assign_from_list(global_dict, [
3494
+ "AggregateError",
3472
3495
  "Array",
3473
3496
  "ArrayBuffer",
3474
3497
  "Atomics",
@@ -3539,7 +3562,7 @@ import moduleHttps from "https";
3539
3562
  let result = "";
3540
3563
  await new Promise(function (resolve) {
3541
3564
  moduleHttps.get((
3542
- "https://raw.githubusercontent.com/nodejs/node/master/doc/api"
3565
+ "https://raw.githubusercontent.com/nodejs/node/v16.x/doc/api"
3543
3566
  + "/globals.md"
3544
3567
  ), function (res) {
3545
3568
  res.on("data", function (chunk) {
@@ -3562,12 +3585,16 @@ import moduleHttps from "https";
3562
3585
  object_assign_from_list(global_dict, [
3563
3586
  "AbortController",
3564
3587
  "Buffer",
3565
- "DOMException",
3588
+ // "Crypto",
3589
+ // "CryptoKey",
3566
3590
  "Event",
3567
3591
  "EventTarget",
3568
3592
  "MessageChannel",
3569
3593
  "MessageEvent",
3570
3594
  "MessagePort",
3595
+ // "Request",
3596
+ // "Response",
3597
+ // "SubtleCrypto",
3571
3598
  "TextDecoder",
3572
3599
  "TextEncoder",
3573
3600
  "URL",
@@ -3581,7 +3608,9 @@ import moduleHttps from "https";
3581
3608
  "clearInterval",
3582
3609
  "clearTimeout",
3583
3610
  "console",
3611
+ // "crypto",
3584
3612
  "exports",
3613
+ // "fetch",
3585
3614
  "global",
3586
3615
  "module",
3587
3616
  "performance",
@@ -3590,8 +3619,7 @@ import moduleHttps from "https";
3590
3619
  "require",
3591
3620
  "setImmediate",
3592
3621
  "setInterval",
3593
- "setTimeout",
3594
- "structuredClone"
3622
+ "setTimeout"
3595
3623
  ], "Node.js");
3596
3624
  break;
3597
3625
  }
@@ -3658,7 +3686,7 @@ import moduleHttps from "https";
3658
3686
  ) {
3659
3687
 
3660
3688
  // test_cause:
3661
- // ["/////////////////////////////////////////////////////////////////////////////////", "read_line", "too_long", "", 1] //jslint-quiet
3689
+ // ["/////////////////////////////////////////////////////////////////////////////////", "read_line", "too_long", "", 1] //jslint-ignore-line
3662
3690
 
3663
3691
  warn_at("too_long", line);
3664
3692
  }
@@ -3676,7 +3704,7 @@ import moduleHttps from "https";
3676
3704
  // Scan each line for following ignore-directives:
3677
3705
  // "/*jslint-disable*/"
3678
3706
  // "/*jslint-enable*/"
3679
- // "//jslint-quiet"
3707
+ // "//jslint-ignore-line"
3680
3708
 
3681
3709
  if (line_source === "/*jslint-disable*/") {
3682
3710
 
@@ -3694,13 +3722,16 @@ import moduleHttps from "https";
3694
3722
  stop_at("unopened_enable", line);
3695
3723
  }
3696
3724
  line_disable = undefined;
3697
- } else if (line_source.endsWith(" //jslint-quiet")) {
3725
+ } else if (
3726
+ line_source.endsWith(" //jslint-ignore-line")
3727
+ || line_source.endsWith(" //jslint-quiet")
3728
+ ) {
3698
3729
 
3699
3730
  // test_cause:
3700
- // ["0 //jslint-quiet", "read_line", "jslint_quiet", "", 0]
3731
+ // ["0 //jslint-ignore-line", "read_line", "jslint_ignore_line", "", 0]
3701
3732
 
3702
- test_cause("jslint_quiet");
3703
- line_list[line].directive_quiet = true;
3733
+ test_cause("jslint_ignore_line");
3734
+ line_list[line].directive_ignore_line = true;
3704
3735
  }
3705
3736
  if (line_disable !== undefined) {
3706
3737
 
@@ -10214,7 +10245,7 @@ function v8CoverageListMerge(processCovs) {
10214
10245
  let resultTree;
10215
10246
  let rightChildren;
10216
10247
 
10217
- // TODO(perf): Binary search (check overhead) //jslint-quiet
10248
+ // TODO(perf): Binary search (check overhead) //jslint-ignore-line
10218
10249
 
10219
10250
  while (ii < tree.children.length) {
10220
10251
  child = tree.children[ii];
@@ -10292,7 +10323,7 @@ function v8CoverageListMerge(processCovs) {
10292
10323
 
10293
10324
  // This function will normalize-and-sort <funcCov>.ranges.
10294
10325
  // Sorts the ranges (pre-order sort).
10295
- // TODO: Tree-based normalization of the ranges. //jslint-quiet
10326
+ // TODO: Tree-based normalization of the ranges. //jslint-ignore-line
10296
10327
  // @param funcCov Function coverage to normalize.
10297
10328
 
10298
10329
  funcCov.ranges = treeToRanges(treeFromSortedRanges(
@@ -30,10 +30,11 @@
30
30
  /*property
31
31
  Diagnostic, DiagnosticSeverity, ProgressLocation, Warning, Window, activate,
32
32
  cancellable, character, clear, column, commands, createDiagnosticCollection,
33
- document, end, exports, getText, increment, jslint, languages, line,
34
- location, map, message, module, push, readFileSync,
35
- registerTextEditorCommand, replace, report, runInNewContext, set, slice,
36
- start, subscriptions, title, uri, warnings, window, withProgress
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
37
38
  */
38
39
 
39
40
  "use strict";
@@ -82,6 +83,48 @@ function activate({
82
83
  });
83
84
  }
84
85
 
86
+ function jslintDisableRegion({
87
+ document,
88
+ selection
89
+ }, edit) {
90
+ let range;
91
+ let text;
92
+ edit.insert({
93
+ character: 0,
94
+ line: selection.start.line
95
+ }, "/*jslint-disable*/\n");
96
+ range = document.lineAt(selection.end).rangeIncludingLineBreak;
97
+ text = document.getText(range);
98
+
99
+ // If selection-end is EOL without preceding line-break,
100
+ // then prepend line-break before directive.
101
+
102
+ if (!text.endsWith("\n")) {
103
+ text += "\n/*jslint-enable*/";
104
+
105
+ // If selection-end is start of a new line, then prepend directive before it.
106
+
107
+ } else if (!selection.isEmpty && selection.end.character === 0) {
108
+ text = "/*jslint-enable*/\n" + text;
109
+
110
+ // Append directive to selection-end.
111
+
112
+ } else {
113
+ text += "/*jslint-enable*/\n";
114
+ }
115
+ edit.replace(range, text);
116
+ }
117
+
118
+ function jslintIgnoreLine({
119
+ document,
120
+ selection
121
+ }, edit) {
122
+ edit.insert({
123
+ character: document.lineAt(selection.end).range.end.character,
124
+ line: selection.end.line
125
+ }, " //jslint-ignore-line");
126
+ }
127
+
85
128
  function jslintLint({
86
129
  document
87
130
  }) {
@@ -148,7 +191,7 @@ function activate({
148
191
  require("vm").runInNewContext(
149
192
  (
150
193
  "\"use strict\";"
151
- + require("fs").readFileSync( //jslint-quiet
194
+ + require("fs").readFileSync( //jslint-ignore-line
152
195
  __dirname + "/jslint.mjs",
153
196
  "utf8"
154
197
  ).replace(
@@ -170,6 +213,12 @@ function activate({
170
213
  subscriptions.push(vscode.commands.registerTextEditorCommand((
171
214
  "jslint.clear"
172
215
  ), jslintClear));
216
+ subscriptions.push(vscode.commands.registerTextEditorCommand((
217
+ "jslint.disableRegion"
218
+ ), jslintDisableRegion));
219
+ subscriptions.push(vscode.commands.registerTextEditorCommand((
220
+ "jslint.ignoreLine"
221
+ ), jslintIgnoreLine));
173
222
  subscriptions.push(vscode.commands.registerTextEditorCommand((
174
223
  "jslint.lint"
175
224
  ), jslintLint));
package/package.json CHANGED
@@ -33,5 +33,5 @@
33
33
  "test2": "sh jslint_ci.sh shCiBase"
34
34
  },
35
35
  "type": "module",
36
- "version": "2022.6.21"
36
+ "version": "2022.7.20"
37
37
  }