eslint-plugin-baseline-js 0.1.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/dist/index.mjs CHANGED
@@ -1,12 +1,8 @@
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
 
4
5
  //#region src/configs/baseline.ts
5
- function baselineConfigs(opts = {}) {
6
- const available = opts.available ?? opts.baseline ?? "widely";
7
- const level = opts.level ?? "error";
8
- return [{ rules: { "baseline-js/use-baseline": [level, { available }] } }];
9
- }
10
6
  /**
11
7
  * Recommended config: enable Baseline with Web APIs and JS builtins detection on auto preset.
12
8
  * - baseline: defaults to 'widely'
@@ -15,11 +11,14 @@ function baselineConfigs(opts = {}) {
15
11
  function recommendedConfig(opts = {}) {
16
12
  const available = opts.available ?? opts.baseline ?? "widely";
17
13
  const level = opts.level ?? "error";
18
- return [{ rules: { "baseline-js/use-baseline": [level, {
19
- available,
20
- includeWebApis: { preset: "auto" },
21
- includeJsBuiltins: { preset: "auto" }
22
- }] } }];
14
+ return {
15
+ files: ["**/*.{js,cjs,mjs,jsx}"],
16
+ rules: { "baseline-js/use-baseline": [level, {
17
+ available,
18
+ includeWebApis: { preset: "auto" },
19
+ includeJsBuiltins: { preset: "auto" }
20
+ }] }
21
+ };
23
22
  }
24
23
  /**
25
24
  * Recommended config for TypeScript-aware projects:
@@ -29,11 +28,14 @@ function recommendedConfig(opts = {}) {
29
28
  function recommendedTsConfig(opts = {}) {
30
29
  const available = opts.available ?? opts.baseline ?? "widely";
31
30
  const level = opts.level ?? "error";
32
- return [{ rules: { "baseline-js/use-baseline": [level, {
33
- available,
34
- includeWebApis: { preset: "type-aware" },
35
- includeJsBuiltins: { preset: "type-aware" }
36
- }] } }];
31
+ return {
32
+ files: ["**/*.{ts,tsx}"],
33
+ rules: { "baseline-js/use-baseline": [level, {
34
+ available,
35
+ includeWebApis: { preset: "type-aware" },
36
+ includeJsBuiltins: { preset: "type-aware" }
37
+ }] }
38
+ };
37
39
  }
38
40
 
39
41
  //#endregion
@@ -45233,9 +45235,6 @@ function getIncludedDescriptors(opts) {
45233
45235
 
45234
45236
  //#endregion
45235
45237
  //#region src/baseline/mapping/syntax.ts
45236
- /**
45237
- * @fileoverview Mapping of web-features JavaScript feature IDs to delegate ESLint rules.
45238
- */
45239
45238
  var syntax_default = {
45240
45239
  "nullish-coalescing": {
45241
45240
  kind: "syntax",
@@ -45269,7 +45268,7 @@ var syntax_default = {
45269
45268
  level: "error"
45270
45269
  }]
45271
45270
  },
45272
- "numeric-seperators": {
45271
+ "numeric-separators": {
45273
45272
  kind: "syntax",
45274
45273
  delegates: [{
45275
45274
  plugin: "es-x",
@@ -45465,6 +45464,14 @@ var syntax_default = {
45465
45464
  level: "error"
45466
45465
  }]
45467
45466
  },
45467
+ iterators: {
45468
+ kind: "syntax",
45469
+ delegates: [{
45470
+ plugin: "es-x",
45471
+ rule: "no-for-of-loops",
45472
+ level: "error"
45473
+ }]
45474
+ },
45468
45475
  bigint64array: {
45469
45476
  kind: "syntax",
45470
45477
  delegates: [{
@@ -53337,7 +53344,7 @@ var features_javascript_default = {
53337
53344
  "arguments-callee": {
53338
53345
  "id": "arguments-callee",
53339
53346
  "name": "arguments.callee",
53340
- "group": "javascript",
53347
+ "group": ["javascript"],
53341
53348
  "status": {
53342
53349
  "baseline": false,
53343
53350
  "support": {
@@ -53355,7 +53362,7 @@ var features_javascript_default = {
53355
53362
  "async-await": {
53356
53363
  "id": "async-await",
53357
53364
  "name": "Async functions",
53358
- "group": "javascript",
53365
+ "group": ["javascript"],
53359
53366
  "status": {
53360
53367
  "baseline": "high",
53361
53368
  "baseline_low_date": "2017-04-05",
@@ -53374,7 +53381,7 @@ var features_javascript_default = {
53374
53381
  "async-generators": {
53375
53382
  "id": "async-generators",
53376
53383
  "name": "Async generators",
53377
- "group": "javascript",
53384
+ "group": ["javascript"],
53378
53385
  "status": {
53379
53386
  "baseline": "high",
53380
53387
  "baseline_low_date": "2020-01-15",
@@ -53393,7 +53400,7 @@ var features_javascript_default = {
53393
53400
  "atomics-wait-async": {
53394
53401
  "id": "atomics-wait-async",
53395
53402
  "name": "Atomics.waitAsync",
53396
- "group": "javascript",
53403
+ "group": ["javascript"],
53397
53404
  "status": {
53398
53405
  "baseline": false,
53399
53406
  "support": {
@@ -53408,7 +53415,7 @@ var features_javascript_default = {
53408
53415
  "bigint": {
53409
53416
  "id": "bigint",
53410
53417
  "name": "BigInt",
53411
- "group": "javascript",
53418
+ "group": ["javascript"],
53412
53419
  "status": {
53413
53420
  "baseline": "high",
53414
53421
  "baseline_low_date": "2020-09-16",
@@ -53427,7 +53434,7 @@ var features_javascript_default = {
53427
53434
  "bigint64array": {
53428
53435
  "id": "bigint64array",
53429
53436
  "name": "BigInt64Array",
53430
- "group": "javascript",
53437
+ "group": ["javascript"],
53431
53438
  "status": {
53432
53439
  "baseline": "high",
53433
53440
  "baseline_low_date": "2021-09-20",
@@ -53446,7 +53453,7 @@ var features_javascript_default = {
53446
53453
  "class-syntax": {
53447
53454
  "id": "class-syntax",
53448
53455
  "name": "Classes",
53449
- "group": "javascript",
53456
+ "group": ["javascript"],
53450
53457
  "status": {
53451
53458
  "baseline": "high",
53452
53459
  "baseline_low_date": "2016-03-08",
@@ -53465,7 +53472,7 @@ var features_javascript_default = {
53465
53472
  "date-get-year-set-year": {
53466
53473
  "id": "date-get-year-set-year",
53467
53474
  "name": "getYear() and setYear()",
53468
- "group": "javascript",
53475
+ "group": ["javascript"],
53469
53476
  "status": {
53470
53477
  "baseline": false,
53471
53478
  "support": {
@@ -53483,7 +53490,7 @@ var features_javascript_default = {
53483
53490
  "destructuring": {
53484
53491
  "id": "destructuring",
53485
53492
  "name": "Destructuring",
53486
- "group": "javascript",
53493
+ "group": ["javascript"],
53487
53494
  "status": {
53488
53495
  "baseline": "high",
53489
53496
  "baseline_low_date": "2020-01-15",
@@ -53502,7 +53509,7 @@ var features_javascript_default = {
53502
53509
  "escape-unescape": {
53503
53510
  "id": "escape-unescape",
53504
53511
  "name": "escape() and unescape()",
53505
- "group": "javascript",
53512
+ "group": ["javascript"],
53506
53513
  "status": {
53507
53514
  "baseline": false,
53508
53515
  "support": {
@@ -53520,7 +53527,7 @@ var features_javascript_default = {
53520
53527
  "exponentiation": {
53521
53528
  "id": "exponentiation",
53522
53529
  "name": "Exponentiation operator",
53523
- "group": "javascript",
53530
+ "group": ["javascript"],
53524
53531
  "status": {
53525
53532
  "baseline": "high",
53526
53533
  "baseline_low_date": "2017-03-27",
@@ -53539,7 +53546,7 @@ var features_javascript_default = {
53539
53546
  "functions": {
53540
53547
  "id": "functions",
53541
53548
  "name": "Functions",
53542
- "group": "javascript",
53549
+ "group": ["javascript"],
53543
53550
  "status": {
53544
53551
  "baseline": "high",
53545
53552
  "baseline_low_date": "2015-07-29",
@@ -53558,7 +53565,7 @@ var features_javascript_default = {
53558
53565
  "functions-caller-arguments": {
53559
53566
  "id": "functions-caller-arguments",
53560
53567
  "name": "Function caller and arguments",
53561
- "group": "javascript",
53568
+ "group": ["javascript"],
53562
53569
  "status": {
53563
53570
  "baseline": false,
53564
53571
  "support": {
@@ -53576,7 +53583,7 @@ var features_javascript_default = {
53576
53583
  "generators": {
53577
53584
  "id": "generators",
53578
53585
  "name": "Generators",
53579
- "group": "javascript",
53586
+ "group": ["javascript"],
53580
53587
  "status": {
53581
53588
  "baseline": "high",
53582
53589
  "baseline_low_date": "2016-09-20",
@@ -53595,7 +53602,7 @@ var features_javascript_default = {
53595
53602
  "globalthis": {
53596
53603
  "id": "globalthis",
53597
53604
  "name": "globalThis",
53598
- "group": "javascript",
53605
+ "group": ["javascript"],
53599
53606
  "status": {
53600
53607
  "baseline": "high",
53601
53608
  "baseline_low_date": "2020-01-15",
@@ -53614,7 +53621,7 @@ var features_javascript_default = {
53614
53621
  "hashbang-comments": {
53615
53622
  "id": "hashbang-comments",
53616
53623
  "name": "Hashbang comments",
53617
- "group": "javascript",
53624
+ "group": ["javascript"],
53618
53625
  "status": {
53619
53626
  "baseline": "high",
53620
53627
  "baseline_low_date": "2020-03-24",
@@ -53633,7 +53640,7 @@ var features_javascript_default = {
53633
53640
  "html-wrapper-methods": {
53634
53641
  "id": "html-wrapper-methods",
53635
53642
  "name": "HTML wrapper methods",
53636
- "group": "javascript",
53643
+ "group": ["javascript"],
53637
53644
  "status": {
53638
53645
  "baseline": false,
53639
53646
  "support": {
@@ -53654,7 +53661,7 @@ var features_javascript_default = {
53654
53661
  "javascript": {
53655
53662
  "id": "javascript",
53656
53663
  "name": "JavaScript (initial core language support)",
53657
- "group": "javascript",
53664
+ "group": ["javascript"],
53658
53665
  "status": {
53659
53666
  "baseline": "high",
53660
53667
  "baseline_low_date": "2015-07-29",
@@ -53673,7 +53680,7 @@ var features_javascript_default = {
53673
53680
  "let-const": {
53674
53681
  "id": "let-const",
53675
53682
  "name": "Let and const",
53676
- "group": "javascript",
53683
+ "group": ["javascript"],
53677
53684
  "status": {
53678
53685
  "baseline": "high",
53679
53686
  "baseline_low_date": "2016-09-20",
@@ -53692,7 +53699,7 @@ var features_javascript_default = {
53692
53699
  "logical-assignments": {
53693
53700
  "id": "logical-assignments",
53694
53701
  "name": "Logical assignments",
53695
- "group": "javascript",
53702
+ "group": ["javascript"],
53696
53703
  "status": {
53697
53704
  "baseline": "high",
53698
53705
  "baseline_low_date": "2020-09-16",
@@ -53711,7 +53718,7 @@ var features_javascript_default = {
53711
53718
  "math-sum-precise": {
53712
53719
  "id": "math-sum-precise",
53713
53720
  "name": "Math.sumPrecise()",
53714
- "group": "javascript",
53721
+ "group": ["javascript"],
53715
53722
  "status": {
53716
53723
  "baseline": false,
53717
53724
  "support": {
@@ -53723,7 +53730,7 @@ var features_javascript_default = {
53723
53730
  "nullish-coalescing": {
53724
53731
  "id": "nullish-coalescing",
53725
53732
  "name": "Nullish coalescing",
53726
- "group": "javascript",
53733
+ "group": ["javascript"],
53727
53734
  "status": {
53728
53735
  "baseline": "high",
53729
53736
  "baseline_low_date": "2020-09-16",
@@ -53739,10 +53746,10 @@ var features_javascript_default = {
53739
53746
  }
53740
53747
  }
53741
53748
  },
53742
- "numeric-seperators": {
53743
- "id": "numeric-seperators",
53749
+ "numeric-separators": {
53750
+ "id": "numeric-separators",
53744
53751
  "name": "Numeric separators",
53745
- "group": "javascript",
53752
+ "group": ["javascript"],
53746
53753
  "status": {
53747
53754
  "baseline": "high",
53748
53755
  "baseline_low_date": "2020-07-28",
@@ -53761,7 +53768,7 @@ var features_javascript_default = {
53761
53768
  "optional-catch-binding": {
53762
53769
  "id": "optional-catch-binding",
53763
53770
  "name": "Optional catch binding",
53764
- "group": "javascript",
53771
+ "group": ["javascript"],
53765
53772
  "status": {
53766
53773
  "baseline": "high",
53767
53774
  "baseline_low_date": "2020-01-15",
@@ -53780,7 +53787,7 @@ var features_javascript_default = {
53780
53787
  "proxy-reflect": {
53781
53788
  "id": "proxy-reflect",
53782
53789
  "name": "Proxy and Reflect",
53783
- "group": "javascript",
53790
+ "group": ["javascript"],
53784
53791
  "status": {
53785
53792
  "baseline": "high",
53786
53793
  "baseline_low_date": "2016-09-20",
@@ -53799,7 +53806,7 @@ var features_javascript_default = {
53799
53806
  "shared-memory": {
53800
53807
  "id": "shared-memory",
53801
53808
  "name": "SharedArrayBuffer and Atomics",
53802
- "group": "javascript",
53809
+ "group": ["javascript"],
53803
53810
  "status": {
53804
53811
  "baseline": "high",
53805
53812
  "baseline_low_date": "2021-12-13",
@@ -53818,7 +53825,7 @@ var features_javascript_default = {
53818
53825
  "spread": {
53819
53826
  "id": "spread",
53820
53827
  "name": "Spread syntax",
53821
- "group": "javascript",
53828
+ "group": ["javascript"],
53822
53829
  "status": {
53823
53830
  "baseline": "high",
53824
53831
  "baseline_low_date": "2020-01-15",
@@ -53837,7 +53844,7 @@ var features_javascript_default = {
53837
53844
  "template-literals": {
53838
53845
  "id": "template-literals",
53839
53846
  "name": "Template literals",
53840
- "group": "javascript",
53847
+ "group": ["javascript"],
53841
53848
  "status": {
53842
53849
  "baseline": "high",
53843
53850
  "baseline_low_date": "2020-01-15",
@@ -53856,7 +53863,7 @@ var features_javascript_default = {
53856
53863
  "temporal": {
53857
53864
  "id": "temporal",
53858
53865
  "name": "Temporal",
53859
- "group": "javascript",
53866
+ "group": ["javascript"],
53860
53867
  "status": {
53861
53868
  "baseline": false,
53862
53869
  "support": {
@@ -53868,7 +53875,7 @@ var features_javascript_default = {
53868
53875
  "top-level-await": {
53869
53876
  "id": "top-level-await",
53870
53877
  "name": "Top-level await",
53871
- "group": "javascript",
53878
+ "group": ["javascript"],
53872
53879
  "status": {
53873
53880
  "baseline": "high",
53874
53881
  "baseline_low_date": "2021-09-20",
@@ -53887,7 +53894,7 @@ var features_javascript_default = {
53887
53894
  "unicode-point-escapes": {
53888
53895
  "id": "unicode-point-escapes",
53889
53896
  "name": "Unicode point escapes",
53890
- "group": "javascript",
53897
+ "group": ["javascript"],
53891
53898
  "status": {
53892
53899
  "baseline": "high",
53893
53900
  "baseline_low_date": "2015-09-30",
@@ -53906,7 +53913,7 @@ var features_javascript_default = {
53906
53913
  "weak-references": {
53907
53914
  "id": "weak-references",
53908
53915
  "name": "Weak references",
53909
- "group": "javascript",
53916
+ "group": ["javascript"],
53910
53917
  "status": {
53911
53918
  "baseline": "high",
53912
53919
  "baseline_low_date": "2021-04-26",
@@ -53925,7 +53932,7 @@ var features_javascript_default = {
53925
53932
  "with": {
53926
53933
  "id": "with",
53927
53934
  "name": "with",
53928
- "group": "javascript",
53935
+ "group": ["javascript"],
53929
53936
  "status": {
53930
53937
  "baseline": false,
53931
53938
  "support": {
@@ -55787,6 +55794,7 @@ function isBeyondBaseline(featureId, baseline) {
55787
55794
  if (baseline === "widely") return bucket !== "widely";
55788
55795
  if (baseline === "newly") return bucket === "limited";
55789
55796
  if (typeof baseline === "number") {
55797
+ if (bucket === "limited") return true;
55790
55798
  const y = yearFrom(rec.status?.baseline_low_date) ?? yearFrom(rec.status?.baseline_high_date);
55791
55799
  if (y == null) return false;
55792
55800
  return y > baseline;
@@ -56175,6 +56183,8 @@ const rule$2 = {
56175
56183
  },
56176
56184
  MemberExpression(node) {
56177
56185
  const m = node;
56186
+ const parent = m.parent;
56187
+ if (parent?.type === "CallExpression" && parent.callee === node) return;
56178
56188
  if (m.computed === false && m.object?.type === "Identifier" && m.object?.name === "Math" && m.property?.type === "Identifier" && m.property?.name === "sumPrecise") report(m.property);
56179
56189
  }
56180
56190
  };
@@ -56216,8 +56226,87 @@ const rule$1 = {
56216
56226
  };
56217
56227
  var no_temporal_default = rule$1;
56218
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
+
56219
56302
  //#endregion
56220
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
+ });
56221
56310
  function mergeListeners(target, add) {
56222
56311
  const tgt = target;
56223
56312
  for (const [event, handler] of Object.entries(add)) {
@@ -56233,11 +56322,14 @@ function mergeListeners(target, add) {
56233
56322
  }
56234
56323
  }
56235
56324
  function baselineMessage(featureId, baseline) {
56236
- if (baseline === "widely") return `Feature '${featureId}' is not a widely available Baseline feature.`;
56237
- if (baseline === "newly") return `Feature '${featureId}' is not a newly available Baseline feature.`;
56238
56325
  const rec = getFeatureRecord(featureId);
56326
+ const label = rec?.name || featureId;
56327
+ const idSuffix = rec?.name ? ` (${featureId})` : "";
56328
+ if (baseline === "widely") return `Feature '${label}'${idSuffix} is not a widely available Baseline feature.`;
56329
+ if (baseline === "newly") return `Feature '${label}'${idSuffix} is not a newly available Baseline feature.`;
56330
+ if (rec?.status?.baseline === false) return `Feature '${label}'${idSuffix} has Limited availability and exceeds ${baseline}.`;
56239
56331
  const year = rec?.status?.baseline_low_date?.slice(0, 4) || rec?.status?.baseline_high_date?.slice(0, 4) || "unknown";
56240
- return `Feature '${featureId}' became Baseline in ${year} and exceeds ${baseline}.`;
56332
+ return `Feature '${label}'${idSuffix} became Baseline in ${year} and exceeds ${baseline}.`;
56241
56333
  }
56242
56334
  const rule = {
56243
56335
  meta: {
@@ -56327,6 +56419,15 @@ const rule = {
56327
56419
  }]
56328
56420
  },
56329
56421
  create(ctx) {
56422
+ const _DEBUG = process.env.BASELINE_DEBUG === "1";
56423
+ const getFilename = ctx.getFilename;
56424
+ let filename = null;
56425
+ if (typeof getFilename === "function") try {
56426
+ filename = getFilename();
56427
+ } catch {}
56428
+ if (filename) {
56429
+ if (!/\.(?:[mc]?[jt]s|[jt]sx)$/i.test(filename)) return {};
56430
+ }
56330
56431
  const opt = ctx.options[0] ?? {};
56331
56432
  const baseline = getBaselineValue(opt);
56332
56433
  const ignoreFeaturePatterns = opt.ignoreFeatures ?? [];
@@ -56364,6 +56465,9 @@ const rule = {
56364
56465
  }
56365
56466
  const listeners = {};
56366
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 {}
56367
56471
  for (const { featureId, delegateRule } of entries) {
56368
56472
  let impl;
56369
56473
  let delegateOptions = [];
@@ -56374,21 +56478,10 @@ const rule = {
56374
56478
  if (d?.options) delegateOptions = Array.isArray(d.options) ? d.options : [d.options];
56375
56479
  }
56376
56480
  const { plugin, name } = parseDelegateRuleKey(delegateRule);
56377
- if (plugin === "core") {
56378
- const coreName = name;
56379
- impl = builtinRules.get(coreName);
56380
- } else if (plugin === "self") {
56381
- const selfName = name;
56382
- impl = {
56383
- "no-bigint64array": no_bigint64array_default,
56384
- "no-function-caller-arguments": no_function_caller_arguments_default,
56385
- "no-math-sum-precise": no_math_sum_precise_default,
56386
- "no-temporal": no_temporal_default
56387
- }[selfName];
56388
- } else impl = esx.rules?.[name];
56481
+ impl = resolveDelegateRule(plugin, name);
56389
56482
  if (!impl?.create) continue;
56390
56483
  const delegateCtx = {};
56391
- const fwd = [
56484
+ for (const k of [
56392
56485
  "getSourceCode",
56393
56486
  "getCwd",
56394
56487
  "getFilename",
@@ -56397,15 +56490,13 @@ const rule = {
56397
56490
  "getDeclaredVariables",
56398
56491
  "markVariableAsUsed",
56399
56492
  "getScope"
56400
- ];
56401
- for (const k of fwd) {
56493
+ ]) {
56402
56494
  const v = ctx[k];
56403
56495
  if (typeof v === "function") delegateCtx[k] = v.bind(ctx);
56404
56496
  }
56405
56497
  for (const k of [
56406
56498
  "settings",
56407
56499
  "parserPath",
56408
- "parserOptions",
56409
56500
  "parserServices",
56410
56501
  "languageOptions",
56411
56502
  "sourceCode"
@@ -56413,6 +56504,10 @@ const rule = {
56413
56504
  const src = ctx;
56414
56505
  if (src[k] != null) delegateCtx[k] = src[k];
56415
56506
  }
56507
+ delegateCtx.parserOptions = {
56508
+ ...ctx.parserOptions ?? {},
56509
+ ecmaVersion: 3
56510
+ };
56416
56511
  delegateCtx.options = delegateOptions;
56417
56512
  delegateCtx.report = function report(arg) {
56418
56513
  const node = typeof arg === "object" && arg !== null && "node" in arg ? arg.node : arg;
@@ -56456,7 +56551,7 @@ const rule = {
56456
56551
  const messages = {};
56457
56552
  for (const d of descriptors$2) messages[d.featureId] = baselineMessage(d.featureId, baseline);
56458
56553
  const delegateCtx = {};
56459
- const fwd = [
56554
+ for (const k of [
56460
56555
  "getSourceCode",
56461
56556
  "getCwd",
56462
56557
  "getFilename",
@@ -56465,8 +56560,7 @@ const rule = {
56465
56560
  "getDeclaredVariables",
56466
56561
  "markVariableAsUsed",
56467
56562
  "getScope"
56468
- ];
56469
- for (const k of fwd) {
56563
+ ]) {
56470
56564
  const v = ctx[k];
56471
56565
  if (typeof v === "function") delegateCtx[k] = v.bind(ctx);
56472
56566
  }
@@ -56496,7 +56590,8 @@ const rule = {
56496
56590
  const t = node?.type;
56497
56591
  if (t && matchIgnoreNodeType(t)) return;
56498
56592
  }
56499
- const msg = isObj && arg.message || void 0;
56593
+ let msg;
56594
+ if (isObj && typeof arg.message === "string") msg = arg.message;
56500
56595
  ctx.report({
56501
56596
  node,
56502
56597
  message: msg
@@ -56522,7 +56617,6 @@ const rules = {
56522
56617
  var src_default = {
56523
56618
  rules,
56524
56619
  configs: {
56525
- baseline: baselineConfigs,
56526
56620
  recommended: recommendedConfig,
56527
56621
  "recommended-ts": recommendedTsConfig
56528
56622
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-baseline-js",
3
- "version": "0.1.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,44 +22,45 @@
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
- "@biomejs/biome": "^2.2.3",
45
+ "eslint": "^9.12.0",
46
+ "@biomejs/biome": "^2.2.4",
46
47
  "@semantic-release/changelog": "^6.0.3",
47
48
  "@semantic-release/git": "^10.0.1",
48
49
  "@types/eslint": "^9.6.1",
49
- "@types/node": "^24.3.1",
50
+ "@types/node": "^24.4.0",
50
51
  "@typescript-eslint/parser": "^8.43.0",
51
52
  "semantic-release": "^24.2.7",
52
- "tsdown": "v0.14.2",
53
+ "tsdown": "v0.15.1",
53
54
  "typescript": "^5.4.0",
54
55
  "vitest": "^3.2.4",
55
- "web-features": "^2.47.0"
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",
@@ -75,7 +76,7 @@
75
76
  "typescript",
76
77
  "linting"
77
78
  ],
78
- "homepage": "https://github.com/3ru/eslint-plugin-baseline-js#readme",
79
+ "homepage": "https://baselinejs.vercel.app/",
79
80
  "bugs": {
80
81
  "url": "https://github.com/3ru/eslint-plugin-baseline-js/issues"
81
82
  },