@hublo/sentinel 1.4.0-alpha.38 → 1.4.0-alpha.39

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.
@@ -15,10 +15,10 @@ import {
15
15
  palette,
16
16
  registerAdapters,
17
17
  resolve
18
- } from "../chunk-NFFT5AW4.js";
18
+ } from "../chunk-CTF6XMW4.js";
19
19
  import {
20
20
  resolveContext
21
- } from "../chunk-GSMCRJR3.js";
21
+ } from "../chunk-AT5AEZ7M.js";
22
22
  import "../chunk-O7REVMOC.js";
23
23
  import "../chunk-QXFCZON7.js";
24
24
  import {
@@ -145,7 +145,7 @@ async function runValidate(ctx) {
145
145
  );
146
146
  }
147
147
  if (!ctx.targets.includes("test")) return 1;
148
- const { validateModuleTests } = await import("../validate-IPHMKZY6.js");
148
+ const { validateModuleTests } = await import("../validate-3BLRDD6D.js");
149
149
  const outcomes = modules.flatMap(
150
150
  (module) => validateModuleTests(module.name, module.root)
151
151
  );
@@ -1108,11 +1108,17 @@ function injectTypeImport(fileName, source, typeNames) {
1108
1108
  return source.slice(0, existing.start) + renderTypeImport(merged, semi) + source.slice(existing.end);
1109
1109
  }
1110
1110
  const line = renderTypeImport([...new Set(typeNames)].sort(), semi);
1111
- const first = imports[0];
1112
- if (first === void 0) return `${line}
1111
+ const first = imports.find(
1112
+ (node) => (node.specifiers?.length ?? 0) > 0
1113
+ );
1114
+ if (first !== void 0) {
1115
+ return source.slice(0, first.start) + line + "\n" + source.slice(first.start);
1116
+ }
1117
+ const last = imports.at(-1);
1118
+ if (last === void 0) return `${line}
1113
1119
 
1114
1120
  ${source}`;
1115
- return source.slice(0, first.start) + line + "\n" + source.slice(first.start);
1121
+ return source.slice(0, last.end) + "\n" + line + source.slice(last.end);
1116
1122
  }
1117
1123
  function injectViImport(fileName, source) {
1118
1124
  const { program, errors } = parseSync3(fileName, source, { sourceType: "module" });
@@ -5269,17 +5275,17 @@ var VitestAdapter = class extends BaseAdapter {
5269
5275
  fixWithTheModulesLinter(ctx, written) {
5270
5276
  const linter = writtenFileLinter(ctx.cwd);
5271
5277
  if (linter === void 0) return;
5272
- let unfixed = 0;
5278
+ let unsettled = 0;
5273
5279
  for (let at = 0; at < written.length; at += FORMAT_BATCH) {
5274
5280
  const batch = written.slice(at, at + FORMAT_BATCH);
5275
5281
  const pass = spawnSync(linter.bin, [...linter.args, ...batch], {
5276
5282
  cwd: ctx.cwd,
5277
5283
  encoding: "utf8"
5278
5284
  });
5279
- if (pass.status !== 0) unfixed += batch.length;
5285
+ if (pass.status !== 0) unsettled += 1;
5280
5286
  }
5281
5287
  this.say(
5282
- unfixed === 0 ? `ran ${linter.origin} with its fixer over the ${written.length} file(s) this wrote, so the import this migration adds is ordered the way your rules ask. Without it, \`import/order\` alone put 19 modules of this repository in the red.` : `${linter.origin} still reports problems on ${unfixed} of the ${written.length} file(s) this wrote, after its fixer ran. Adoption itself is applied; those are rules its fixer cannot settle on its own, so read them before committing.`
5288
+ unsettled === 0 ? `ran ${linter.origin} with its fixer over the ${written.length} file(s) this wrote, so the import this migration adds is ordered the way your rules ask. Without it, \`import/order\` alone put 19 modules of this repository in the red.` : `ran ${linter.origin} with its fixer over the ${written.length} file(s) this wrote, and it still reports something it cannot fix. Adoption itself is applied. Run your own lint to see what: it may be rules this module already failed, which are not this migration's to settle.`
5283
5289
  );
5284
5290
  }
5285
5291
  plan(context) {
@@ -53,7 +53,7 @@ import {
53
53
  selfCommand,
54
54
  splitToolArgs,
55
55
  walk
56
- } from "./chunk-GSMCRJR3.js";
56
+ } from "./chunk-AT5AEZ7M.js";
57
57
  import {
58
58
  parseJsonc
59
59
  } from "./chunk-QXFCZON7.js";
package/dist/index.js CHANGED
@@ -6,10 +6,10 @@ import {
6
6
  registerAdapters,
7
7
  resolve,
8
8
  setDefaultRunner
9
- } from "./chunk-NFFT5AW4.js";
9
+ } from "./chunk-CTF6XMW4.js";
10
10
  import {
11
11
  BaseAdapter
12
- } from "./chunk-GSMCRJR3.js";
12
+ } from "./chunk-AT5AEZ7M.js";
13
13
  import "./chunk-O7REVMOC.js";
14
14
  import "./chunk-QXFCZON7.js";
15
15
  import "./chunk-NW6UHNYX.js";
@@ -7,7 +7,7 @@ import {
7
7
  readTestAdoption,
8
8
  resolveVitest,
9
9
  suiteOf
10
- } from "./chunk-GSMCRJR3.js";
10
+ } from "./chunk-AT5AEZ7M.js";
11
11
  import "./chunk-O7REVMOC.js";
12
12
  import "./chunk-QXFCZON7.js";
13
13
  import "./chunk-NW6UHNYX.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hublo/sentinel",
3
- "version": "1.4.0-alpha.38",
3
+ "version": "1.4.0-alpha.39",
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",