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-8/

Linter Output Processor

A tool that programmatically processes JavaScript linter output, formats it into a readable display, and tracks error statistics.

Capabilities

Process Linter JSON Output

The processor must handle JSON strings containing linter results in compact format. The input format follows the standard linter output structure with an array of results, where each result contains a file path and an array of messages.

Example input format:

[
  {
    "filePath": "src/example.js",
    "messages": [
      {"line": 10, "column": 5, "message": "Missing semicolon.", "ruleId": "semi"}
    ]
  }
]
  • It accepts a JSON string containing linter results and processes it through a formatting stream @test
  • It correctly handles linter output with multiple files @test
  • It processes linter output with no errors (empty messages array) and produces appropriate output @test

Track Exit Codes

The processor must track whether errors were found and expose this information via an exit code property.

  • It exposes an exit code property that is 0 when no errors are found @test
  • It exposes an exit code property that is 1 when errors are detected @test

Stream Integration

The processor must work with Node.js streams, allowing it to be composed in stream pipelines.

  • It can be integrated into a Node.js stream pipeline with readable and writable streams @test

Implementation

@generates

API

/**
 * Creates a processor that formats linter output.
 *
 * @param {string} linterJson - JSON string containing linter results in compact format
 * @returns {Promise<{formatted: string, exitCode: number}>} The formatted output and exit code
 */
async function processLinterOutput(linterJson) {
  // IMPLEMENTATION HERE
}

module.exports = {
  processLinterOutput
};

Dependencies { .dependencies }

snazzy { .dependency }

Provides linter output formatting from compact to stylish format.

Install with Tessl CLI

npx tessl i tessl/npm-snazzy

tile.json