@hublo/sentinel 1.4.0-alpha.37 → 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-2N5D63HC.js";
18
+ } from "../chunk-CTF6XMW4.js";
19
19
  import {
20
20
  resolveContext
21
- } from "../chunk-YMSI5ZCB.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-MTAEHEMX.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
  );
@@ -1003,7 +1003,7 @@ var TYPE_RENAMES = {
1003
1003
  var NAMED_RULE = {
1004
1004
  requireActual: `await vi.importActual(...), which makes the surrounding factory async`,
1005
1005
  requireMock: `await vi.importMock(...), which makes the surrounding factory async`,
1006
- setTimeout: `vi.setConfig({ testTimeout: ... }), which is configuration rather than a call`
1006
+ setTimeout: `vi.setConfig({ testTimeout: ..., hookTimeout: ... }), which is configuration rather than a call, and BOTH because jest's one budget covers hooks too`
1007
1007
  };
1008
1008
  var OWNED_BY_A_LATER_PASS = /* @__PURE__ */ new Set(["isolateModules", "isolateModulesAsync"]);
1009
1009
  function lineOf(source, offset) {
@@ -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" });
@@ -2308,10 +2314,11 @@ function applyNamedRules(source, program, fileName = "") {
2308
2314
  return;
2309
2315
  }
2310
2316
  if (member === "setTimeout") {
2317
+ const budget = argumentText(source, node);
2311
2318
  edits.push({
2312
2319
  start: node.start,
2313
2320
  end: node.end,
2314
- text: `vi.setConfig({ testTimeout: ${argumentText(source, node)} })`
2321
+ text: `vi.setConfig({ testTimeout: ${budget}, hookTimeout: ${budget} })`
2315
2322
  });
2316
2323
  applied.add("jest.setTimeout");
2317
2324
  }
@@ -3795,7 +3802,9 @@ function concurrencyBlock(cwd, reading, target) {
3795
3802
  return "";
3796
3803
  }
3797
3804
  function timeoutBlock(reading) {
3798
- return reading.testTimeout === void 0 ? "" : ` testTimeout: ${reading.testTimeout},`;
3805
+ if (reading.testTimeout === void 0) return "";
3806
+ return ` testTimeout: ${reading.testTimeout},
3807
+ hookTimeout: ${reading.testTimeout},`;
3799
3808
  }
3800
3809
  function globalSetupBlock(reading) {
3801
3810
  if (reading.globalSetup === void 0) return "";
@@ -5266,17 +5275,17 @@ var VitestAdapter = class extends BaseAdapter {
5266
5275
  fixWithTheModulesLinter(ctx, written) {
5267
5276
  const linter = writtenFileLinter(ctx.cwd);
5268
5277
  if (linter === void 0) return;
5269
- let unfixed = 0;
5278
+ let unsettled = 0;
5270
5279
  for (let at = 0; at < written.length; at += FORMAT_BATCH) {
5271
5280
  const batch = written.slice(at, at + FORMAT_BATCH);
5272
5281
  const pass = spawnSync(linter.bin, [...linter.args, ...batch], {
5273
5282
  cwd: ctx.cwd,
5274
5283
  encoding: "utf8"
5275
5284
  });
5276
- if (pass.status !== 0) unfixed += batch.length;
5285
+ if (pass.status !== 0) unsettled += 1;
5277
5286
  }
5278
5287
  this.say(
5279
- 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.`
5280
5289
  );
5281
5290
  }
5282
5291
  plan(context) {
@@ -53,7 +53,7 @@ import {
53
53
  selfCommand,
54
54
  splitToolArgs,
55
55
  walk
56
- } from "./chunk-YMSI5ZCB.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-2N5D63HC.js";
9
+ } from "./chunk-CTF6XMW4.js";
10
10
  import {
11
11
  BaseAdapter
12
- } from "./chunk-YMSI5ZCB.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-YMSI5ZCB.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.37",
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",