pi-formatter 1.1.1 → 1.1.2

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.
@@ -203,6 +203,15 @@ function isTreefmtUnmatchedPathFailure(result: ExecResult): boolean {
203
203
  return /\bno formatter for path:/i.test(`${result.stderr}\n${result.stdout}`);
204
204
  }
205
205
 
206
+ function isTreefmtNixUnmatchedPathSuccess(result: ExecResult): boolean {
207
+ // Some treefmt-nix formatter wrappers exit successfully even when the target
208
+ // path does not match any formatter, but they still report that zero files
209
+ // were emitted for processing.
210
+ return /\bemitted\s+0\s+files?\s+for processing\b/i.test(
211
+ `${result.stderr}\n${result.stdout}`,
212
+ );
213
+ }
214
+
206
215
  function shouldFallbackFromTreefmtNixFailure(result: ExecResult): boolean {
207
216
  const output = `${result.stderr}\n${result.stdout}`;
208
217
  return (
@@ -306,7 +315,8 @@ async function resolveProjectFormatterCandidates(
306
315
  await resolveTreefmtCandidate(filePath, cwd),
307
316
  await resolveTreefmtNixCandidate(filePath, cwd),
308
317
  ].filter(
309
- (candidate): candidate is ProjectFormatterCandidate => candidate !== undefined,
318
+ (candidate): candidate is ProjectFormatterCandidate =>
319
+ candidate !== undefined,
310
320
  );
311
321
 
312
322
  return candidates.sort(compareProjectFormatterCandidates);
@@ -442,6 +452,10 @@ async function executeTreefmtNixCandidate(
442
452
  );
443
453
 
444
454
  if (result.code === 0) {
455
+ if (isTreefmtNixUnmatchedPathSuccess(result)) {
456
+ return "skipped";
457
+ }
458
+
445
459
  summaryReporter?.({
446
460
  runnerId: candidate.runnerId,
447
461
  status: "succeeded",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-formatter",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Pi extension that auto-formats files.",
5
5
  "type": "module",
6
6
  "files": [