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