@heyramzi/lint 2.1.0 → 2.2.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/old-names-mask.js CHANGED
@@ -87,6 +87,13 @@ export function maskSimple(src, extension) {
87
87
  if (extension === "sql" && src[span.start] === '"') continue;
88
88
  blank(span.start, span.end);
89
89
  }
90
+ // `@diagnose(DeprecatedDeclaration, ...)` names the compiler's warning groups, which nobody here can rename.
91
+ if (extension === "swift") {
92
+ for (const match of src.matchAll(/@diagnose\(([^)\n]*)\)/g)) {
93
+ const start = match.index + "@diagnose(".length;
94
+ blank(start, start + match[1].length);
95
+ }
96
+ }
90
97
  return text();
91
98
  }
92
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyramzi/lint",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Shared oxlint rules, base config and gates for Studio projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -80,10 +80,10 @@
80
80
  "access": "public"
81
81
  },
82
82
  "dependencies": {
83
- "@heyramzi/social": "^1.1.0"
83
+ "@heyramzi/social": "^1.2.0"
84
84
  },
85
85
  "scripts": {
86
86
  "voice:refresh": "node scripts/harvest-voice.mjs --write",
87
87
  "test": "node --test \"*.test.mjs\""
88
88
  }
89
- }
89
+ }
@@ -58,10 +58,15 @@ export function heyramziLinks(tree) {
58
58
  }
59
59
 
60
60
  const LOCK_ENTRY = /^ {2}'?(@heyramzi\/[^@']+)@([^'(:]+)'?:\s*$/;
61
+ const GITHUB_SCOPE = /^\s*@heyramzi:registry\s*=\s*https:\/\/npm\.pkg\.github\.com/m;
61
62
 
62
63
  export function heyramziTarballs(tree) {
63
64
  const found = [];
64
65
  for (const file of tree.touchedMatching(/(^|\/)pnpm-lock\.yaml$/)) {
66
+ // Only a repo whose .npmrc sends @heyramzi to GitHub Packages needs the URL. One that leaves
67
+ // the scope on npmjs (Agency OS, client repos) resolves the canonical npmjs URL correctly.
68
+ const npmrc = file.replace(/pnpm-lock\.yaml$/, ".npmrc");
69
+ if (!GITHUB_SCOPE.test(tree.text(npmrc))) continue;
65
70
  const lines = tree.text(file).split("\n");
66
71
  lines.forEach((line, index) => {
67
72
  const entry = LOCK_ENTRY.exec(line);
@@ -72,10 +72,17 @@ function nodeVersionFindings(file, lines, tree) {
72
72
  return found;
73
73
  }
74
74
 
75
+ /** npm trusted publishing (OIDC) trusts only GitHub-hosted runners, so that one shape may use one. */
76
+ function npmTrustedPublish(lines) {
77
+ const code = lines.map(yamlCode).join("\n");
78
+ return /^\s*id-token\s*:\s*write\b/m.test(code) && /\bnpm\s+publish\b/.test(code);
79
+ }
80
+
75
81
  export function workflows(tree) {
76
82
  const found = [];
77
83
  for (const file of tree.touchedMatching(WORKFLOW)) {
78
84
  const lines = tree.text(file).split("\n");
85
+ const hostedAllowed = npmTrustedPublish(lines);
79
86
  const add = (rule, index, message) =>
80
87
  found.push({
81
88
  file,
@@ -87,7 +94,7 @@ export function workflows(tree) {
87
94
  const runsOn = /^\s*runs-on\s*:\s*(.*)$/.exec(line);
88
95
  if (runsOn) {
89
96
  const value = runsOnValue(lines, index, runsOn[1].trim());
90
- if (HOSTED.test(value) && !value.includes("self-hosted")) {
97
+ if (HOSTED.test(value) && !value.includes("self-hosted") && !hostedAllowed) {
91
98
  add(
92
99
  "workflow-runs-on",
93
100
  index,