Skip to content

Commit 077d85f

Browse files
committed
fix: waive raw process.* writes with the process-stdio lint marker id
1 parent c22adf6 commit 077d85f

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/spinner/with.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export async function withSpinner<T>(
129129
// corresponding option; tests cover paths individually.
130130
/* c8 ignore start */
131131
if (wasSpinning) {
132-
process.stderr.write('\r\x1B[2K') // socket-lint: allow logger
132+
process.stderr.write('\r\x1B[2K') // socket-lint: allow process-stdio
133133
}
134134

135135
if (savedColor !== undefined) {

tools/prim/src/cli.mts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const ARG_OPTIONS = {
153153
export async function runCli(argv) {
154154
// Bare `prim` / `prim help` / `prim --help` → print help.
155155
if (argv.length === 0 || argv[0] === 'help') {
156-
process.stdout.write(HELP) // socket-lint: allow logger
156+
process.stdout.write(HELP) // socket-lint: allow process-stdio
157157
return
158158
}
159159

@@ -172,7 +172,7 @@ export async function runCli(argv) {
172172
const { values, positionals } = parsed
173173

174174
if (values.help || positionals.length === 0) {
175-
process.stdout.write(HELP) // socket-lint: allow logger
175+
process.stdout.write(HELP) // socket-lint: allow process-stdio
176176
return
177177
}
178178

@@ -366,21 +366,21 @@ export async function runCli(argv) {
366366
// CLI tool: stderr for human warnings keeps stdout pure
367367
// machine-pipeable JSON / findings text.
368368
const warnMsg = `prim: warning — ${totalSkipped} file(s) skipped and excluded from findings. Audit is incomplete.\n`
369-
process.stderr.write(warnMsg) // socket-lint: allow logger
369+
process.stderr.write(warnMsg) // socket-lint: allow process-stdio
370370
if (parseFailureFiles.length > 0) {
371371
const header = ` parse-failed (${parseFailureFiles.length}):\n`
372-
process.stderr.write(header) // socket-lint: allow logger
372+
process.stderr.write(header) // socket-lint: allow process-stdio
373373
for (let i = 0, { length } = parseFailureFiles; i < length; i += 1) {
374374
const f = parseFailureFiles[i]!
375-
process.stderr.write(` ${f}\n`) // socket-lint: allow logger
375+
process.stderr.write(` ${f}\n`) // socket-lint: allow process-stdio
376376
}
377377
}
378378
if (stripFailureFiles.length > 0) {
379379
const header = ` ts-strip-failed (${stripFailureFiles.length}):\n`
380-
process.stderr.write(header) // socket-lint: allow logger
380+
process.stderr.write(header) // socket-lint: allow process-stdio
381381
for (let i = 0, { length } = stripFailureFiles; i < length; i += 1) {
382382
const f = stripFailureFiles[i]!
383-
process.stderr.write(` ${f}\n`) // socket-lint: allow logger
383+
process.stderr.write(` ${f}\n`) // socket-lint: allow process-stdio
384384
}
385385
}
386386
}

tools/prim/src/report.mts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { formatLintFindings } from './lint.mts'
1717
import { formatValidationReport } from './validate.mts'
1818

1919
export function fail(msg) {
20-
process.stderr.write(`prim: ${msg}\n`) // socket-lint: allow logger
20+
process.stderr.write(`prim: ${msg}\n`) // socket-lint: allow process-stdio
2121
process.exit(1)
2222
}
2323

@@ -44,9 +44,9 @@ export function report(
4444
stripFailures: stripFailureFiles.length,
4545
stripFailureFiles,
4646
})
47-
process.stdout.write(`${payload}\n`) // socket-lint: allow logger
47+
process.stdout.write(`${payload}\n`) // socket-lint: allow process-stdio
4848
} else {
49-
process.stdout.write(formatHuman(findings, { mode, targetName }) + '\n') // socket-lint: allow logger
49+
process.stdout.write(formatHuman(findings, { mode, targetName }) + '\n') // socket-lint: allow process-stdio
5050
}
5151
}
5252

@@ -58,10 +58,10 @@ export function reportLint(findings, json, targetName) {
5858
count: findings.length,
5959
findings,
6060
})
61-
process.stdout.write(`${payload}\n`) // socket-lint: allow logger
61+
process.stdout.write(`${payload}\n`) // socket-lint: allow process-stdio
6262
return
6363
}
64-
process.stdout.write(formatLintFindings(findings, { targetName })) // socket-lint: allow logger
64+
process.stdout.write(formatLintFindings(findings, { targetName })) // socket-lint: allow process-stdio
6565
}
6666

6767
export function reportMod(result, json, applied, showDiff = false) {
@@ -79,9 +79,9 @@ export function reportMod(result, json, applied, showDiff = false) {
7979
validationFailed: true,
8080
validationFindings: result.validationFindings,
8181
})
82-
process.stdout.write(`${payload}\n`) // socket-lint: allow logger
82+
process.stdout.write(`${payload}\n`) // socket-lint: allow process-stdio
8383
} else {
84-
process.stderr.write(`${validationReport}\n`) // socket-lint: allow logger
84+
process.stderr.write(`${validationReport}\n`) // socket-lint: allow process-stdio
8585
}
8686
process.exitCode = 1
8787
return
@@ -94,26 +94,26 @@ export function reportMod(result, json, applied, showDiff = false) {
9494
skipped: result.skipped,
9595
files: result.files,
9696
})
97-
process.stdout.write(`${payload}\n`) // socket-lint: allow logger
97+
process.stdout.write(`${payload}\n`) // socket-lint: allow process-stdio
9898
return
9999
}
100100
const verb = applied ? 'Wrote' : 'Would write'
101101
if (result.rewriteCount === 0) {
102-
process.stdout.write('mod: no rewrites needed.\n') // socket-lint: allow logger
102+
process.stdout.write('mod: no rewrites needed.\n') // socket-lint: allow process-stdio
103103
return
104104
}
105105
const summary = `mod: ${verb} ${result.rewriteCount} rewrite(s) across ${result.filesChanged} file(s).\n`
106-
process.stdout.write(summary) // socket-lint: allow logger
106+
process.stdout.write(summary) // socket-lint: allow process-stdio
107107
if (result.skipped > 0) {
108108
const skippedMsg = `mod: skipped ${result.skipped} candidate(s) — pass --include-guessed to rewrite receiver-guessed sites too.\n`
109-
process.stdout.write(skippedMsg) // socket-lint: allow logger
109+
process.stdout.write(skippedMsg) // socket-lint: allow process-stdio
110110
}
111111
if (!applied) {
112-
process.stdout.write('mod: dry run — pass --apply to write changes.\n') // socket-lint: allow logger
112+
process.stdout.write('mod: dry run — pass --apply to write changes.\n') // socket-lint: allow process-stdio
113113
}
114114
for (const f of result.files) {
115115
const fileLine = ` ${f.file}: ${f.rewrites} rewrite(s), import added: ${f.importAdded ? 'yes' : 'no'}\n`
116-
process.stdout.write(fileLine) // socket-lint: allow logger
116+
process.stdout.write(fileLine) // socket-lint: allow process-stdio
117117
}
118118
if (showDiff && !applied) {
119119
// Dry-run preview: render unified line-diff per planned rewrite by

0 commit comments

Comments
 (0)