@heyramzi/lint 2.13.0 → 2.14.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 CHANGED
@@ -323,7 +323,7 @@ voice. By default each check reports its first hit per file, which settles pass
323
323
  lists every hit of every check with its line (`line` in `--json`), and the exit code doesn't
324
324
  change. A refused push prints that command with this checkout's path: inside a repo, `npx -y -p
325
325
  @heyramzi/lint heyramzi-slop` runs the repo's installed copy, which can be older than the gate's.
326
- Always name the package with `-p`: the bare npm name `heyramzi-slop` belongs to nobody, and the
326
+ Always name the package with `-p`: the bare npm name `heyramzi-slop` is only a placeholder that prints this command and exits 1, and the
327
327
  `npx-bare-bin` repo rule refuses a file that calls it.
328
328
 
329
329
  `--jev` also asks TypeSafe Jev (`jev.js`) to score each sentence and paragraph against the
@@ -78,7 +78,8 @@ export const patternsSubjectVoice = [
78
78
  name: "Every scenario is named by its trigger",
79
79
  // His rule, not a bot tell: 55 of 267 human replies on the Reddit bench use one, against 7 of our 72 bad ones (9 Nov 2026).
80
80
  // A state word passes unless "by" names who did it: "Hive is not connected", "what's broken", "when we're done" (15 of upsys's 78, 10 Nov 2026).
81
- test: /\b(?:is|are|was|were|be|been|being|['’]s|['’]re)\s+(?:not\s+|never\s+|already\s+|also\s+|still\s+|just\s+|then\s+|\w+ly\s+)?(?!(?:interested|based|related|supposed|used\s+to|tired|bored|excited|worried|scared|married|located|involved|impressed|devastated|surprised|confused|annoyed|pleased|stuck|qualified|indeed|need|feed|seed|speed|breed|greed|weed)\b|(?:closed|locked|unlocked|connected|disconnected|archived|enabled|disabled|un[a-z]{2,}ed)\b(?!\s+by\b)|broken\b(?!\s+(?:by|into|down|up|out|off)\b)|caught\s+up\b|done\b(?=\s*(?:[.!?,;:)]|$)))(?:[a-z]{3,}ed|built|made|done|given|taken|known|seen|written|shown|sent|kept|put|found|held|told|paid|brought|bought|caught|taught|chosen|driven|forgotten|hidden|broken|spoken|stolen|frozen|drawn|grown|thrown|worn|torn)\b/i,
81
+ // So does "you're" or "we're": the person is the subject, nobody's hidden ("what you're paid for", a human r/ClaudeCode comment, 15 Nov 2026).
82
+ test: /\b(?:is|are|was|were|be|been|being|['’]s|['’]re)\s+(?:not\s+|never\s+|already\s+|also\s+|still\s+|just\s+|then\s+|\w+ly\s+)?(?!(?:interested|based|related|supposed|used\s+to|tired|bored|excited|worried|scared|married|located|involved|impressed|devastated|surprised|confused|annoyed|pleased|stuck|qualified|indeed|need|feed|seed|speed|breed|greed|weed)\b|(?:closed|locked|unlocked|connected|disconnected|archived|enabled|disabled|un[a-z]{2,}ed)\b(?!\s+by\b)|broken\b(?!\s+(?:by|into|down|up|out|off)\b)|caught\s+up\b|done\b(?=\s*(?:[.!?,;:)]|$)))(?:[a-z]{3,}ed|built|made|done|given|taken|known|seen|written|shown|sent|kept|put|found|held|told|paid|brought|bought|caught|taught|chosen|driven|forgotten|hidden|broken|spoken|stolen|frozen|drawn|grown|thrown|worn|torn)\b(?:(?<!\b(?:you|we)['’]re\s+(?:\w+\s+)?\w+)|(?=\s+by\b))/i,
82
83
  rule: 'A passive: "is named", "was built", "are treated". Nobody does anything in it, so it reads as a report, not a person talking. Name who does it: "we name every scenario by its trigger". Ramzi, 9 Nov 2026, on a Reddit draft: "anything passive tense basically is bad, bad, bad".',
83
84
  example:
84
85
  '"Every scenario we build is named by its trigger" / "anything that comes through chat is treated as an emergency" / "the report was sent on Monday"',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyramzi/lint",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Shared oxlint rules, base config and gates for Studio projects",
5
5
  "license": "MIT",
6
6
  "repository": {
package/register.js CHANGED
@@ -125,7 +125,9 @@ const AI_SIGNALS = {
125
125
  // 49% of ours, 14% of theirs.
126
126
  "no I, hedge or question": (m) => m.speakerMarks === 0,
127
127
  // Our median 12.3 words a sentence, theirs 17.
128
- "short even sentences": (m) => m.meanSentence < 14,
128
+ // Even is a spread under 0.45, between the bench medians (ours 0.40, theirs 0.51), read from 8 sentences up like the lengthVariation band.
129
+ "short even sentences": (m) =>
130
+ m.meanSentence < 14 && (m.sentences < 8 || m.lengthVariation < 0.45),
129
131
  // 35% of ours, 14% of theirs.
130
132
  "orders the reader": (m) => m.sentences >= 3 && m.commandShare > 0,
131
133
  // The 21 Oct paragraph rule overshot: 3 or more paragraphs under 30 words each.
@@ -2,7 +2,10 @@
2
2
 
3
3
  // WHY client id: a Royal Mail export held X-IBM-Client-Id beside its secret, and the pair is the login.
4
4
  const SECRET_NAME =
5
- /secret|token|passw(or)?d|api[-_]?key|apikey|authorization|client[-_]?id|private[-_]?key|access[-_]?key/i;
5
+ /secret|token|passw(or)?d|api[-_]?key|apikey|authorization|client[-_]?id|auth[-_]?id|private[-_]?key|access[-_]?key/i;
6
+ // WHY: Make's sha256(text; encoding; key) is an HMAC, and an Unleashed export typed its live key there.
7
+ const SIGNING_CALL = /\b(sha\d+|md5|hmac|base64)\(/gi;
8
+ const QUOTED_TOKEN = /"([A-Za-z0-9+/=_.~-]{20,})"/g;
6
9
  const INLINE_FIELD =
7
10
  "(password|passwd|secret|client[_-]?secret|api[_-]?key|apikey|access[_-]?token)";
8
11
  const INLINE = [
@@ -19,6 +22,25 @@ function isLiteral(value) {
19
22
  return trimmed.length >= 8 && !trimmed.includes("{{") && !PLACEHOLDER.test(trimmed);
20
23
  }
21
24
 
25
+ /** The text between a call's opening parenthesis and the one that closes it. */
26
+ function argumentsFrom(value, start) {
27
+ let depth = 1;
28
+ for (let at = start; at < value.length; at++) {
29
+ if (value[at] === "(") depth++;
30
+ if (value[at] === ")" && --depth === 0) return value.slice(start, at);
31
+ }
32
+ return value.slice(start);
33
+ }
34
+
35
+ /** A key-shaped quoted literal inside a hashing or encoding call of a Make formula. */
36
+ function hasSigningKey(value) {
37
+ return [...value.matchAll(SIGNING_CALL)].some((call) =>
38
+ [...argumentsFrom(value, call.index + call[0].length).matchAll(QUOTED_TOKEN)].some(
39
+ ([, token]) => /\d/.test(token) && /[A-Za-z]/.test(token),
40
+ ),
41
+ );
42
+ }
43
+
22
44
  /** The scenario object in an export, a `blueprint` wrapper or an API response, or null. */
23
45
  function scenarioOf(json) {
24
46
  for (const candidate of [json, json?.blueprint, json?.response?.blueprint]) {
@@ -47,6 +69,7 @@ function literals(node, trail, found) {
47
69
  const at = `${trail}.${key}`;
48
70
  if (typeof child === "string") {
49
71
  if (SECRET_NAME.test(key) && isLiteral(child)) found.push({ trail: at, field: key });
72
+ if (hasSigningKey(child)) found.push({ trail: at, field: name ?? key });
50
73
  for (const pattern of INLINE) {
51
74
  const match = pattern.exec(child);
52
75
  if (match && isLiteral(match[2])) found.push({ trail: at, field: match[1] });
@@ -0,0 +1,22 @@
1
+ /** A fetch mock that hands every call one Response: its body reads once, so the second call throws "Body is unusable" (Seam, 15 Nov 2026). */
2
+
3
+ const TEST = /\.(test|spec)\.[cm]?[jt]sx?$/;
4
+ const SHARED = /mockResolvedValue\(\s*new Response\(/g;
5
+
6
+ export function sharedMockResponses(tree) {
7
+ const found = [];
8
+ for (const file of tree.touched) {
9
+ if (!TEST.test(file)) continue;
10
+ const text = tree.text(file);
11
+ if (!text) continue;
12
+ for (const match of text.matchAll(SHARED)) {
13
+ const line = text.slice(0, match.index).split("\n").length;
14
+ found.push({
15
+ file,
16
+ rule: "shared-mock-response",
17
+ message: `line ${line} gives every call the same Response, and a body reads once, so a second fetch throws "Body is unusable". Write \`mockImplementation(async () => new Response(...))\` for a fresh one per call, or \`mockResolvedValueOnce\` when exactly one call is expected.`,
18
+ });
19
+ }
20
+ }
21
+ return found;
22
+ }
package/repo-rules/npx.js CHANGED
@@ -1,4 +1,4 @@
1
- /** A registry runner (npx, dlx, bunx) fetching a bare `heyramzi-*` name, which nobody owns on npm. */
1
+ /** A registry runner (npx, dlx, bunx) fetching a bare `heyramzi-*` name, never the linter on npm (`heyramzi-slop` is a placeholder). */
2
2
 
3
3
  const RUNNER = /(?<![\w-])(?:npx|pnpx|bunx|(?:pnpm|yarn)\s+dlx|npm\s+exec)(?![\w-])/g;
4
4
  const BARE = /^heyramzi-[\w.-]+(@\S*)?$/;
@@ -40,7 +40,7 @@ export function npxBareBins(tree) {
40
40
  found.push({
41
41
  file,
42
42
  rule: "npx-bare-bin",
43
- message: `line ${line} has ${match[0]} fetch the bare npm name ${bin}. Nobody owns that name, so whoever registers it runs code on every machine that follows the line. The bin ships in @heyramzi/lint: write \`npx -y -p @heyramzi/lint ${bin}\`.`,
43
+ message: `line ${line} has ${match[0]} fetch the bare npm name ${bin}, which isn't the linter: heyramzi-slop is a placeholder that exits 1, and an unregistered name runs whoever claims it on every machine that follows the line. The bin ships in @heyramzi/lint: write \`npx -y -p @heyramzi/lint ${bin}\`.`,
44
44
  });
45
45
  }
46
46
  }
package/repo-rules.js CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { blueprintSecrets } from "#lint/repo-rules/blueprints.js";
7
7
  import { untrackedImports } from "#lint/repo-rules/imports.js";
8
+ import { sharedMockResponses } from "#lint/repo-rules/mock-response.js";
8
9
  import { npxBareBins } from "#lint/repo-rules/npx.js";
9
10
  import { composeImages, fossilNames } from "#lint/repo-rules/paths.js";
10
11
  import {
@@ -42,6 +43,7 @@ export const RULES = [
42
43
  untrackedImports,
43
44
  blueprintSecrets,
44
45
  npxBareBins,
46
+ sharedMockResponses,
45
47
  ];
46
48
 
47
49
  /** Every violation in the files the tree says were touched. */