@hublo/sentinel 1.1.3 → 1.1.4

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.
@@ -16,7 +16,7 @@ import {
16
16
  registerAdapters,
17
17
  resolve,
18
18
  resolveBin
19
- } from "../chunk-TLNA2U3B.js";
19
+ } from "../chunk-HNE774F7.js";
20
20
 
21
21
  // bin/sentinel.ts
22
22
  import { program } from "commander";
@@ -3910,20 +3910,52 @@ var OxlintAdapter = class extends BaseAdapter {
3910
3910
  };
3911
3911
  }
3912
3912
  /** How many rules the extended preset enforces, read from the preset on disk. */
3913
+ /**
3914
+ * How many rules this module actually enforces.
3915
+ *
3916
+ * Counted from the PRESET it extends, not from its own file: the stub is one line by
3917
+ * design, so counting there would always answer zero and read as "this module lints
3918
+ * nothing".
3919
+ *
3920
+ * Two things this got wrong, both worth stating because both produced the same dangerous
3921
+ * output — a module reporting `rules=0` while `conformant=true`, which the migration page
3922
+ * counts as adopted and checking an empty set:
3923
+ *
3924
+ * - it used `JSON.parse`. The chain is JSONC: the per-module baseline carries a comment
3925
+ * per held rule explaining why. One comment anywhere in the chain threw, the catch
3926
+ * returned 0, and host-admin reported 188 rules as 0 the moment it gained a baseline.
3927
+ * - one unreadable entry zeroed the WHOLE count. An entry that cannot be read is a gap in
3928
+ * the count, not proof the module enforces nothing, and the difference matters most
3929
+ * exactly when something is broken.
3930
+ *
3931
+ * Counted as a SET of rule names, so the baseline re-stating a preset rule at `warn` is
3932
+ * the same rule, not a second one.
3933
+ */
3913
3934
  presetRuleCount(cwd) {
3914
3935
  const target = this.unresolvedPreset(cwd);
3915
3936
  if (target) return 0;
3916
- let total = 0;
3937
+ let stub;
3917
3938
  try {
3918
- const stub = JSON.parse(readFileSync14(join18(cwd, LINT_CONFIG_FILE), "utf8"));
3919
- for (const entry of stub.extends ?? []) {
3920
- const preset = JSON.parse(readFileSync14(join18(cwd, entry), "utf8"));
3921
- total += Object.keys(preset.rules ?? {}).length;
3922
- }
3939
+ stub = parseJsonc(
3940
+ readFileSync14(join18(cwd, LINT_CONFIG_FILE), "utf8"),
3941
+ LINT_CONFIG_FILE
3942
+ );
3923
3943
  } catch {
3924
3944
  return 0;
3925
3945
  }
3926
- return total;
3946
+ const names = /* @__PURE__ */ new Set();
3947
+ for (const entry of stub.extends ?? []) {
3948
+ try {
3949
+ const preset = parseJsonc(
3950
+ readFileSync14(join18(cwd, entry), "utf8"),
3951
+ entry
3952
+ );
3953
+ for (const rule of Object.keys(preset.rules ?? {})) names.add(rule);
3954
+ } catch {
3955
+ continue;
3956
+ }
3957
+ }
3958
+ return names.size;
3927
3959
  }
3928
3960
  /** Lint health for `--report`. Deepened in a later step; today it is the run outcome. */
3929
3961
  async report(ctx) {
@@ -3984,7 +4016,10 @@ var OxlintAdapter = class extends BaseAdapter {
3984
4016
  unresolvedPreset(cwd) {
3985
4017
  let parsed;
3986
4018
  try {
3987
- parsed = JSON.parse(readFileSync14(join18(cwd, LINT_CONFIG_FILE), "utf8"));
4019
+ parsed = parseJsonc(
4020
+ readFileSync14(join18(cwd, LINT_CONFIG_FILE), "utf8"),
4021
+ LINT_CONFIG_FILE
4022
+ );
3988
4023
  } catch {
3989
4024
  return void 0;
3990
4025
  }
@@ -5095,4 +5130,4 @@ export {
5095
5130
  detectFramework,
5096
5131
  dispatch
5097
5132
  };
5098
- //# sourceMappingURL=chunk-TLNA2U3B.js.map
5133
+ //# sourceMappingURL=chunk-HNE774F7.js.map
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  registerAdapters,
8
8
  resolve,
9
9
  setDefaultRunner
10
- } from "./chunk-TLNA2U3B.js";
10
+ } from "./chunk-HNE774F7.js";
11
11
  export {
12
12
  BaseAdapter,
13
13
  all,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",