eslint-plugin-baseline-js 0.2.0 → 0.3.0
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/README.md +4 -4
- package/dist/index.cjs +140 -59
- package/dist/index.mjs +139 -59
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -118,9 +118,9 @@ export default [
|
|
|
118
118
|
|
|
119
119
|
## How It Works
|
|
120
120
|
|
|
121
|
-
1. Data → `scripts/build-features.mjs`
|
|
122
|
-
- Extracts the minimal JavaScript subset from [`web‑features`](https://github.com/web-platform-dx/web-features) into `src/baseline/features.ts`.
|
|
123
|
-
2. Mapping → `src/baseline/mapping.
|
|
121
|
+
1. Data → `scripts/data/build-features.mjs`
|
|
122
|
+
- Extracts the minimal JavaScript subset from [`web‑features`](https://github.com/web-platform-dx/web-features) into `src/baseline/data/features.javascript.ts`.
|
|
123
|
+
2. Mapping → `src/baseline/mapping/syntax.ts`
|
|
124
124
|
- Maps web‑features IDs to underlying rules (prefer `eslint-plugin-es-x` / ESLint core; custom rules only when necessary).
|
|
125
125
|
3. Resolution → `src/baseline/resolve.ts`
|
|
126
126
|
- Classifies “beyond baseline” by bucket (`high/low/false → widely/newly/limited`) or year.
|
|
@@ -132,7 +132,7 @@ and shows which ones are currently mapped by this plugin.
|
|
|
132
132
|
|
|
133
133
|
- Report: [docs/coverage.md](docs/coverage.md)
|
|
134
134
|
- Regenerate locally: `pnpm gen:coverage`
|
|
135
|
-
-
|
|
135
|
+
- Generator: `scripts/coverage/generate-coverage.mjs`
|
|
136
136
|
|
|
137
137
|
## Options (rule)
|
|
138
138
|
|
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,8 @@ let eslint_use_at_your_own_risk = require("eslint/use-at-your-own-risk");
|
|
|
26
26
|
eslint_use_at_your_own_risk = __toESM(eslint_use_at_your_own_risk);
|
|
27
27
|
let eslint_plugin_es_x = require("eslint-plugin-es-x");
|
|
28
28
|
eslint_plugin_es_x = __toESM(eslint_plugin_es_x);
|
|
29
|
+
let node_module = require("node:module");
|
|
30
|
+
node_module = __toESM(node_module);
|
|
29
31
|
|
|
30
32
|
//#region src/configs/baseline.ts
|
|
31
33
|
/**
|
|
@@ -45260,9 +45262,6 @@ function getIncludedDescriptors(opts) {
|
|
|
45260
45262
|
|
|
45261
45263
|
//#endregion
|
|
45262
45264
|
//#region src/baseline/mapping/syntax.ts
|
|
45263
|
-
/**
|
|
45264
|
-
* @fileoverview Mapping of web-features JavaScript feature IDs to delegate ESLint rules.
|
|
45265
|
-
*/
|
|
45266
45265
|
var syntax_default = {
|
|
45267
45266
|
"nullish-coalescing": {
|
|
45268
45267
|
kind: "syntax",
|
|
@@ -45296,7 +45295,7 @@ var syntax_default = {
|
|
|
45296
45295
|
level: "error"
|
|
45297
45296
|
}]
|
|
45298
45297
|
},
|
|
45299
|
-
"numeric-
|
|
45298
|
+
"numeric-separators": {
|
|
45300
45299
|
kind: "syntax",
|
|
45301
45300
|
delegates: [{
|
|
45302
45301
|
plugin: "es-x",
|
|
@@ -45492,6 +45491,14 @@ var syntax_default = {
|
|
|
45492
45491
|
level: "error"
|
|
45493
45492
|
}]
|
|
45494
45493
|
},
|
|
45494
|
+
iterators: {
|
|
45495
|
+
kind: "syntax",
|
|
45496
|
+
delegates: [{
|
|
45497
|
+
plugin: "es-x",
|
|
45498
|
+
rule: "no-for-of-loops",
|
|
45499
|
+
level: "error"
|
|
45500
|
+
}]
|
|
45501
|
+
},
|
|
45495
45502
|
bigint64array: {
|
|
45496
45503
|
kind: "syntax",
|
|
45497
45504
|
delegates: [{
|
|
@@ -53364,7 +53371,7 @@ var features_javascript_default = {
|
|
|
53364
53371
|
"arguments-callee": {
|
|
53365
53372
|
"id": "arguments-callee",
|
|
53366
53373
|
"name": "arguments.callee",
|
|
53367
|
-
"group": "javascript",
|
|
53374
|
+
"group": ["javascript"],
|
|
53368
53375
|
"status": {
|
|
53369
53376
|
"baseline": false,
|
|
53370
53377
|
"support": {
|
|
@@ -53382,7 +53389,7 @@ var features_javascript_default = {
|
|
|
53382
53389
|
"async-await": {
|
|
53383
53390
|
"id": "async-await",
|
|
53384
53391
|
"name": "Async functions",
|
|
53385
|
-
"group": "javascript",
|
|
53392
|
+
"group": ["javascript"],
|
|
53386
53393
|
"status": {
|
|
53387
53394
|
"baseline": "high",
|
|
53388
53395
|
"baseline_low_date": "2017-04-05",
|
|
@@ -53401,7 +53408,7 @@ var features_javascript_default = {
|
|
|
53401
53408
|
"async-generators": {
|
|
53402
53409
|
"id": "async-generators",
|
|
53403
53410
|
"name": "Async generators",
|
|
53404
|
-
"group": "javascript",
|
|
53411
|
+
"group": ["javascript"],
|
|
53405
53412
|
"status": {
|
|
53406
53413
|
"baseline": "high",
|
|
53407
53414
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53420,7 +53427,7 @@ var features_javascript_default = {
|
|
|
53420
53427
|
"atomics-wait-async": {
|
|
53421
53428
|
"id": "atomics-wait-async",
|
|
53422
53429
|
"name": "Atomics.waitAsync",
|
|
53423
|
-
"group": "javascript",
|
|
53430
|
+
"group": ["javascript"],
|
|
53424
53431
|
"status": {
|
|
53425
53432
|
"baseline": false,
|
|
53426
53433
|
"support": {
|
|
@@ -53435,7 +53442,7 @@ var features_javascript_default = {
|
|
|
53435
53442
|
"bigint": {
|
|
53436
53443
|
"id": "bigint",
|
|
53437
53444
|
"name": "BigInt",
|
|
53438
|
-
"group": "javascript",
|
|
53445
|
+
"group": ["javascript"],
|
|
53439
53446
|
"status": {
|
|
53440
53447
|
"baseline": "high",
|
|
53441
53448
|
"baseline_low_date": "2020-09-16",
|
|
@@ -53454,7 +53461,7 @@ var features_javascript_default = {
|
|
|
53454
53461
|
"bigint64array": {
|
|
53455
53462
|
"id": "bigint64array",
|
|
53456
53463
|
"name": "BigInt64Array",
|
|
53457
|
-
"group": "javascript",
|
|
53464
|
+
"group": ["javascript"],
|
|
53458
53465
|
"status": {
|
|
53459
53466
|
"baseline": "high",
|
|
53460
53467
|
"baseline_low_date": "2021-09-20",
|
|
@@ -53473,7 +53480,7 @@ var features_javascript_default = {
|
|
|
53473
53480
|
"class-syntax": {
|
|
53474
53481
|
"id": "class-syntax",
|
|
53475
53482
|
"name": "Classes",
|
|
53476
|
-
"group": "javascript",
|
|
53483
|
+
"group": ["javascript"],
|
|
53477
53484
|
"status": {
|
|
53478
53485
|
"baseline": "high",
|
|
53479
53486
|
"baseline_low_date": "2016-03-08",
|
|
@@ -53492,7 +53499,7 @@ var features_javascript_default = {
|
|
|
53492
53499
|
"date-get-year-set-year": {
|
|
53493
53500
|
"id": "date-get-year-set-year",
|
|
53494
53501
|
"name": "getYear() and setYear()",
|
|
53495
|
-
"group": "javascript",
|
|
53502
|
+
"group": ["javascript"],
|
|
53496
53503
|
"status": {
|
|
53497
53504
|
"baseline": false,
|
|
53498
53505
|
"support": {
|
|
@@ -53510,7 +53517,7 @@ var features_javascript_default = {
|
|
|
53510
53517
|
"destructuring": {
|
|
53511
53518
|
"id": "destructuring",
|
|
53512
53519
|
"name": "Destructuring",
|
|
53513
|
-
"group": "javascript",
|
|
53520
|
+
"group": ["javascript"],
|
|
53514
53521
|
"status": {
|
|
53515
53522
|
"baseline": "high",
|
|
53516
53523
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53529,7 +53536,7 @@ var features_javascript_default = {
|
|
|
53529
53536
|
"escape-unescape": {
|
|
53530
53537
|
"id": "escape-unescape",
|
|
53531
53538
|
"name": "escape() and unescape()",
|
|
53532
|
-
"group": "javascript",
|
|
53539
|
+
"group": ["javascript"],
|
|
53533
53540
|
"status": {
|
|
53534
53541
|
"baseline": false,
|
|
53535
53542
|
"support": {
|
|
@@ -53547,7 +53554,7 @@ var features_javascript_default = {
|
|
|
53547
53554
|
"exponentiation": {
|
|
53548
53555
|
"id": "exponentiation",
|
|
53549
53556
|
"name": "Exponentiation operator",
|
|
53550
|
-
"group": "javascript",
|
|
53557
|
+
"group": ["javascript"],
|
|
53551
53558
|
"status": {
|
|
53552
53559
|
"baseline": "high",
|
|
53553
53560
|
"baseline_low_date": "2017-03-27",
|
|
@@ -53566,7 +53573,7 @@ var features_javascript_default = {
|
|
|
53566
53573
|
"functions": {
|
|
53567
53574
|
"id": "functions",
|
|
53568
53575
|
"name": "Functions",
|
|
53569
|
-
"group": "javascript",
|
|
53576
|
+
"group": ["javascript"],
|
|
53570
53577
|
"status": {
|
|
53571
53578
|
"baseline": "high",
|
|
53572
53579
|
"baseline_low_date": "2015-07-29",
|
|
@@ -53585,7 +53592,7 @@ var features_javascript_default = {
|
|
|
53585
53592
|
"functions-caller-arguments": {
|
|
53586
53593
|
"id": "functions-caller-arguments",
|
|
53587
53594
|
"name": "Function caller and arguments",
|
|
53588
|
-
"group": "javascript",
|
|
53595
|
+
"group": ["javascript"],
|
|
53589
53596
|
"status": {
|
|
53590
53597
|
"baseline": false,
|
|
53591
53598
|
"support": {
|
|
@@ -53603,7 +53610,7 @@ var features_javascript_default = {
|
|
|
53603
53610
|
"generators": {
|
|
53604
53611
|
"id": "generators",
|
|
53605
53612
|
"name": "Generators",
|
|
53606
|
-
"group": "javascript",
|
|
53613
|
+
"group": ["javascript"],
|
|
53607
53614
|
"status": {
|
|
53608
53615
|
"baseline": "high",
|
|
53609
53616
|
"baseline_low_date": "2016-09-20",
|
|
@@ -53622,7 +53629,7 @@ var features_javascript_default = {
|
|
|
53622
53629
|
"globalthis": {
|
|
53623
53630
|
"id": "globalthis",
|
|
53624
53631
|
"name": "globalThis",
|
|
53625
|
-
"group": "javascript",
|
|
53632
|
+
"group": ["javascript"],
|
|
53626
53633
|
"status": {
|
|
53627
53634
|
"baseline": "high",
|
|
53628
53635
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53641,7 +53648,7 @@ var features_javascript_default = {
|
|
|
53641
53648
|
"hashbang-comments": {
|
|
53642
53649
|
"id": "hashbang-comments",
|
|
53643
53650
|
"name": "Hashbang comments",
|
|
53644
|
-
"group": "javascript",
|
|
53651
|
+
"group": ["javascript"],
|
|
53645
53652
|
"status": {
|
|
53646
53653
|
"baseline": "high",
|
|
53647
53654
|
"baseline_low_date": "2020-03-24",
|
|
@@ -53660,7 +53667,7 @@ var features_javascript_default = {
|
|
|
53660
53667
|
"html-wrapper-methods": {
|
|
53661
53668
|
"id": "html-wrapper-methods",
|
|
53662
53669
|
"name": "HTML wrapper methods",
|
|
53663
|
-
"group": "javascript",
|
|
53670
|
+
"group": ["javascript"],
|
|
53664
53671
|
"status": {
|
|
53665
53672
|
"baseline": false,
|
|
53666
53673
|
"support": {
|
|
@@ -53681,7 +53688,7 @@ var features_javascript_default = {
|
|
|
53681
53688
|
"javascript": {
|
|
53682
53689
|
"id": "javascript",
|
|
53683
53690
|
"name": "JavaScript (initial core language support)",
|
|
53684
|
-
"group": "javascript",
|
|
53691
|
+
"group": ["javascript"],
|
|
53685
53692
|
"status": {
|
|
53686
53693
|
"baseline": "high",
|
|
53687
53694
|
"baseline_low_date": "2015-07-29",
|
|
@@ -53700,7 +53707,7 @@ var features_javascript_default = {
|
|
|
53700
53707
|
"let-const": {
|
|
53701
53708
|
"id": "let-const",
|
|
53702
53709
|
"name": "Let and const",
|
|
53703
|
-
"group": "javascript",
|
|
53710
|
+
"group": ["javascript"],
|
|
53704
53711
|
"status": {
|
|
53705
53712
|
"baseline": "high",
|
|
53706
53713
|
"baseline_low_date": "2016-09-20",
|
|
@@ -53719,7 +53726,7 @@ var features_javascript_default = {
|
|
|
53719
53726
|
"logical-assignments": {
|
|
53720
53727
|
"id": "logical-assignments",
|
|
53721
53728
|
"name": "Logical assignments",
|
|
53722
|
-
"group": "javascript",
|
|
53729
|
+
"group": ["javascript"],
|
|
53723
53730
|
"status": {
|
|
53724
53731
|
"baseline": "high",
|
|
53725
53732
|
"baseline_low_date": "2020-09-16",
|
|
@@ -53738,7 +53745,7 @@ var features_javascript_default = {
|
|
|
53738
53745
|
"math-sum-precise": {
|
|
53739
53746
|
"id": "math-sum-precise",
|
|
53740
53747
|
"name": "Math.sumPrecise()",
|
|
53741
|
-
"group": "javascript",
|
|
53748
|
+
"group": ["javascript"],
|
|
53742
53749
|
"status": {
|
|
53743
53750
|
"baseline": false,
|
|
53744
53751
|
"support": {
|
|
@@ -53750,7 +53757,7 @@ var features_javascript_default = {
|
|
|
53750
53757
|
"nullish-coalescing": {
|
|
53751
53758
|
"id": "nullish-coalescing",
|
|
53752
53759
|
"name": "Nullish coalescing",
|
|
53753
|
-
"group": "javascript",
|
|
53760
|
+
"group": ["javascript"],
|
|
53754
53761
|
"status": {
|
|
53755
53762
|
"baseline": "high",
|
|
53756
53763
|
"baseline_low_date": "2020-09-16",
|
|
@@ -53766,10 +53773,10 @@ var features_javascript_default = {
|
|
|
53766
53773
|
}
|
|
53767
53774
|
}
|
|
53768
53775
|
},
|
|
53769
|
-
"numeric-
|
|
53770
|
-
"id": "numeric-
|
|
53776
|
+
"numeric-separators": {
|
|
53777
|
+
"id": "numeric-separators",
|
|
53771
53778
|
"name": "Numeric separators",
|
|
53772
|
-
"group": "javascript",
|
|
53779
|
+
"group": ["javascript"],
|
|
53773
53780
|
"status": {
|
|
53774
53781
|
"baseline": "high",
|
|
53775
53782
|
"baseline_low_date": "2020-07-28",
|
|
@@ -53788,7 +53795,7 @@ var features_javascript_default = {
|
|
|
53788
53795
|
"optional-catch-binding": {
|
|
53789
53796
|
"id": "optional-catch-binding",
|
|
53790
53797
|
"name": "Optional catch binding",
|
|
53791
|
-
"group": "javascript",
|
|
53798
|
+
"group": ["javascript"],
|
|
53792
53799
|
"status": {
|
|
53793
53800
|
"baseline": "high",
|
|
53794
53801
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53807,7 +53814,7 @@ var features_javascript_default = {
|
|
|
53807
53814
|
"proxy-reflect": {
|
|
53808
53815
|
"id": "proxy-reflect",
|
|
53809
53816
|
"name": "Proxy and Reflect",
|
|
53810
|
-
"group": "javascript",
|
|
53817
|
+
"group": ["javascript"],
|
|
53811
53818
|
"status": {
|
|
53812
53819
|
"baseline": "high",
|
|
53813
53820
|
"baseline_low_date": "2016-09-20",
|
|
@@ -53826,7 +53833,7 @@ var features_javascript_default = {
|
|
|
53826
53833
|
"shared-memory": {
|
|
53827
53834
|
"id": "shared-memory",
|
|
53828
53835
|
"name": "SharedArrayBuffer and Atomics",
|
|
53829
|
-
"group": "javascript",
|
|
53836
|
+
"group": ["javascript"],
|
|
53830
53837
|
"status": {
|
|
53831
53838
|
"baseline": "high",
|
|
53832
53839
|
"baseline_low_date": "2021-12-13",
|
|
@@ -53845,7 +53852,7 @@ var features_javascript_default = {
|
|
|
53845
53852
|
"spread": {
|
|
53846
53853
|
"id": "spread",
|
|
53847
53854
|
"name": "Spread syntax",
|
|
53848
|
-
"group": "javascript",
|
|
53855
|
+
"group": ["javascript"],
|
|
53849
53856
|
"status": {
|
|
53850
53857
|
"baseline": "high",
|
|
53851
53858
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53864,7 +53871,7 @@ var features_javascript_default = {
|
|
|
53864
53871
|
"template-literals": {
|
|
53865
53872
|
"id": "template-literals",
|
|
53866
53873
|
"name": "Template literals",
|
|
53867
|
-
"group": "javascript",
|
|
53874
|
+
"group": ["javascript"],
|
|
53868
53875
|
"status": {
|
|
53869
53876
|
"baseline": "high",
|
|
53870
53877
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53883,7 +53890,7 @@ var features_javascript_default = {
|
|
|
53883
53890
|
"temporal": {
|
|
53884
53891
|
"id": "temporal",
|
|
53885
53892
|
"name": "Temporal",
|
|
53886
|
-
"group": "javascript",
|
|
53893
|
+
"group": ["javascript"],
|
|
53887
53894
|
"status": {
|
|
53888
53895
|
"baseline": false,
|
|
53889
53896
|
"support": {
|
|
@@ -53895,7 +53902,7 @@ var features_javascript_default = {
|
|
|
53895
53902
|
"top-level-await": {
|
|
53896
53903
|
"id": "top-level-await",
|
|
53897
53904
|
"name": "Top-level await",
|
|
53898
|
-
"group": "javascript",
|
|
53905
|
+
"group": ["javascript"],
|
|
53899
53906
|
"status": {
|
|
53900
53907
|
"baseline": "high",
|
|
53901
53908
|
"baseline_low_date": "2021-09-20",
|
|
@@ -53914,7 +53921,7 @@ var features_javascript_default = {
|
|
|
53914
53921
|
"unicode-point-escapes": {
|
|
53915
53922
|
"id": "unicode-point-escapes",
|
|
53916
53923
|
"name": "Unicode point escapes",
|
|
53917
|
-
"group": "javascript",
|
|
53924
|
+
"group": ["javascript"],
|
|
53918
53925
|
"status": {
|
|
53919
53926
|
"baseline": "high",
|
|
53920
53927
|
"baseline_low_date": "2015-09-30",
|
|
@@ -53933,7 +53940,7 @@ var features_javascript_default = {
|
|
|
53933
53940
|
"weak-references": {
|
|
53934
53941
|
"id": "weak-references",
|
|
53935
53942
|
"name": "Weak references",
|
|
53936
|
-
"group": "javascript",
|
|
53943
|
+
"group": ["javascript"],
|
|
53937
53944
|
"status": {
|
|
53938
53945
|
"baseline": "high",
|
|
53939
53946
|
"baseline_low_date": "2021-04-26",
|
|
@@ -53952,7 +53959,7 @@ var features_javascript_default = {
|
|
|
53952
53959
|
"with": {
|
|
53953
53960
|
"id": "with",
|
|
53954
53961
|
"name": "with",
|
|
53955
|
-
"group": "javascript",
|
|
53962
|
+
"group": ["javascript"],
|
|
53956
53963
|
"status": {
|
|
53957
53964
|
"baseline": false,
|
|
53958
53965
|
"support": {
|
|
@@ -56246,8 +56253,87 @@ const rule$1 = {
|
|
|
56246
56253
|
};
|
|
56247
56254
|
var no_temporal_default = rule$1;
|
|
56248
56255
|
|
|
56256
|
+
//#endregion
|
|
56257
|
+
//#region src/utils/rule-resolver.ts
|
|
56258
|
+
/**
|
|
56259
|
+
* Normalize ESM/CJS export shapes for ESLint plugins.
|
|
56260
|
+
* Some toolchains expose plugins as `{ rules }` or under `{ default: { rules } }`.
|
|
56261
|
+
* This helper selects whichever shape is present and returns the rules map.
|
|
56262
|
+
*/
|
|
56263
|
+
function resolvePluginRules(mod) {
|
|
56264
|
+
if (!mod || typeof mod !== "object" && typeof mod !== "function") return void 0;
|
|
56265
|
+
const m = mod;
|
|
56266
|
+
const rules$1 = m.rules ?? m.default?.rules;
|
|
56267
|
+
if (rules$1 && typeof rules$1 === "object") return rules$1;
|
|
56268
|
+
}
|
|
56269
|
+
/**
|
|
56270
|
+
* Resolve rules for eslint-plugin-es-x in a robust way.
|
|
56271
|
+
* Why: In CI (Node 22 / ESLint 9), ESM interop may attach rules under
|
|
56272
|
+
* `default.rules` instead of `rules`. Only checking `esx.rules` meant no
|
|
56273
|
+
* delegates were created and tests failed.
|
|
56274
|
+
* Approach: Prefer loading the CommonJS entry via `createRequire` to avoid
|
|
56275
|
+
* interop variance, then normalize the export with `resolvePluginRules()`.
|
|
56276
|
+
*/
|
|
56277
|
+
function resolveEsxRules() {
|
|
56278
|
+
try {
|
|
56279
|
+
const m = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("eslint-plugin-es-x");
|
|
56280
|
+
const rules$1 = resolvePluginRules(m);
|
|
56281
|
+
if (rules$1) return rules$1;
|
|
56282
|
+
} catch {}
|
|
56283
|
+
}
|
|
56284
|
+
/**
|
|
56285
|
+
* Try resolving es-x rules from a provided module first (ESM import),
|
|
56286
|
+
* then fall back to the CommonJS `require` path if needed.
|
|
56287
|
+
*/
|
|
56288
|
+
function resolveEsxRulesFrom(mod) {
|
|
56289
|
+
const fromImport = mod ? resolvePluginRules(mod) : void 0;
|
|
56290
|
+
if (fromImport) return fromImport;
|
|
56291
|
+
return resolveEsxRules();
|
|
56292
|
+
}
|
|
56293
|
+
function getEsxRule(name) {
|
|
56294
|
+
if (!esxRulesResolved) {
|
|
56295
|
+
esxRulesCache = resolveEsxRules();
|
|
56296
|
+
esxRulesResolved = true;
|
|
56297
|
+
}
|
|
56298
|
+
return esxRulesCache?.[name];
|
|
56299
|
+
}
|
|
56300
|
+
let esxRulesCache;
|
|
56301
|
+
let esxRulesResolved = false;
|
|
56302
|
+
|
|
56303
|
+
//#endregion
|
|
56304
|
+
//#region src/utils/delegate-resolver.ts
|
|
56305
|
+
let selfRules = null;
|
|
56306
|
+
function registerSelfRules(rules$1) {
|
|
56307
|
+
selfRules = rules$1;
|
|
56308
|
+
}
|
|
56309
|
+
function resolveEsx(name) {
|
|
56310
|
+
return resolveEsxRulesFrom(eslint_plugin_es_x.default)?.[name] || getEsxRule(name);
|
|
56311
|
+
}
|
|
56312
|
+
const registry = {
|
|
56313
|
+
"es-x": resolveEsx,
|
|
56314
|
+
self: (name) => selfRules ? selfRules[name] : void 0,
|
|
56315
|
+
core: (name) => eslint_use_at_your_own_risk.builtinRules.get(name)
|
|
56316
|
+
};
|
|
56317
|
+
function resolveDelegateRule(plugin, name) {
|
|
56318
|
+
const resolver = registry[plugin];
|
|
56319
|
+
if (!resolver) return void 0;
|
|
56320
|
+
return resolver(name);
|
|
56321
|
+
}
|
|
56322
|
+
/**
|
|
56323
|
+
* Debug helper: list available resolver aliases. Used when BASELINE_DEBUG=1.
|
|
56324
|
+
*/
|
|
56325
|
+
function listResolverPlugins() {
|
|
56326
|
+
return Object.keys(registry).sort();
|
|
56327
|
+
}
|
|
56328
|
+
|
|
56249
56329
|
//#endregion
|
|
56250
56330
|
//#region src/orchestrator/use-baseline.ts
|
|
56331
|
+
registerSelfRules({
|
|
56332
|
+
"no-bigint64array": no_bigint64array_default,
|
|
56333
|
+
"no-function-caller-arguments": no_function_caller_arguments_default,
|
|
56334
|
+
"no-math-sum-precise": no_math_sum_precise_default,
|
|
56335
|
+
"no-temporal": no_temporal_default
|
|
56336
|
+
});
|
|
56251
56337
|
function mergeListeners(target, add) {
|
|
56252
56338
|
const tgt = target;
|
|
56253
56339
|
for (const [event, handler] of Object.entries(add)) {
|
|
@@ -56360,6 +56446,7 @@ const rule = {
|
|
|
56360
56446
|
}]
|
|
56361
56447
|
},
|
|
56362
56448
|
create(ctx) {
|
|
56449
|
+
const _DEBUG = process.env.BASELINE_DEBUG === "1";
|
|
56363
56450
|
const getFilename = ctx.getFilename;
|
|
56364
56451
|
let filename = null;
|
|
56365
56452
|
if (typeof getFilename === "function") try {
|
|
@@ -56405,6 +56492,9 @@ const rule = {
|
|
|
56405
56492
|
}
|
|
56406
56493
|
const listeners = {};
|
|
56407
56494
|
const mappedFeatureIds = new Set(entries.map((e) => e.featureId));
|
|
56495
|
+
if (_DEBUG) try {
|
|
56496
|
+
console.log(`[baseline-js] resolvers=${listResolverPlugins().join(",")} entries=${entries.length}`);
|
|
56497
|
+
} catch {}
|
|
56408
56498
|
for (const { featureId, delegateRule } of entries) {
|
|
56409
56499
|
let impl;
|
|
56410
56500
|
let delegateOptions = [];
|
|
@@ -56415,21 +56505,10 @@ const rule = {
|
|
|
56415
56505
|
if (d?.options) delegateOptions = Array.isArray(d.options) ? d.options : [d.options];
|
|
56416
56506
|
}
|
|
56417
56507
|
const { plugin, name } = parseDelegateRuleKey(delegateRule);
|
|
56418
|
-
|
|
56419
|
-
const coreName = name;
|
|
56420
|
-
impl = eslint_use_at_your_own_risk.builtinRules.get(coreName);
|
|
56421
|
-
} else if (plugin === "self") {
|
|
56422
|
-
const selfName = name;
|
|
56423
|
-
impl = {
|
|
56424
|
-
"no-bigint64array": no_bigint64array_default,
|
|
56425
|
-
"no-function-caller-arguments": no_function_caller_arguments_default,
|
|
56426
|
-
"no-math-sum-precise": no_math_sum_precise_default,
|
|
56427
|
-
"no-temporal": no_temporal_default
|
|
56428
|
-
}[selfName];
|
|
56429
|
-
} else impl = eslint_plugin_es_x.default.rules?.[name];
|
|
56508
|
+
impl = resolveDelegateRule(plugin, name);
|
|
56430
56509
|
if (!impl?.create) continue;
|
|
56431
56510
|
const delegateCtx = {};
|
|
56432
|
-
const
|
|
56511
|
+
for (const k of [
|
|
56433
56512
|
"getSourceCode",
|
|
56434
56513
|
"getCwd",
|
|
56435
56514
|
"getFilename",
|
|
@@ -56438,15 +56517,13 @@ const rule = {
|
|
|
56438
56517
|
"getDeclaredVariables",
|
|
56439
56518
|
"markVariableAsUsed",
|
|
56440
56519
|
"getScope"
|
|
56441
|
-
]
|
|
56442
|
-
for (const k of fwd) {
|
|
56520
|
+
]) {
|
|
56443
56521
|
const v = ctx[k];
|
|
56444
56522
|
if (typeof v === "function") delegateCtx[k] = v.bind(ctx);
|
|
56445
56523
|
}
|
|
56446
56524
|
for (const k of [
|
|
56447
56525
|
"settings",
|
|
56448
56526
|
"parserPath",
|
|
56449
|
-
"parserOptions",
|
|
56450
56527
|
"parserServices",
|
|
56451
56528
|
"languageOptions",
|
|
56452
56529
|
"sourceCode"
|
|
@@ -56454,6 +56531,10 @@ const rule = {
|
|
|
56454
56531
|
const src = ctx;
|
|
56455
56532
|
if (src[k] != null) delegateCtx[k] = src[k];
|
|
56456
56533
|
}
|
|
56534
|
+
delegateCtx.parserOptions = {
|
|
56535
|
+
...ctx.parserOptions ?? {},
|
|
56536
|
+
ecmaVersion: 3
|
|
56537
|
+
};
|
|
56457
56538
|
delegateCtx.options = delegateOptions;
|
|
56458
56539
|
delegateCtx.report = function report(arg) {
|
|
56459
56540
|
const node = typeof arg === "object" && arg !== null && "node" in arg ? arg.node : arg;
|
|
@@ -56497,7 +56578,7 @@ const rule = {
|
|
|
56497
56578
|
const messages = {};
|
|
56498
56579
|
for (const d of descriptors$2) messages[d.featureId] = baselineMessage(d.featureId, baseline);
|
|
56499
56580
|
const delegateCtx = {};
|
|
56500
|
-
const
|
|
56581
|
+
for (const k of [
|
|
56501
56582
|
"getSourceCode",
|
|
56502
56583
|
"getCwd",
|
|
56503
56584
|
"getFilename",
|
|
@@ -56506,8 +56587,7 @@ const rule = {
|
|
|
56506
56587
|
"getDeclaredVariables",
|
|
56507
56588
|
"markVariableAsUsed",
|
|
56508
56589
|
"getScope"
|
|
56509
|
-
]
|
|
56510
|
-
for (const k of fwd) {
|
|
56590
|
+
]) {
|
|
56511
56591
|
const v = ctx[k];
|
|
56512
56592
|
if (typeof v === "function") delegateCtx[k] = v.bind(ctx);
|
|
56513
56593
|
}
|
|
@@ -56537,7 +56617,8 @@ const rule = {
|
|
|
56537
56617
|
const t = node?.type;
|
|
56538
56618
|
if (t && matchIgnoreNodeType(t)) return;
|
|
56539
56619
|
}
|
|
56540
|
-
|
|
56620
|
+
let msg;
|
|
56621
|
+
if (isObj && typeof arg.message === "string") msg = arg.message;
|
|
56541
56622
|
ctx.report({
|
|
56542
56623
|
node,
|
|
56543
56624
|
message: msg
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { builtinRules } from "eslint/use-at-your-own-risk";
|
|
2
3
|
import esx from "eslint-plugin-es-x";
|
|
3
4
|
|
|
@@ -45234,9 +45235,6 @@ function getIncludedDescriptors(opts) {
|
|
|
45234
45235
|
|
|
45235
45236
|
//#endregion
|
|
45236
45237
|
//#region src/baseline/mapping/syntax.ts
|
|
45237
|
-
/**
|
|
45238
|
-
* @fileoverview Mapping of web-features JavaScript feature IDs to delegate ESLint rules.
|
|
45239
|
-
*/
|
|
45240
45238
|
var syntax_default = {
|
|
45241
45239
|
"nullish-coalescing": {
|
|
45242
45240
|
kind: "syntax",
|
|
@@ -45270,7 +45268,7 @@ var syntax_default = {
|
|
|
45270
45268
|
level: "error"
|
|
45271
45269
|
}]
|
|
45272
45270
|
},
|
|
45273
|
-
"numeric-
|
|
45271
|
+
"numeric-separators": {
|
|
45274
45272
|
kind: "syntax",
|
|
45275
45273
|
delegates: [{
|
|
45276
45274
|
plugin: "es-x",
|
|
@@ -45466,6 +45464,14 @@ var syntax_default = {
|
|
|
45466
45464
|
level: "error"
|
|
45467
45465
|
}]
|
|
45468
45466
|
},
|
|
45467
|
+
iterators: {
|
|
45468
|
+
kind: "syntax",
|
|
45469
|
+
delegates: [{
|
|
45470
|
+
plugin: "es-x",
|
|
45471
|
+
rule: "no-for-of-loops",
|
|
45472
|
+
level: "error"
|
|
45473
|
+
}]
|
|
45474
|
+
},
|
|
45469
45475
|
bigint64array: {
|
|
45470
45476
|
kind: "syntax",
|
|
45471
45477
|
delegates: [{
|
|
@@ -53338,7 +53344,7 @@ var features_javascript_default = {
|
|
|
53338
53344
|
"arguments-callee": {
|
|
53339
53345
|
"id": "arguments-callee",
|
|
53340
53346
|
"name": "arguments.callee",
|
|
53341
|
-
"group": "javascript",
|
|
53347
|
+
"group": ["javascript"],
|
|
53342
53348
|
"status": {
|
|
53343
53349
|
"baseline": false,
|
|
53344
53350
|
"support": {
|
|
@@ -53356,7 +53362,7 @@ var features_javascript_default = {
|
|
|
53356
53362
|
"async-await": {
|
|
53357
53363
|
"id": "async-await",
|
|
53358
53364
|
"name": "Async functions",
|
|
53359
|
-
"group": "javascript",
|
|
53365
|
+
"group": ["javascript"],
|
|
53360
53366
|
"status": {
|
|
53361
53367
|
"baseline": "high",
|
|
53362
53368
|
"baseline_low_date": "2017-04-05",
|
|
@@ -53375,7 +53381,7 @@ var features_javascript_default = {
|
|
|
53375
53381
|
"async-generators": {
|
|
53376
53382
|
"id": "async-generators",
|
|
53377
53383
|
"name": "Async generators",
|
|
53378
|
-
"group": "javascript",
|
|
53384
|
+
"group": ["javascript"],
|
|
53379
53385
|
"status": {
|
|
53380
53386
|
"baseline": "high",
|
|
53381
53387
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53394,7 +53400,7 @@ var features_javascript_default = {
|
|
|
53394
53400
|
"atomics-wait-async": {
|
|
53395
53401
|
"id": "atomics-wait-async",
|
|
53396
53402
|
"name": "Atomics.waitAsync",
|
|
53397
|
-
"group": "javascript",
|
|
53403
|
+
"group": ["javascript"],
|
|
53398
53404
|
"status": {
|
|
53399
53405
|
"baseline": false,
|
|
53400
53406
|
"support": {
|
|
@@ -53409,7 +53415,7 @@ var features_javascript_default = {
|
|
|
53409
53415
|
"bigint": {
|
|
53410
53416
|
"id": "bigint",
|
|
53411
53417
|
"name": "BigInt",
|
|
53412
|
-
"group": "javascript",
|
|
53418
|
+
"group": ["javascript"],
|
|
53413
53419
|
"status": {
|
|
53414
53420
|
"baseline": "high",
|
|
53415
53421
|
"baseline_low_date": "2020-09-16",
|
|
@@ -53428,7 +53434,7 @@ var features_javascript_default = {
|
|
|
53428
53434
|
"bigint64array": {
|
|
53429
53435
|
"id": "bigint64array",
|
|
53430
53436
|
"name": "BigInt64Array",
|
|
53431
|
-
"group": "javascript",
|
|
53437
|
+
"group": ["javascript"],
|
|
53432
53438
|
"status": {
|
|
53433
53439
|
"baseline": "high",
|
|
53434
53440
|
"baseline_low_date": "2021-09-20",
|
|
@@ -53447,7 +53453,7 @@ var features_javascript_default = {
|
|
|
53447
53453
|
"class-syntax": {
|
|
53448
53454
|
"id": "class-syntax",
|
|
53449
53455
|
"name": "Classes",
|
|
53450
|
-
"group": "javascript",
|
|
53456
|
+
"group": ["javascript"],
|
|
53451
53457
|
"status": {
|
|
53452
53458
|
"baseline": "high",
|
|
53453
53459
|
"baseline_low_date": "2016-03-08",
|
|
@@ -53466,7 +53472,7 @@ var features_javascript_default = {
|
|
|
53466
53472
|
"date-get-year-set-year": {
|
|
53467
53473
|
"id": "date-get-year-set-year",
|
|
53468
53474
|
"name": "getYear() and setYear()",
|
|
53469
|
-
"group": "javascript",
|
|
53475
|
+
"group": ["javascript"],
|
|
53470
53476
|
"status": {
|
|
53471
53477
|
"baseline": false,
|
|
53472
53478
|
"support": {
|
|
@@ -53484,7 +53490,7 @@ var features_javascript_default = {
|
|
|
53484
53490
|
"destructuring": {
|
|
53485
53491
|
"id": "destructuring",
|
|
53486
53492
|
"name": "Destructuring",
|
|
53487
|
-
"group": "javascript",
|
|
53493
|
+
"group": ["javascript"],
|
|
53488
53494
|
"status": {
|
|
53489
53495
|
"baseline": "high",
|
|
53490
53496
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53503,7 +53509,7 @@ var features_javascript_default = {
|
|
|
53503
53509
|
"escape-unescape": {
|
|
53504
53510
|
"id": "escape-unescape",
|
|
53505
53511
|
"name": "escape() and unescape()",
|
|
53506
|
-
"group": "javascript",
|
|
53512
|
+
"group": ["javascript"],
|
|
53507
53513
|
"status": {
|
|
53508
53514
|
"baseline": false,
|
|
53509
53515
|
"support": {
|
|
@@ -53521,7 +53527,7 @@ var features_javascript_default = {
|
|
|
53521
53527
|
"exponentiation": {
|
|
53522
53528
|
"id": "exponentiation",
|
|
53523
53529
|
"name": "Exponentiation operator",
|
|
53524
|
-
"group": "javascript",
|
|
53530
|
+
"group": ["javascript"],
|
|
53525
53531
|
"status": {
|
|
53526
53532
|
"baseline": "high",
|
|
53527
53533
|
"baseline_low_date": "2017-03-27",
|
|
@@ -53540,7 +53546,7 @@ var features_javascript_default = {
|
|
|
53540
53546
|
"functions": {
|
|
53541
53547
|
"id": "functions",
|
|
53542
53548
|
"name": "Functions",
|
|
53543
|
-
"group": "javascript",
|
|
53549
|
+
"group": ["javascript"],
|
|
53544
53550
|
"status": {
|
|
53545
53551
|
"baseline": "high",
|
|
53546
53552
|
"baseline_low_date": "2015-07-29",
|
|
@@ -53559,7 +53565,7 @@ var features_javascript_default = {
|
|
|
53559
53565
|
"functions-caller-arguments": {
|
|
53560
53566
|
"id": "functions-caller-arguments",
|
|
53561
53567
|
"name": "Function caller and arguments",
|
|
53562
|
-
"group": "javascript",
|
|
53568
|
+
"group": ["javascript"],
|
|
53563
53569
|
"status": {
|
|
53564
53570
|
"baseline": false,
|
|
53565
53571
|
"support": {
|
|
@@ -53577,7 +53583,7 @@ var features_javascript_default = {
|
|
|
53577
53583
|
"generators": {
|
|
53578
53584
|
"id": "generators",
|
|
53579
53585
|
"name": "Generators",
|
|
53580
|
-
"group": "javascript",
|
|
53586
|
+
"group": ["javascript"],
|
|
53581
53587
|
"status": {
|
|
53582
53588
|
"baseline": "high",
|
|
53583
53589
|
"baseline_low_date": "2016-09-20",
|
|
@@ -53596,7 +53602,7 @@ var features_javascript_default = {
|
|
|
53596
53602
|
"globalthis": {
|
|
53597
53603
|
"id": "globalthis",
|
|
53598
53604
|
"name": "globalThis",
|
|
53599
|
-
"group": "javascript",
|
|
53605
|
+
"group": ["javascript"],
|
|
53600
53606
|
"status": {
|
|
53601
53607
|
"baseline": "high",
|
|
53602
53608
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53615,7 +53621,7 @@ var features_javascript_default = {
|
|
|
53615
53621
|
"hashbang-comments": {
|
|
53616
53622
|
"id": "hashbang-comments",
|
|
53617
53623
|
"name": "Hashbang comments",
|
|
53618
|
-
"group": "javascript",
|
|
53624
|
+
"group": ["javascript"],
|
|
53619
53625
|
"status": {
|
|
53620
53626
|
"baseline": "high",
|
|
53621
53627
|
"baseline_low_date": "2020-03-24",
|
|
@@ -53634,7 +53640,7 @@ var features_javascript_default = {
|
|
|
53634
53640
|
"html-wrapper-methods": {
|
|
53635
53641
|
"id": "html-wrapper-methods",
|
|
53636
53642
|
"name": "HTML wrapper methods",
|
|
53637
|
-
"group": "javascript",
|
|
53643
|
+
"group": ["javascript"],
|
|
53638
53644
|
"status": {
|
|
53639
53645
|
"baseline": false,
|
|
53640
53646
|
"support": {
|
|
@@ -53655,7 +53661,7 @@ var features_javascript_default = {
|
|
|
53655
53661
|
"javascript": {
|
|
53656
53662
|
"id": "javascript",
|
|
53657
53663
|
"name": "JavaScript (initial core language support)",
|
|
53658
|
-
"group": "javascript",
|
|
53664
|
+
"group": ["javascript"],
|
|
53659
53665
|
"status": {
|
|
53660
53666
|
"baseline": "high",
|
|
53661
53667
|
"baseline_low_date": "2015-07-29",
|
|
@@ -53674,7 +53680,7 @@ var features_javascript_default = {
|
|
|
53674
53680
|
"let-const": {
|
|
53675
53681
|
"id": "let-const",
|
|
53676
53682
|
"name": "Let and const",
|
|
53677
|
-
"group": "javascript",
|
|
53683
|
+
"group": ["javascript"],
|
|
53678
53684
|
"status": {
|
|
53679
53685
|
"baseline": "high",
|
|
53680
53686
|
"baseline_low_date": "2016-09-20",
|
|
@@ -53693,7 +53699,7 @@ var features_javascript_default = {
|
|
|
53693
53699
|
"logical-assignments": {
|
|
53694
53700
|
"id": "logical-assignments",
|
|
53695
53701
|
"name": "Logical assignments",
|
|
53696
|
-
"group": "javascript",
|
|
53702
|
+
"group": ["javascript"],
|
|
53697
53703
|
"status": {
|
|
53698
53704
|
"baseline": "high",
|
|
53699
53705
|
"baseline_low_date": "2020-09-16",
|
|
@@ -53712,7 +53718,7 @@ var features_javascript_default = {
|
|
|
53712
53718
|
"math-sum-precise": {
|
|
53713
53719
|
"id": "math-sum-precise",
|
|
53714
53720
|
"name": "Math.sumPrecise()",
|
|
53715
|
-
"group": "javascript",
|
|
53721
|
+
"group": ["javascript"],
|
|
53716
53722
|
"status": {
|
|
53717
53723
|
"baseline": false,
|
|
53718
53724
|
"support": {
|
|
@@ -53724,7 +53730,7 @@ var features_javascript_default = {
|
|
|
53724
53730
|
"nullish-coalescing": {
|
|
53725
53731
|
"id": "nullish-coalescing",
|
|
53726
53732
|
"name": "Nullish coalescing",
|
|
53727
|
-
"group": "javascript",
|
|
53733
|
+
"group": ["javascript"],
|
|
53728
53734
|
"status": {
|
|
53729
53735
|
"baseline": "high",
|
|
53730
53736
|
"baseline_low_date": "2020-09-16",
|
|
@@ -53740,10 +53746,10 @@ var features_javascript_default = {
|
|
|
53740
53746
|
}
|
|
53741
53747
|
}
|
|
53742
53748
|
},
|
|
53743
|
-
"numeric-
|
|
53744
|
-
"id": "numeric-
|
|
53749
|
+
"numeric-separators": {
|
|
53750
|
+
"id": "numeric-separators",
|
|
53745
53751
|
"name": "Numeric separators",
|
|
53746
|
-
"group": "javascript",
|
|
53752
|
+
"group": ["javascript"],
|
|
53747
53753
|
"status": {
|
|
53748
53754
|
"baseline": "high",
|
|
53749
53755
|
"baseline_low_date": "2020-07-28",
|
|
@@ -53762,7 +53768,7 @@ var features_javascript_default = {
|
|
|
53762
53768
|
"optional-catch-binding": {
|
|
53763
53769
|
"id": "optional-catch-binding",
|
|
53764
53770
|
"name": "Optional catch binding",
|
|
53765
|
-
"group": "javascript",
|
|
53771
|
+
"group": ["javascript"],
|
|
53766
53772
|
"status": {
|
|
53767
53773
|
"baseline": "high",
|
|
53768
53774
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53781,7 +53787,7 @@ var features_javascript_default = {
|
|
|
53781
53787
|
"proxy-reflect": {
|
|
53782
53788
|
"id": "proxy-reflect",
|
|
53783
53789
|
"name": "Proxy and Reflect",
|
|
53784
|
-
"group": "javascript",
|
|
53790
|
+
"group": ["javascript"],
|
|
53785
53791
|
"status": {
|
|
53786
53792
|
"baseline": "high",
|
|
53787
53793
|
"baseline_low_date": "2016-09-20",
|
|
@@ -53800,7 +53806,7 @@ var features_javascript_default = {
|
|
|
53800
53806
|
"shared-memory": {
|
|
53801
53807
|
"id": "shared-memory",
|
|
53802
53808
|
"name": "SharedArrayBuffer and Atomics",
|
|
53803
|
-
"group": "javascript",
|
|
53809
|
+
"group": ["javascript"],
|
|
53804
53810
|
"status": {
|
|
53805
53811
|
"baseline": "high",
|
|
53806
53812
|
"baseline_low_date": "2021-12-13",
|
|
@@ -53819,7 +53825,7 @@ var features_javascript_default = {
|
|
|
53819
53825
|
"spread": {
|
|
53820
53826
|
"id": "spread",
|
|
53821
53827
|
"name": "Spread syntax",
|
|
53822
|
-
"group": "javascript",
|
|
53828
|
+
"group": ["javascript"],
|
|
53823
53829
|
"status": {
|
|
53824
53830
|
"baseline": "high",
|
|
53825
53831
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53838,7 +53844,7 @@ var features_javascript_default = {
|
|
|
53838
53844
|
"template-literals": {
|
|
53839
53845
|
"id": "template-literals",
|
|
53840
53846
|
"name": "Template literals",
|
|
53841
|
-
"group": "javascript",
|
|
53847
|
+
"group": ["javascript"],
|
|
53842
53848
|
"status": {
|
|
53843
53849
|
"baseline": "high",
|
|
53844
53850
|
"baseline_low_date": "2020-01-15",
|
|
@@ -53857,7 +53863,7 @@ var features_javascript_default = {
|
|
|
53857
53863
|
"temporal": {
|
|
53858
53864
|
"id": "temporal",
|
|
53859
53865
|
"name": "Temporal",
|
|
53860
|
-
"group": "javascript",
|
|
53866
|
+
"group": ["javascript"],
|
|
53861
53867
|
"status": {
|
|
53862
53868
|
"baseline": false,
|
|
53863
53869
|
"support": {
|
|
@@ -53869,7 +53875,7 @@ var features_javascript_default = {
|
|
|
53869
53875
|
"top-level-await": {
|
|
53870
53876
|
"id": "top-level-await",
|
|
53871
53877
|
"name": "Top-level await",
|
|
53872
|
-
"group": "javascript",
|
|
53878
|
+
"group": ["javascript"],
|
|
53873
53879
|
"status": {
|
|
53874
53880
|
"baseline": "high",
|
|
53875
53881
|
"baseline_low_date": "2021-09-20",
|
|
@@ -53888,7 +53894,7 @@ var features_javascript_default = {
|
|
|
53888
53894
|
"unicode-point-escapes": {
|
|
53889
53895
|
"id": "unicode-point-escapes",
|
|
53890
53896
|
"name": "Unicode point escapes",
|
|
53891
|
-
"group": "javascript",
|
|
53897
|
+
"group": ["javascript"],
|
|
53892
53898
|
"status": {
|
|
53893
53899
|
"baseline": "high",
|
|
53894
53900
|
"baseline_low_date": "2015-09-30",
|
|
@@ -53907,7 +53913,7 @@ var features_javascript_default = {
|
|
|
53907
53913
|
"weak-references": {
|
|
53908
53914
|
"id": "weak-references",
|
|
53909
53915
|
"name": "Weak references",
|
|
53910
|
-
"group": "javascript",
|
|
53916
|
+
"group": ["javascript"],
|
|
53911
53917
|
"status": {
|
|
53912
53918
|
"baseline": "high",
|
|
53913
53919
|
"baseline_low_date": "2021-04-26",
|
|
@@ -53926,7 +53932,7 @@ var features_javascript_default = {
|
|
|
53926
53932
|
"with": {
|
|
53927
53933
|
"id": "with",
|
|
53928
53934
|
"name": "with",
|
|
53929
|
-
"group": "javascript",
|
|
53935
|
+
"group": ["javascript"],
|
|
53930
53936
|
"status": {
|
|
53931
53937
|
"baseline": false,
|
|
53932
53938
|
"support": {
|
|
@@ -56220,8 +56226,87 @@ const rule$1 = {
|
|
|
56220
56226
|
};
|
|
56221
56227
|
var no_temporal_default = rule$1;
|
|
56222
56228
|
|
|
56229
|
+
//#endregion
|
|
56230
|
+
//#region src/utils/rule-resolver.ts
|
|
56231
|
+
/**
|
|
56232
|
+
* Normalize ESM/CJS export shapes for ESLint plugins.
|
|
56233
|
+
* Some toolchains expose plugins as `{ rules }` or under `{ default: { rules } }`.
|
|
56234
|
+
* This helper selects whichever shape is present and returns the rules map.
|
|
56235
|
+
*/
|
|
56236
|
+
function resolvePluginRules(mod) {
|
|
56237
|
+
if (!mod || typeof mod !== "object" && typeof mod !== "function") return void 0;
|
|
56238
|
+
const m = mod;
|
|
56239
|
+
const rules$1 = m.rules ?? m.default?.rules;
|
|
56240
|
+
if (rules$1 && typeof rules$1 === "object") return rules$1;
|
|
56241
|
+
}
|
|
56242
|
+
/**
|
|
56243
|
+
* Resolve rules for eslint-plugin-es-x in a robust way.
|
|
56244
|
+
* Why: In CI (Node 22 / ESLint 9), ESM interop may attach rules under
|
|
56245
|
+
* `default.rules` instead of `rules`. Only checking `esx.rules` meant no
|
|
56246
|
+
* delegates were created and tests failed.
|
|
56247
|
+
* Approach: Prefer loading the CommonJS entry via `createRequire` to avoid
|
|
56248
|
+
* interop variance, then normalize the export with `resolvePluginRules()`.
|
|
56249
|
+
*/
|
|
56250
|
+
function resolveEsxRules() {
|
|
56251
|
+
try {
|
|
56252
|
+
const m = createRequire(import.meta.url)("eslint-plugin-es-x");
|
|
56253
|
+
const rules$1 = resolvePluginRules(m);
|
|
56254
|
+
if (rules$1) return rules$1;
|
|
56255
|
+
} catch {}
|
|
56256
|
+
}
|
|
56257
|
+
/**
|
|
56258
|
+
* Try resolving es-x rules from a provided module first (ESM import),
|
|
56259
|
+
* then fall back to the CommonJS `require` path if needed.
|
|
56260
|
+
*/
|
|
56261
|
+
function resolveEsxRulesFrom(mod) {
|
|
56262
|
+
const fromImport = mod ? resolvePluginRules(mod) : void 0;
|
|
56263
|
+
if (fromImport) return fromImport;
|
|
56264
|
+
return resolveEsxRules();
|
|
56265
|
+
}
|
|
56266
|
+
function getEsxRule(name) {
|
|
56267
|
+
if (!esxRulesResolved) {
|
|
56268
|
+
esxRulesCache = resolveEsxRules();
|
|
56269
|
+
esxRulesResolved = true;
|
|
56270
|
+
}
|
|
56271
|
+
return esxRulesCache?.[name];
|
|
56272
|
+
}
|
|
56273
|
+
let esxRulesCache;
|
|
56274
|
+
let esxRulesResolved = false;
|
|
56275
|
+
|
|
56276
|
+
//#endregion
|
|
56277
|
+
//#region src/utils/delegate-resolver.ts
|
|
56278
|
+
let selfRules = null;
|
|
56279
|
+
function registerSelfRules(rules$1) {
|
|
56280
|
+
selfRules = rules$1;
|
|
56281
|
+
}
|
|
56282
|
+
function resolveEsx(name) {
|
|
56283
|
+
return resolveEsxRulesFrom(esx)?.[name] || getEsxRule(name);
|
|
56284
|
+
}
|
|
56285
|
+
const registry = {
|
|
56286
|
+
"es-x": resolveEsx,
|
|
56287
|
+
self: (name) => selfRules ? selfRules[name] : void 0,
|
|
56288
|
+
core: (name) => builtinRules.get(name)
|
|
56289
|
+
};
|
|
56290
|
+
function resolveDelegateRule(plugin, name) {
|
|
56291
|
+
const resolver = registry[plugin];
|
|
56292
|
+
if (!resolver) return void 0;
|
|
56293
|
+
return resolver(name);
|
|
56294
|
+
}
|
|
56295
|
+
/**
|
|
56296
|
+
* Debug helper: list available resolver aliases. Used when BASELINE_DEBUG=1.
|
|
56297
|
+
*/
|
|
56298
|
+
function listResolverPlugins() {
|
|
56299
|
+
return Object.keys(registry).sort();
|
|
56300
|
+
}
|
|
56301
|
+
|
|
56223
56302
|
//#endregion
|
|
56224
56303
|
//#region src/orchestrator/use-baseline.ts
|
|
56304
|
+
registerSelfRules({
|
|
56305
|
+
"no-bigint64array": no_bigint64array_default,
|
|
56306
|
+
"no-function-caller-arguments": no_function_caller_arguments_default,
|
|
56307
|
+
"no-math-sum-precise": no_math_sum_precise_default,
|
|
56308
|
+
"no-temporal": no_temporal_default
|
|
56309
|
+
});
|
|
56225
56310
|
function mergeListeners(target, add) {
|
|
56226
56311
|
const tgt = target;
|
|
56227
56312
|
for (const [event, handler] of Object.entries(add)) {
|
|
@@ -56334,6 +56419,7 @@ const rule = {
|
|
|
56334
56419
|
}]
|
|
56335
56420
|
},
|
|
56336
56421
|
create(ctx) {
|
|
56422
|
+
const _DEBUG = process.env.BASELINE_DEBUG === "1";
|
|
56337
56423
|
const getFilename = ctx.getFilename;
|
|
56338
56424
|
let filename = null;
|
|
56339
56425
|
if (typeof getFilename === "function") try {
|
|
@@ -56379,6 +56465,9 @@ const rule = {
|
|
|
56379
56465
|
}
|
|
56380
56466
|
const listeners = {};
|
|
56381
56467
|
const mappedFeatureIds = new Set(entries.map((e) => e.featureId));
|
|
56468
|
+
if (_DEBUG) try {
|
|
56469
|
+
console.log(`[baseline-js] resolvers=${listResolverPlugins().join(",")} entries=${entries.length}`);
|
|
56470
|
+
} catch {}
|
|
56382
56471
|
for (const { featureId, delegateRule } of entries) {
|
|
56383
56472
|
let impl;
|
|
56384
56473
|
let delegateOptions = [];
|
|
@@ -56389,21 +56478,10 @@ const rule = {
|
|
|
56389
56478
|
if (d?.options) delegateOptions = Array.isArray(d.options) ? d.options : [d.options];
|
|
56390
56479
|
}
|
|
56391
56480
|
const { plugin, name } = parseDelegateRuleKey(delegateRule);
|
|
56392
|
-
|
|
56393
|
-
const coreName = name;
|
|
56394
|
-
impl = builtinRules.get(coreName);
|
|
56395
|
-
} else if (plugin === "self") {
|
|
56396
|
-
const selfName = name;
|
|
56397
|
-
impl = {
|
|
56398
|
-
"no-bigint64array": no_bigint64array_default,
|
|
56399
|
-
"no-function-caller-arguments": no_function_caller_arguments_default,
|
|
56400
|
-
"no-math-sum-precise": no_math_sum_precise_default,
|
|
56401
|
-
"no-temporal": no_temporal_default
|
|
56402
|
-
}[selfName];
|
|
56403
|
-
} else impl = esx.rules?.[name];
|
|
56481
|
+
impl = resolveDelegateRule(plugin, name);
|
|
56404
56482
|
if (!impl?.create) continue;
|
|
56405
56483
|
const delegateCtx = {};
|
|
56406
|
-
const
|
|
56484
|
+
for (const k of [
|
|
56407
56485
|
"getSourceCode",
|
|
56408
56486
|
"getCwd",
|
|
56409
56487
|
"getFilename",
|
|
@@ -56412,15 +56490,13 @@ const rule = {
|
|
|
56412
56490
|
"getDeclaredVariables",
|
|
56413
56491
|
"markVariableAsUsed",
|
|
56414
56492
|
"getScope"
|
|
56415
|
-
]
|
|
56416
|
-
for (const k of fwd) {
|
|
56493
|
+
]) {
|
|
56417
56494
|
const v = ctx[k];
|
|
56418
56495
|
if (typeof v === "function") delegateCtx[k] = v.bind(ctx);
|
|
56419
56496
|
}
|
|
56420
56497
|
for (const k of [
|
|
56421
56498
|
"settings",
|
|
56422
56499
|
"parserPath",
|
|
56423
|
-
"parserOptions",
|
|
56424
56500
|
"parserServices",
|
|
56425
56501
|
"languageOptions",
|
|
56426
56502
|
"sourceCode"
|
|
@@ -56428,6 +56504,10 @@ const rule = {
|
|
|
56428
56504
|
const src = ctx;
|
|
56429
56505
|
if (src[k] != null) delegateCtx[k] = src[k];
|
|
56430
56506
|
}
|
|
56507
|
+
delegateCtx.parserOptions = {
|
|
56508
|
+
...ctx.parserOptions ?? {},
|
|
56509
|
+
ecmaVersion: 3
|
|
56510
|
+
};
|
|
56431
56511
|
delegateCtx.options = delegateOptions;
|
|
56432
56512
|
delegateCtx.report = function report(arg) {
|
|
56433
56513
|
const node = typeof arg === "object" && arg !== null && "node" in arg ? arg.node : arg;
|
|
@@ -56471,7 +56551,7 @@ const rule = {
|
|
|
56471
56551
|
const messages = {};
|
|
56472
56552
|
for (const d of descriptors$2) messages[d.featureId] = baselineMessage(d.featureId, baseline);
|
|
56473
56553
|
const delegateCtx = {};
|
|
56474
|
-
const
|
|
56554
|
+
for (const k of [
|
|
56475
56555
|
"getSourceCode",
|
|
56476
56556
|
"getCwd",
|
|
56477
56557
|
"getFilename",
|
|
@@ -56480,8 +56560,7 @@ const rule = {
|
|
|
56480
56560
|
"getDeclaredVariables",
|
|
56481
56561
|
"markVariableAsUsed",
|
|
56482
56562
|
"getScope"
|
|
56483
|
-
]
|
|
56484
|
-
for (const k of fwd) {
|
|
56563
|
+
]) {
|
|
56485
56564
|
const v = ctx[k];
|
|
56486
56565
|
if (typeof v === "function") delegateCtx[k] = v.bind(ctx);
|
|
56487
56566
|
}
|
|
@@ -56511,7 +56590,8 @@ const rule = {
|
|
|
56511
56590
|
const t = node?.type;
|
|
56512
56591
|
if (t && matchIgnoreNodeType(t)) return;
|
|
56513
56592
|
}
|
|
56514
|
-
|
|
56593
|
+
let msg;
|
|
56594
|
+
if (isObj && typeof arg.message === "string") msg = arg.message;
|
|
56515
56595
|
ctx.report({
|
|
56516
56596
|
node,
|
|
56517
56597
|
message: msg
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-baseline-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Enforce JavaScript Baseline (widely/newly/year) browser compatibility with a single ESLint rule. Prevent runtime errors by catching unsupported JavaScript features during development.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,26 +22,27 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsdown",
|
|
25
|
-
"check:mapping": "node scripts/check-mapping.mjs --out drift-report.json",
|
|
25
|
+
"check:mapping": "node scripts/qa/check-mapping.mjs --out drift-report.json",
|
|
26
26
|
"dev": "tsdown --watch",
|
|
27
27
|
"format": "biome format --write .",
|
|
28
28
|
"format:check": "biome check --formatter-enabled=true --linter-enabled=false .",
|
|
29
29
|
"format:imports": "biome check --fix --unsafe .",
|
|
30
|
-
"gen:coverage": "node scripts/generate-coverage.mjs",
|
|
31
|
-
"gen:features": "node scripts/build-features.mjs",
|
|
32
|
-
"gen:features:api": "node scripts/build-features-api.mjs",
|
|
33
|
-
"gen:features:jsbi": "node scripts/build-features-jsbi.mjs",
|
|
34
|
-
"gen:descriptors": "node scripts/build-descriptors.mjs",
|
|
30
|
+
"gen:coverage": "node scripts/coverage/generate-coverage.mjs",
|
|
31
|
+
"gen:features": "node scripts/data/build-features.mjs",
|
|
32
|
+
"gen:features:api": "node scripts/data/build-features-api.mjs",
|
|
33
|
+
"gen:features:jsbi": "node scripts/data/build-features-jsbi.mjs",
|
|
34
|
+
"gen:descriptors": "node scripts/data/build-descriptors.mjs",
|
|
35
35
|
"pretest": "pnpm -s build",
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"test:watch": "pnpm -s build && vitest",
|
|
38
38
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
-
"verify:features": "node scripts/verify-features.mjs"
|
|
39
|
+
"verify:features": "node scripts/data/verify-features.mjs"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"eslint-plugin-es-x": "^9.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"eslint": "^9.12.0",
|
|
45
46
|
"@biomejs/biome": "^2.2.4",
|
|
46
47
|
"@semantic-release/changelog": "^6.0.3",
|
|
47
48
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -52,14 +53,14 @@
|
|
|
52
53
|
"tsdown": "v0.15.1",
|
|
53
54
|
"typescript": "^5.4.0",
|
|
54
55
|
"vitest": "^3.2.4",
|
|
55
|
-
"web-features": "
|
|
56
|
+
"web-features": "3.0.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"eslint": ">=8.57.0 <10"
|
|
59
60
|
},
|
|
60
61
|
"packageManager": "pnpm@10.15.1",
|
|
61
62
|
"engines": {
|
|
62
|
-
"node": ">=20.19.0"
|
|
63
|
+
"node": ">=20.19.0 <22 || >=22.12.0"
|
|
63
64
|
},
|
|
64
65
|
"author": {
|
|
65
66
|
"name": "Ryuya",
|