eslint-plugin-baseline-js 0.1.0-alpha.1

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/dist/index.cjs ADDED
@@ -0,0 +1,1312 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ let eslint_plugin_es_x = require("eslint-plugin-es-x");
25
+ eslint_plugin_es_x = __toESM(eslint_plugin_es_x);
26
+ let eslint_use_at_your_own_risk = require("eslint/use-at-your-own-risk");
27
+ eslint_use_at_your_own_risk = __toESM(eslint_use_at_your_own_risk);
28
+
29
+ //#region src/configs/baseline.ts
30
+ function baselineConfigs(opts = {}) {
31
+ const baseline = opts.baseline ?? "widely";
32
+ const rules$1 = { "baseline-js/use-baseline": ["error", { baseline }] };
33
+ return [{ rules: rules$1 }];
34
+ }
35
+
36
+ //#endregion
37
+ //#region src/baseline/mapping.mjs
38
+ /**
39
+ * @fileoverview Mapping of web-features JavaScript feature IDs to delegate ESLint rules.
40
+ */
41
+ var mapping_default = {
42
+ "nullish-coalescing": {
43
+ kind: "syntax",
44
+ delegates: [{
45
+ plugin: "es-x",
46
+ rule: "no-nullish-coalescing-operators",
47
+ level: "error"
48
+ }]
49
+ },
50
+ "logical-assignments": {
51
+ kind: "syntax",
52
+ delegates: [{
53
+ plugin: "es-x",
54
+ rule: "no-logical-assignment-operators",
55
+ level: "error"
56
+ }]
57
+ },
58
+ "top-level-await": {
59
+ kind: "syntax",
60
+ delegates: [{
61
+ plugin: "es-x",
62
+ rule: "no-top-level-await",
63
+ level: "error"
64
+ }]
65
+ },
66
+ "hashbang-comments": {
67
+ kind: "syntax",
68
+ delegates: [{
69
+ plugin: "es-x",
70
+ rule: "no-hashbang",
71
+ level: "error"
72
+ }]
73
+ },
74
+ "numeric-seperators": {
75
+ kind: "syntax",
76
+ delegates: [{
77
+ plugin: "es-x",
78
+ rule: "no-numeric-separators",
79
+ level: "error"
80
+ }]
81
+ },
82
+ "weak-references": {
83
+ kind: "syntax",
84
+ delegates: [{
85
+ plugin: "es-x",
86
+ rule: "no-weakrefs",
87
+ level: "error"
88
+ }]
89
+ },
90
+ "arguments-callee": {
91
+ kind: "syntax",
92
+ delegates: [{
93
+ plugin: "core",
94
+ rule: "no-caller",
95
+ level: "error"
96
+ }]
97
+ },
98
+ with: {
99
+ kind: "syntax",
100
+ delegates: [{
101
+ plugin: "core",
102
+ rule: "no-with",
103
+ level: "error"
104
+ }]
105
+ },
106
+ "date-get-year-set-year": {
107
+ kind: "syntax",
108
+ delegates: [{
109
+ plugin: "es-x",
110
+ rule: "no-date-prototype-getyear-setyear",
111
+ level: "error"
112
+ }]
113
+ },
114
+ "escape-unescape": {
115
+ kind: "syntax",
116
+ delegates: [{
117
+ plugin: "es-x",
118
+ rule: "no-escape-unescape",
119
+ level: "error"
120
+ }]
121
+ },
122
+ "async-await": {
123
+ kind: "syntax",
124
+ delegates: [{
125
+ plugin: "es-x",
126
+ rule: "no-async-functions",
127
+ level: "error"
128
+ }]
129
+ },
130
+ "async-generators": {
131
+ kind: "syntax",
132
+ delegates: [{
133
+ plugin: "es-x",
134
+ rule: "no-async-iteration",
135
+ level: "error"
136
+ }]
137
+ },
138
+ "atomics-wait-async": {
139
+ kind: "syntax",
140
+ delegates: [{
141
+ plugin: "es-x",
142
+ rule: "no-atomics-waitasync",
143
+ level: "error"
144
+ }]
145
+ },
146
+ bigint: {
147
+ kind: "syntax",
148
+ delegates: [{
149
+ plugin: "es-x",
150
+ rule: "no-bigint",
151
+ level: "error"
152
+ }]
153
+ },
154
+ "class-syntax": {
155
+ kind: "syntax",
156
+ delegates: [{
157
+ plugin: "es-x",
158
+ rule: "no-classes",
159
+ level: "error"
160
+ }]
161
+ },
162
+ destructuring: {
163
+ kind: "syntax",
164
+ delegates: [{
165
+ plugin: "es-x",
166
+ rule: "no-destructuring",
167
+ level: "error"
168
+ }]
169
+ },
170
+ exponentiation: {
171
+ kind: "syntax",
172
+ delegates: [{
173
+ plugin: "es-x",
174
+ rule: "no-exponential-operators",
175
+ level: "error"
176
+ }]
177
+ },
178
+ generators: {
179
+ kind: "syntax",
180
+ delegates: [{
181
+ plugin: "es-x",
182
+ rule: "no-generators",
183
+ level: "error"
184
+ }]
185
+ },
186
+ globalthis: {
187
+ kind: "syntax",
188
+ delegates: [{
189
+ plugin: "es-x",
190
+ rule: "no-global-this",
191
+ level: "error"
192
+ }]
193
+ },
194
+ "html-wrapper-methods": {
195
+ kind: "syntax",
196
+ delegates: [{
197
+ plugin: "es-x",
198
+ rule: "no-string-create-html-methods",
199
+ level: "error"
200
+ }]
201
+ },
202
+ "let-const": {
203
+ kind: "syntax",
204
+ delegates: [{
205
+ plugin: "es-x",
206
+ rule: "no-block-scoped-variables",
207
+ level: "error"
208
+ }]
209
+ },
210
+ "optional-catch-binding": {
211
+ kind: "syntax",
212
+ delegates: [{
213
+ plugin: "es-x",
214
+ rule: "no-optional-catch-binding",
215
+ level: "error"
216
+ }]
217
+ },
218
+ "proxy-reflect": {
219
+ kind: "syntax",
220
+ delegates: [{
221
+ plugin: "es-x",
222
+ rule: "no-proxy",
223
+ level: "error"
224
+ }, {
225
+ plugin: "es-x",
226
+ rule: "no-reflect",
227
+ level: "error"
228
+ }]
229
+ },
230
+ "shared-memory": {
231
+ kind: "syntax",
232
+ delegates: [{
233
+ plugin: "es-x",
234
+ rule: "no-shared-array-buffer",
235
+ level: "error"
236
+ }, {
237
+ plugin: "es-x",
238
+ rule: "no-atomics",
239
+ level: "error"
240
+ }]
241
+ },
242
+ spread: {
243
+ kind: "syntax",
244
+ delegates: [{
245
+ plugin: "es-x",
246
+ rule: "no-spread-elements",
247
+ level: "error"
248
+ }, {
249
+ plugin: "es-x",
250
+ rule: "no-rest-spread-properties",
251
+ level: "error"
252
+ }]
253
+ },
254
+ "template-literals": {
255
+ kind: "syntax",
256
+ delegates: [{
257
+ plugin: "es-x",
258
+ rule: "no-template-literals",
259
+ level: "error"
260
+ }]
261
+ },
262
+ "unicode-point-escapes": {
263
+ kind: "syntax",
264
+ delegates: [{
265
+ plugin: "es-x",
266
+ rule: "no-unicode-codepoint-escapes",
267
+ level: "error"
268
+ }]
269
+ },
270
+ bigint64array: {
271
+ kind: "syntax",
272
+ delegates: [{
273
+ plugin: "self",
274
+ rule: "no-bigint64array",
275
+ level: "error"
276
+ }]
277
+ },
278
+ functions: {
279
+ kind: "meta",
280
+ delegates: []
281
+ },
282
+ javascript: {
283
+ kind: "meta",
284
+ delegates: []
285
+ },
286
+ "functions-caller-arguments": {
287
+ kind: "syntax",
288
+ delegates: [{
289
+ plugin: "self",
290
+ rule: "no-function-caller-arguments",
291
+ level: "error"
292
+ }]
293
+ },
294
+ "math-sum-precise": {
295
+ kind: "syntax",
296
+ delegates: [{
297
+ plugin: "self",
298
+ rule: "no-math-sum-precise",
299
+ level: "error"
300
+ }]
301
+ },
302
+ temporal: {
303
+ kind: "syntax",
304
+ delegates: [{
305
+ plugin: "self",
306
+ rule: "no-temporal",
307
+ level: "error"
308
+ }]
309
+ }
310
+ };
311
+
312
+ //#endregion
313
+ //#region src/baseline/plugins.ts
314
+ const PREFIX_TO_PLUGIN = [{
315
+ prefix: "core/",
316
+ plugin: "core"
317
+ }, {
318
+ prefix: "self/",
319
+ plugin: "self"
320
+ }];
321
+ function parseDelegateRuleKey(key) {
322
+ for (const { prefix, plugin } of PREFIX_TO_PLUGIN) if (key.startsWith(prefix)) return {
323
+ plugin,
324
+ name: key.slice(prefix.length)
325
+ };
326
+ return {
327
+ plugin: "es-x",
328
+ name: key
329
+ };
330
+ }
331
+
332
+ //#endregion
333
+ //#region src/baseline/features.ts
334
+ /**
335
+ * @fileoverview JavaScript features extracted from the web-features package.
336
+ * @author scripts/build-features.mjs
337
+ *
338
+ * THIS FILE IS AUTOGENERATED. DO NOT MODIFY DIRECTLY.
339
+ */
340
+ var features_default = {
341
+ "arguments-callee": {
342
+ "id": "arguments-callee",
343
+ "name": "arguments.callee",
344
+ "group": "javascript",
345
+ "status": {
346
+ "baseline": false,
347
+ "support": {
348
+ "chrome": "1",
349
+ "chrome_android": "18",
350
+ "edge": "12",
351
+ "firefox": "1",
352
+ "firefox_android": "4",
353
+ "safari": "1",
354
+ "safari_ios": "1"
355
+ }
356
+ },
357
+ "discouraged": { "according_to": ["https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-arguments-exotic-objects"] }
358
+ },
359
+ "async-await": {
360
+ "id": "async-await",
361
+ "name": "Async functions",
362
+ "group": "javascript",
363
+ "status": {
364
+ "baseline": "high",
365
+ "baseline_low_date": "2017-04-05",
366
+ "baseline_high_date": "2019-10-05",
367
+ "support": {
368
+ "chrome": "55",
369
+ "chrome_android": "55",
370
+ "edge": "15",
371
+ "firefox": "52",
372
+ "firefox_android": "52",
373
+ "safari": "10.1",
374
+ "safari_ios": "10.3"
375
+ }
376
+ }
377
+ },
378
+ "async-generators": {
379
+ "id": "async-generators",
380
+ "name": "Async generators",
381
+ "group": "javascript",
382
+ "status": {
383
+ "baseline": "high",
384
+ "baseline_low_date": "2020-01-15",
385
+ "baseline_high_date": "2022-07-15",
386
+ "support": {
387
+ "chrome": "63",
388
+ "chrome_android": "63",
389
+ "edge": "79",
390
+ "firefox": "55",
391
+ "firefox_android": "55",
392
+ "safari": "12",
393
+ "safari_ios": "12"
394
+ }
395
+ }
396
+ },
397
+ "atomics-wait-async": {
398
+ "id": "atomics-wait-async",
399
+ "name": "Atomics.waitAsync",
400
+ "group": "javascript",
401
+ "status": {
402
+ "baseline": false,
403
+ "support": {
404
+ "chrome": "87",
405
+ "chrome_android": "89",
406
+ "edge": "87",
407
+ "safari": "16.4",
408
+ "safari_ios": "16.4"
409
+ }
410
+ }
411
+ },
412
+ "bigint": {
413
+ "id": "bigint",
414
+ "name": "BigInt",
415
+ "group": "javascript",
416
+ "status": {
417
+ "baseline": "high",
418
+ "baseline_low_date": "2020-09-16",
419
+ "baseline_high_date": "2023-03-16",
420
+ "support": {
421
+ "chrome": "67",
422
+ "chrome_android": "67",
423
+ "edge": "79",
424
+ "firefox": "68",
425
+ "firefox_android": "68",
426
+ "safari": "14",
427
+ "safari_ios": "14"
428
+ }
429
+ }
430
+ },
431
+ "bigint64array": {
432
+ "id": "bigint64array",
433
+ "name": "BigInt64Array",
434
+ "group": "javascript",
435
+ "status": {
436
+ "baseline": "high",
437
+ "baseline_low_date": "2021-09-20",
438
+ "baseline_high_date": "2024-03-20",
439
+ "support": {
440
+ "chrome": "67",
441
+ "chrome_android": "67",
442
+ "edge": "79",
443
+ "firefox": "68",
444
+ "firefox_android": "68",
445
+ "safari": "15",
446
+ "safari_ios": "15"
447
+ }
448
+ }
449
+ },
450
+ "class-syntax": {
451
+ "id": "class-syntax",
452
+ "name": "Classes",
453
+ "group": "javascript",
454
+ "status": {
455
+ "baseline": "high",
456
+ "baseline_low_date": "2016-03-08",
457
+ "baseline_high_date": "2018-09-08",
458
+ "support": {
459
+ "chrome": "42",
460
+ "chrome_android": "42",
461
+ "edge": "13",
462
+ "firefox": "45",
463
+ "firefox_android": "45",
464
+ "safari": "9",
465
+ "safari_ios": "9"
466
+ }
467
+ }
468
+ },
469
+ "date-get-year-set-year": {
470
+ "id": "date-get-year-set-year",
471
+ "name": "getYear() and setYear()",
472
+ "group": "javascript",
473
+ "status": {
474
+ "baseline": false,
475
+ "support": {
476
+ "chrome": "1",
477
+ "chrome_android": "18",
478
+ "edge": "12",
479
+ "firefox": "1",
480
+ "firefox_android": "4",
481
+ "safari": "1",
482
+ "safari_ios": "1"
483
+ }
484
+ },
485
+ "discouraged": { "according_to": ["https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers"] }
486
+ },
487
+ "destructuring": {
488
+ "id": "destructuring",
489
+ "name": "Destructuring",
490
+ "group": "javascript",
491
+ "status": {
492
+ "baseline": "high",
493
+ "baseline_low_date": "2020-01-15",
494
+ "baseline_high_date": "2022-07-15",
495
+ "support": {
496
+ "chrome": "60",
497
+ "chrome_android": "60",
498
+ "edge": "79",
499
+ "firefox": "55",
500
+ "firefox_android": "55",
501
+ "safari": "11.1",
502
+ "safari_ios": "11.3"
503
+ }
504
+ }
505
+ },
506
+ "escape-unescape": {
507
+ "id": "escape-unescape",
508
+ "name": "escape() and unescape()",
509
+ "group": "javascript",
510
+ "status": {
511
+ "baseline": false,
512
+ "support": {
513
+ "chrome": "1",
514
+ "chrome_android": "18",
515
+ "edge": "12",
516
+ "firefox": "1",
517
+ "firefox_android": "4",
518
+ "safari": "1",
519
+ "safari_ios": "1"
520
+ }
521
+ },
522
+ "discouraged": { "according_to": ["https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers"] }
523
+ },
524
+ "exponentiation": {
525
+ "id": "exponentiation",
526
+ "name": "Exponentiation operator",
527
+ "group": "javascript",
528
+ "status": {
529
+ "baseline": "high",
530
+ "baseline_low_date": "2017-03-27",
531
+ "baseline_high_date": "2019-09-27",
532
+ "support": {
533
+ "chrome": "52",
534
+ "chrome_android": "52",
535
+ "edge": "14",
536
+ "firefox": "52",
537
+ "firefox_android": "52",
538
+ "safari": "10.1",
539
+ "safari_ios": "10.3"
540
+ }
541
+ }
542
+ },
543
+ "functions": {
544
+ "id": "functions",
545
+ "name": "Functions",
546
+ "group": "javascript",
547
+ "status": {
548
+ "baseline": "high",
549
+ "baseline_low_date": "2015-07-29",
550
+ "baseline_high_date": "2018-01-29",
551
+ "support": {
552
+ "chrome": "1",
553
+ "chrome_android": "18",
554
+ "edge": "12",
555
+ "firefox": "1",
556
+ "firefox_android": "4",
557
+ "safari": "1",
558
+ "safari_ios": "1"
559
+ }
560
+ }
561
+ },
562
+ "functions-caller-arguments": {
563
+ "id": "functions-caller-arguments",
564
+ "name": "Function caller and arguments",
565
+ "group": "javascript",
566
+ "status": {
567
+ "baseline": false,
568
+ "support": {
569
+ "chrome": "1",
570
+ "chrome_android": "18",
571
+ "edge": "12",
572
+ "firefox": "1",
573
+ "firefox_android": "4",
574
+ "safari": "3",
575
+ "safari_ios": "1"
576
+ }
577
+ },
578
+ "discouraged": { "according_to": ["https://tc39.es/ecma262/multipage/error-handling-and-language-extensions.html#sec-forbidden-extensions"] }
579
+ },
580
+ "generators": {
581
+ "id": "generators",
582
+ "name": "Generators",
583
+ "group": "javascript",
584
+ "status": {
585
+ "baseline": "high",
586
+ "baseline_low_date": "2016-09-20",
587
+ "baseline_high_date": "2019-03-20",
588
+ "support": {
589
+ "chrome": "39",
590
+ "chrome_android": "39",
591
+ "edge": "13",
592
+ "firefox": "26",
593
+ "firefox_android": "26",
594
+ "safari": "10",
595
+ "safari_ios": "10"
596
+ }
597
+ }
598
+ },
599
+ "globalthis": {
600
+ "id": "globalthis",
601
+ "name": "globalThis",
602
+ "group": "javascript",
603
+ "status": {
604
+ "baseline": "high",
605
+ "baseline_low_date": "2020-01-15",
606
+ "baseline_high_date": "2022-07-15",
607
+ "support": {
608
+ "chrome": "71",
609
+ "chrome_android": "71",
610
+ "edge": "79",
611
+ "firefox": "65",
612
+ "firefox_android": "65",
613
+ "safari": "12.1",
614
+ "safari_ios": "12.2"
615
+ }
616
+ }
617
+ },
618
+ "hashbang-comments": {
619
+ "id": "hashbang-comments",
620
+ "name": "Hashbang comments",
621
+ "group": "javascript",
622
+ "status": {
623
+ "baseline": "high",
624
+ "baseline_low_date": "2020-03-24",
625
+ "baseline_high_date": "2022-09-24",
626
+ "support": {
627
+ "chrome": "74",
628
+ "chrome_android": "74",
629
+ "edge": "79",
630
+ "firefox": "67",
631
+ "firefox_android": "67",
632
+ "safari": "13.1",
633
+ "safari_ios": "13.4"
634
+ }
635
+ }
636
+ },
637
+ "html-wrapper-methods": {
638
+ "id": "html-wrapper-methods",
639
+ "name": "HTML wrapper methods",
640
+ "group": "javascript",
641
+ "status": {
642
+ "baseline": false,
643
+ "support": {
644
+ "chrome": "1",
645
+ "chrome_android": "18",
646
+ "edge": "12",
647
+ "firefox": "1",
648
+ "firefox_android": "4",
649
+ "safari": "1",
650
+ "safari_ios": "1"
651
+ }
652
+ },
653
+ "discouraged": {
654
+ "according_to": ["https://tc39.es/ecma262/multipage/additional-ecmascript-features-for-web-browsers.html#sec-additional-ecmascript-features-for-web-browsers"],
655
+ "alternatives": ["dom"]
656
+ }
657
+ },
658
+ "javascript": {
659
+ "id": "javascript",
660
+ "name": "JavaScript (initial core language support)",
661
+ "group": "javascript",
662
+ "status": {
663
+ "baseline": "high",
664
+ "baseline_low_date": "2015-07-29",
665
+ "baseline_high_date": "2018-01-29",
666
+ "support": {
667
+ "chrome": "5",
668
+ "chrome_android": "18",
669
+ "edge": "12",
670
+ "firefox": "1",
671
+ "firefox_android": "4",
672
+ "safari": "5",
673
+ "safari_ios": "4.2"
674
+ }
675
+ }
676
+ },
677
+ "let-const": {
678
+ "id": "let-const",
679
+ "name": "Let and const",
680
+ "group": "javascript",
681
+ "status": {
682
+ "baseline": "high",
683
+ "baseline_low_date": "2016-09-20",
684
+ "baseline_high_date": "2019-03-20",
685
+ "support": {
686
+ "chrome": "49",
687
+ "chrome_android": "49",
688
+ "edge": "14",
689
+ "firefox": "44",
690
+ "firefox_android": "44",
691
+ "safari": "10",
692
+ "safari_ios": "10"
693
+ }
694
+ }
695
+ },
696
+ "logical-assignments": {
697
+ "id": "logical-assignments",
698
+ "name": "Logical assignments",
699
+ "group": "javascript",
700
+ "status": {
701
+ "baseline": "high",
702
+ "baseline_low_date": "2020-09-16",
703
+ "baseline_high_date": "2023-03-16",
704
+ "support": {
705
+ "chrome": "85",
706
+ "chrome_android": "85",
707
+ "edge": "85",
708
+ "firefox": "79",
709
+ "firefox_android": "79",
710
+ "safari": "14",
711
+ "safari_ios": "14"
712
+ }
713
+ }
714
+ },
715
+ "math-sum-precise": {
716
+ "id": "math-sum-precise",
717
+ "name": "Math.sumPrecise()",
718
+ "group": "javascript",
719
+ "status": {
720
+ "baseline": false,
721
+ "support": {
722
+ "firefox": "137",
723
+ "firefox_android": "137"
724
+ }
725
+ }
726
+ },
727
+ "nullish-coalescing": {
728
+ "id": "nullish-coalescing",
729
+ "name": "Nullish coalescing",
730
+ "group": "javascript",
731
+ "status": {
732
+ "baseline": "high",
733
+ "baseline_low_date": "2020-09-16",
734
+ "baseline_high_date": "2023-03-16",
735
+ "support": {
736
+ "chrome": "85",
737
+ "chrome_android": "85",
738
+ "edge": "85",
739
+ "firefox": "79",
740
+ "firefox_android": "79",
741
+ "safari": "14",
742
+ "safari_ios": "14"
743
+ }
744
+ }
745
+ },
746
+ "numeric-seperators": {
747
+ "id": "numeric-seperators",
748
+ "name": "Numeric separators",
749
+ "group": "javascript",
750
+ "status": {
751
+ "baseline": "high",
752
+ "baseline_low_date": "2020-07-28",
753
+ "baseline_high_date": "2023-01-28",
754
+ "support": {
755
+ "chrome": "75",
756
+ "chrome_android": "75",
757
+ "edge": "79",
758
+ "firefox": "70",
759
+ "firefox_android": "79",
760
+ "safari": "13",
761
+ "safari_ios": "13"
762
+ }
763
+ }
764
+ },
765
+ "optional-catch-binding": {
766
+ "id": "optional-catch-binding",
767
+ "name": "Optional catch binding",
768
+ "group": "javascript",
769
+ "status": {
770
+ "baseline": "high",
771
+ "baseline_low_date": "2020-01-15",
772
+ "baseline_high_date": "2022-07-15",
773
+ "support": {
774
+ "chrome": "66",
775
+ "chrome_android": "66",
776
+ "edge": "79",
777
+ "firefox": "58",
778
+ "firefox_android": "58",
779
+ "safari": "11.1",
780
+ "safari_ios": "11.3"
781
+ }
782
+ }
783
+ },
784
+ "proxy-reflect": {
785
+ "id": "proxy-reflect",
786
+ "name": "Proxy and Reflect",
787
+ "group": "javascript",
788
+ "status": {
789
+ "baseline": "high",
790
+ "baseline_low_date": "2016-09-20",
791
+ "baseline_high_date": "2019-03-20",
792
+ "support": {
793
+ "chrome": "49",
794
+ "chrome_android": "49",
795
+ "edge": "12",
796
+ "firefox": "18",
797
+ "firefox_android": "18",
798
+ "safari": "10",
799
+ "safari_ios": "10"
800
+ }
801
+ }
802
+ },
803
+ "shared-memory": {
804
+ "id": "shared-memory",
805
+ "name": "SharedArrayBuffer and Atomics",
806
+ "group": "javascript",
807
+ "status": {
808
+ "baseline": "high",
809
+ "baseline_low_date": "2021-12-13",
810
+ "baseline_high_date": "2024-06-13",
811
+ "support": {
812
+ "chrome": "68",
813
+ "chrome_android": "89",
814
+ "edge": "79",
815
+ "firefox": "79",
816
+ "firefox_android": "79",
817
+ "safari": "15.2",
818
+ "safari_ios": "15.2"
819
+ }
820
+ }
821
+ },
822
+ "spread": {
823
+ "id": "spread",
824
+ "name": "Spread syntax",
825
+ "group": "javascript",
826
+ "status": {
827
+ "baseline": "high",
828
+ "baseline_low_date": "2020-01-15",
829
+ "baseline_high_date": "2022-07-15",
830
+ "support": {
831
+ "chrome": "60",
832
+ "chrome_android": "60",
833
+ "edge": "79",
834
+ "firefox": "55",
835
+ "firefox_android": "55",
836
+ "safari": "11.1",
837
+ "safari_ios": "11.3"
838
+ }
839
+ }
840
+ },
841
+ "template-literals": {
842
+ "id": "template-literals",
843
+ "name": "Template literals",
844
+ "group": "javascript",
845
+ "status": {
846
+ "baseline": "high",
847
+ "baseline_low_date": "2020-01-15",
848
+ "baseline_high_date": "2022-07-15",
849
+ "support": {
850
+ "chrome": "62",
851
+ "chrome_android": "62",
852
+ "edge": "79",
853
+ "firefox": "53",
854
+ "firefox_android": "53",
855
+ "safari": "11",
856
+ "safari_ios": "11"
857
+ }
858
+ }
859
+ },
860
+ "temporal": {
861
+ "id": "temporal",
862
+ "name": "Temporal",
863
+ "group": "javascript",
864
+ "status": {
865
+ "baseline": false,
866
+ "support": {
867
+ "firefox": "139",
868
+ "firefox_android": "139"
869
+ }
870
+ }
871
+ },
872
+ "top-level-await": {
873
+ "id": "top-level-await",
874
+ "name": "Top-level await",
875
+ "group": "javascript",
876
+ "status": {
877
+ "baseline": "high",
878
+ "baseline_low_date": "2021-09-20",
879
+ "baseline_high_date": "2024-03-20",
880
+ "support": {
881
+ "chrome": "89",
882
+ "chrome_android": "89",
883
+ "edge": "89",
884
+ "firefox": "89",
885
+ "firefox_android": "89",
886
+ "safari": "15",
887
+ "safari_ios": "15"
888
+ }
889
+ }
890
+ },
891
+ "unicode-point-escapes": {
892
+ "id": "unicode-point-escapes",
893
+ "name": "Unicode point escapes",
894
+ "group": "javascript",
895
+ "status": {
896
+ "baseline": "high",
897
+ "baseline_low_date": "2015-09-30",
898
+ "baseline_high_date": "2018-03-30",
899
+ "support": {
900
+ "chrome": "44",
901
+ "chrome_android": "44",
902
+ "edge": "12",
903
+ "firefox": "40",
904
+ "firefox_android": "40",
905
+ "safari": "9",
906
+ "safari_ios": "9"
907
+ }
908
+ }
909
+ },
910
+ "weak-references": {
911
+ "id": "weak-references",
912
+ "name": "Weak references",
913
+ "group": "javascript",
914
+ "status": {
915
+ "baseline": "high",
916
+ "baseline_low_date": "2021-04-26",
917
+ "baseline_high_date": "2023-10-26",
918
+ "support": {
919
+ "chrome": "84",
920
+ "chrome_android": "84",
921
+ "edge": "84",
922
+ "firefox": "79",
923
+ "firefox_android": "79",
924
+ "safari": "14.1",
925
+ "safari_ios": "14.5"
926
+ }
927
+ }
928
+ },
929
+ "with": {
930
+ "id": "with",
931
+ "name": "with",
932
+ "group": "javascript",
933
+ "status": {
934
+ "baseline": false,
935
+ "support": {
936
+ "chrome": "38",
937
+ "chrome_android": "38",
938
+ "edge": "12",
939
+ "firefox": "48",
940
+ "firefox_android": "48",
941
+ "safari": "10",
942
+ "safari_ios": "10"
943
+ }
944
+ },
945
+ "discouraged": {
946
+ "according_to": ["https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-with-statement"],
947
+ "alternatives": ["destructuring"]
948
+ }
949
+ }
950
+ };
951
+
952
+ //#endregion
953
+ //#region src/baseline/resolve.ts
954
+ const features = features_default;
955
+ function mapBaseline(b) {
956
+ if (b === "high") return "widely";
957
+ if (b === "low") return "newly";
958
+ if (b === false) return "limited";
959
+ return "unknown";
960
+ }
961
+ function yearFrom(dateStr) {
962
+ if (!dateStr) return null;
963
+ const y = Number(dateStr.slice(0, 4));
964
+ return Number.isFinite(y) ? y : null;
965
+ }
966
+ function getFeatureRecord(id) {
967
+ return features[id] ?? null;
968
+ }
969
+ function isBeyondBaseline(featureId, baseline) {
970
+ const rec = getFeatureRecord(featureId);
971
+ if (!rec) return false;
972
+ const bucket = mapBaseline(rec.status?.baseline);
973
+ if (baseline === "widely") return bucket !== "widely";
974
+ if (baseline === "newly") return bucket === "limited";
975
+ if (typeof baseline === "number") {
976
+ const y = yearFrom(rec.status?.baseline_low_date) ?? yearFrom(rec.status?.baseline_high_date);
977
+ if (y == null) return false;
978
+ return y > baseline;
979
+ }
980
+ return false;
981
+ }
982
+
983
+ //#endregion
984
+ //#region src/config.ts
985
+ function getBaselineValue(opt) {
986
+ if (!opt) return "widely";
987
+ return opt.baseline ?? opt.available ?? "widely";
988
+ }
989
+
990
+ //#endregion
991
+ //#region src/rules/no-bigint64array/index.ts
992
+ const rule$4 = {
993
+ meta: {
994
+ type: "problem",
995
+ docs: { description: "disallow BigInt64Array/BigUint64Array usage" },
996
+ messages: { forbidden: "BigInt64Array/BigUint64Array are not allowed." },
997
+ schema: []
998
+ },
999
+ create(context) {
1000
+ function report(node) {
1001
+ context.report({
1002
+ node,
1003
+ messageId: "forbidden"
1004
+ });
1005
+ }
1006
+ return {
1007
+ NewExpression(node) {
1008
+ const n = node;
1009
+ const callee = n.callee;
1010
+ if (callee?.type === "Identifier") {
1011
+ if (callee.name === "BigInt64Array" || callee.name === "BigUint64Array") report(callee);
1012
+ }
1013
+ },
1014
+ CallExpression(node) {
1015
+ const n = node;
1016
+ const callee = n.callee;
1017
+ if (callee?.type === "Identifier") {
1018
+ if (callee.name === "BigInt64Array" || callee.name === "BigUint64Array") report(callee);
1019
+ }
1020
+ },
1021
+ MemberExpression(node) {
1022
+ const m = node;
1023
+ const obj = m.object;
1024
+ if (obj?.type === "Identifier") {
1025
+ if (obj.name === "BigInt64Array" || obj.name === "BigUint64Array") report(obj);
1026
+ }
1027
+ }
1028
+ };
1029
+ }
1030
+ };
1031
+ var no_bigint64array_default = rule$4;
1032
+
1033
+ //#endregion
1034
+ //#region src/rules/no-function-caller-arguments/index.ts
1035
+ const rule$3 = {
1036
+ meta: {
1037
+ type: "problem",
1038
+ docs: { description: "disallow Function#caller and Function#arguments" },
1039
+ messages: { forbidden: "Function.caller/Function.arguments are forbidden." },
1040
+ schema: []
1041
+ },
1042
+ create(context) {
1043
+ function report(node) {
1044
+ context.report({
1045
+ node,
1046
+ messageId: "forbidden"
1047
+ });
1048
+ }
1049
+ return { MemberExpression(node) {
1050
+ const m = node;
1051
+ const prop = m.property;
1052
+ if (!prop || m.computed) return;
1053
+ if (prop.type !== "Identifier") return;
1054
+ const pname = prop.name;
1055
+ if (pname !== "caller" && pname !== "arguments") return;
1056
+ report(prop);
1057
+ } };
1058
+ }
1059
+ };
1060
+ var no_function_caller_arguments_default = rule$3;
1061
+
1062
+ //#endregion
1063
+ //#region src/rules/no-math-sum-precise/index.ts
1064
+ const rule$2 = {
1065
+ meta: {
1066
+ type: "problem",
1067
+ docs: { description: "disallow Math.sumPrecise() usage" },
1068
+ messages: { forbidden: "Math.sumPrecise is not allowed." },
1069
+ schema: []
1070
+ },
1071
+ create(context) {
1072
+ function report(node) {
1073
+ context.report({
1074
+ node,
1075
+ messageId: "forbidden"
1076
+ });
1077
+ }
1078
+ return {
1079
+ CallExpression(node) {
1080
+ const n = node;
1081
+ const callee = n.callee;
1082
+ if (callee && callee.type === "MemberExpression" && callee.computed === false && callee.object?.type === "Identifier" && callee.object?.name === "Math" && callee.property?.type === "Identifier" && callee.property?.name === "sumPrecise") report(callee.property);
1083
+ },
1084
+ MemberExpression(node) {
1085
+ const m = node;
1086
+ if (m.computed === false && m.object?.type === "Identifier" && m.object?.name === "Math" && m.property?.type === "Identifier" && m.property?.name === "sumPrecise") report(m.property);
1087
+ }
1088
+ };
1089
+ }
1090
+ };
1091
+ var no_math_sum_precise_default = rule$2;
1092
+
1093
+ //#endregion
1094
+ //#region src/rules/no-temporal/index.ts
1095
+ const rule$1 = {
1096
+ meta: {
1097
+ type: "problem",
1098
+ docs: { description: "disallow Temporal API usage" },
1099
+ messages: { forbidden: "Temporal API usage is not allowed." },
1100
+ schema: []
1101
+ },
1102
+ create(context) {
1103
+ function report(node) {
1104
+ context.report({
1105
+ node,
1106
+ messageId: "forbidden"
1107
+ });
1108
+ }
1109
+ function isTemporalIdent(node) {
1110
+ const n = node;
1111
+ return n && n.type === "Identifier" && n.name === "Temporal";
1112
+ }
1113
+ return {
1114
+ Identifier(node) {
1115
+ if (!isTemporalIdent(node)) return;
1116
+ const p = node.parent;
1117
+ if (!p) return;
1118
+ if (p.type === "MemberExpression" && p.object === node || p.type === "CallExpression" && p.callee === node || p.type === "NewExpression" && p.callee === node) report(node);
1119
+ },
1120
+ MemberExpression(node) {
1121
+ const m = node;
1122
+ if (m.computed === false && isTemporalIdent(m.object)) report(m.object);
1123
+ },
1124
+ NewExpression(node) {
1125
+ const n = node;
1126
+ if (isTemporalIdent(n.callee)) report(n.callee);
1127
+ }
1128
+ };
1129
+ }
1130
+ };
1131
+ var no_temporal_default = rule$1;
1132
+
1133
+ //#endregion
1134
+ //#region src/orchestrator/use-baseline.ts
1135
+ function mergeListeners(target, add) {
1136
+ const tgt = target;
1137
+ for (const [event, handler] of Object.entries(add)) {
1138
+ const name = event;
1139
+ const prev = target[name];
1140
+ if (!prev) tgt[event] = handler;
1141
+ else {
1142
+ const next = handler;
1143
+ tgt[event] = function merged(...args) {
1144
+ prev.apply(this, args);
1145
+ next.apply(this, args);
1146
+ };
1147
+ }
1148
+ }
1149
+ }
1150
+ function baselineMessage(featureId, baseline) {
1151
+ if (baseline === "widely") return `Feature '${featureId}' is not a widely available Baseline feature.`;
1152
+ if (baseline === "newly") return `Feature '${featureId}' is not a newly available Baseline feature.`;
1153
+ const rec = getFeatureRecord(featureId);
1154
+ const year = rec?.status?.baseline_low_date?.slice(0, 4) || rec?.status?.baseline_high_date?.slice(0, 4) || "unknown";
1155
+ return `Feature '${featureId}' became Baseline in ${year} and exceeds ${baseline}.`;
1156
+ }
1157
+ const rule = {
1158
+ meta: {
1159
+ type: "problem",
1160
+ docs: { description: "Enforce JS Baseline by delegating to underlying syntax rules (es-x)" },
1161
+ schema: [{
1162
+ type: "object",
1163
+ properties: {
1164
+ baseline: {
1165
+ anyOf: [{ enum: ["widely", "newly"] }, { type: "number" }],
1166
+ default: "widely"
1167
+ },
1168
+ available: {
1169
+ anyOf: [{ enum: ["widely", "newly"] }, { type: "number" }],
1170
+ default: "widely"
1171
+ },
1172
+ ignoreFeatures: {
1173
+ type: "array",
1174
+ items: { type: "string" }
1175
+ },
1176
+ ignoreNodeTypes: {
1177
+ type: "array",
1178
+ items: { type: "string" }
1179
+ }
1180
+ },
1181
+ additionalProperties: false
1182
+ }]
1183
+ },
1184
+ create(ctx) {
1185
+ const opt = ctx.options[0] ?? {};
1186
+ const baseline = getBaselineValue(opt);
1187
+ const ignoreFeaturePatterns = opt.ignoreFeatures ?? [];
1188
+ const ignoreNodeTypePatterns = opt.ignoreNodeTypes ?? [];
1189
+ function makeMatcher(patterns) {
1190
+ if (!patterns.length) return null;
1191
+ const compiled = patterns.map((p) => {
1192
+ if (p.startsWith("/") && p.endsWith("/") && p.length >= 2) try {
1193
+ return new RegExp(p.slice(1, -1));
1194
+ } catch {
1195
+ return p;
1196
+ }
1197
+ return p;
1198
+ });
1199
+ return (s) => compiled.some((m) => m instanceof RegExp ? m.test(s) : m === s);
1200
+ }
1201
+ const matchIgnoreFeature = makeMatcher(ignoreFeaturePatterns);
1202
+ const matchIgnoreNodeType = makeMatcher(ignoreNodeTypePatterns);
1203
+ const entries = [];
1204
+ const map = mapping_default;
1205
+ for (const [featureId, entry] of Object.entries(map)) {
1206
+ if (entry.kind !== "syntax") continue;
1207
+ if (matchIgnoreFeature && matchIgnoreFeature(featureId)) continue;
1208
+ if (!isBeyondBaseline(featureId, baseline)) continue;
1209
+ for (const d of entry.delegates) if (d.plugin === "es-x") entries.push({
1210
+ featureId,
1211
+ delegateRule: d.rule
1212
+ });
1213
+ else entries.push({
1214
+ featureId,
1215
+ delegateRule: `${d.plugin}/${d.rule}`
1216
+ });
1217
+ }
1218
+ const listeners = {};
1219
+ for (const { featureId, delegateRule } of entries) {
1220
+ let impl;
1221
+ let delegateOptions = [];
1222
+ const mappingEntry = map[featureId];
1223
+ if (mappingEntry) {
1224
+ const { plugin: plugin$1 } = parseDelegateRuleKey(delegateRule);
1225
+ const d = mappingEntry.delegates.find((x) => x.plugin === plugin$1);
1226
+ if (d?.options) delegateOptions = Array.isArray(d.options) ? d.options : [d.options];
1227
+ }
1228
+ const { plugin, name } = parseDelegateRuleKey(delegateRule);
1229
+ if (plugin === "core") {
1230
+ const coreName = name;
1231
+ const coreImpl = eslint_use_at_your_own_risk.builtinRules.get(coreName);
1232
+ impl = coreImpl;
1233
+ } else if (plugin === "self") {
1234
+ const selfName = name;
1235
+ const selfRules = {
1236
+ "no-bigint64array": no_bigint64array_default,
1237
+ "no-function-caller-arguments": no_function_caller_arguments_default,
1238
+ "no-math-sum-precise": no_math_sum_precise_default,
1239
+ "no-temporal": no_temporal_default
1240
+ };
1241
+ impl = selfRules[selfName];
1242
+ } else {
1243
+ const esxRules = eslint_plugin_es_x.default.rules;
1244
+ impl = esxRules?.[name];
1245
+ }
1246
+ if (!impl?.create) continue;
1247
+ const delegateCtx = {};
1248
+ const fwd = [
1249
+ "getSourceCode",
1250
+ "getCwd",
1251
+ "getFilename",
1252
+ "getPhysicalFilename",
1253
+ "getAncestors",
1254
+ "getDeclaredVariables",
1255
+ "markVariableAsUsed",
1256
+ "getScope"
1257
+ ];
1258
+ for (const k of fwd) {
1259
+ const v = ctx[k];
1260
+ if (typeof v === "function") {
1261
+ const fn = v;
1262
+ delegateCtx[k] = fn.bind(ctx);
1263
+ }
1264
+ }
1265
+ for (const k of [
1266
+ "settings",
1267
+ "parserPath",
1268
+ "parserOptions",
1269
+ "parserServices",
1270
+ "languageOptions",
1271
+ "sourceCode"
1272
+ ]) {
1273
+ const src = ctx;
1274
+ if (src[k] != null) delegateCtx[k] = src[k];
1275
+ }
1276
+ delegateCtx.options = delegateOptions;
1277
+ delegateCtx.report = function report(arg) {
1278
+ const isObj = typeof arg === "object" && arg !== null;
1279
+ const node = isObj && "node" in arg ? arg.node : arg;
1280
+ if (matchIgnoreNodeType) {
1281
+ const t = node?.type;
1282
+ if (t && matchIgnoreNodeType(t)) return;
1283
+ }
1284
+ ctx.report({
1285
+ node,
1286
+ message: baselineMessage(featureId, baseline)
1287
+ });
1288
+ };
1289
+ const l = impl.create(delegateCtx);
1290
+ mergeListeners(listeners, l);
1291
+ }
1292
+ return listeners;
1293
+ }
1294
+ };
1295
+ var use_baseline_default = rule;
1296
+
1297
+ //#endregion
1298
+ //#region src/index.ts
1299
+ const rules = {
1300
+ "use-baseline": use_baseline_default,
1301
+ "no-bigint64array": no_bigint64array_default,
1302
+ "no-function-caller-arguments": no_function_caller_arguments_default,
1303
+ "no-math-sum-precise": no_math_sum_precise_default,
1304
+ "no-temporal": no_temporal_default
1305
+ };
1306
+ var src_default = {
1307
+ rules,
1308
+ configs: { baseline: baselineConfigs }
1309
+ };
1310
+
1311
+ //#endregion
1312
+ module.exports = src_default;