CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-snazzy

Format JavaScript Standard Style as Stylish (i.e. snazzy) output

94

1.18x
Overview
Eval results
Files

task.mdevals/scenario-7/

Linter Output Pipeline

Build a Node.js stream pipeline that processes JavaScript linter output through multiple stages and saves reports when errors are found.

Requirements

Create a module that exports a createLinterPipeline function that:

  1. Accepts an input stream containing compact linter output (JSON format)
  2. Pipes the input through a snazzy Transform stream to format the output
  3. Writes the formatted output to a specified output stream
  4. When the snazzy stream detects errors (exitCode is non-zero), also writes the formatted output to a file
  5. Returns an object containing the snazzy stream instance so callers can access its exitCode property

The pipeline should propagate errors using standard stream error events and handle the finish event to trigger file writing when needed.

API

/**
 * Creates a linter output processing pipeline
 * @param {Readable} inputStream - Source stream containing compact linter output (JSON)
 * @param {Writable} outputStream - Destination stream for formatted output
 * @param {string} reportPath - File path to save report when errors are detected
 * @returns {Object} Object with 'snazzy' property containing the snazzy stream instance
 */
function createLinterPipeline(inputStream, outputStream, reportPath);

@generates

Test Cases

  • When linter output contains errors, the formatted output is written to both the output stream and the report file @test
  • When linter output contains no errors, the formatted output is written only to the output stream (report file is not created) @test
  • The returned object has a 'snazzy' property that references the snazzy stream instance @test
  • Stream errors are propagated through the pipeline @test

Dependencies { .dependencies }

snazzy { .dependency }

Provides stream-based transformation of compact linter output to stylish format.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-snazzy

tile.json