Format JavaScript Standard Style as Stylish (i.e. snazzy) output
94
Build a command-line tool that parses compact linter output from stdin and outputs the structured data as formatted JSON to stdout. The tool should handle variations in linter output formats robustly and provide helpful error messages.
Your tool must:
The output should be a JSON array of objects, where each object represents a file with linting issues:
[
{
"filePath": "path/to/file.js",
"messages": [
{
"line": 10,
"column": 5,
"message": "Error description",
"ruleId": "rule-name"
}
]
}
]Input (via stdin):
/path/to/file.js:10:5: Missing semicolon. (semi)Expected Output (to stdout):
[
{
"filePath": "/path/to/file.js",
"messages": [
{
"line": 10,
"column": 5,
"message": "Missing semicolon.",
"ruleId": "semi"
}
]
}
]Exit Code: 0
Test File: test/parser.test.js
Input (via stdin):
src/app.js:15:3: Unexpected var, use let or const instead. (no-var)
src/utils.js:42:10: 'unused' is defined but never used. (no-unused-vars)Expected Output (to stdout):
[
{
"filePath": "src/app.js",
"messages": [
{
"line": 15,
"column": 3,
"message": "Unexpected var, use let or const instead.",
"ruleId": "no-var"
}
]
},
{
"filePath": "src/utils.js",
"messages": [
{
"line": 42,
"column": 10,
"message": "'unused' is defined but never used.",
"ruleId": "no-unused-vars"
}
]
}
]Exit Code: 0
Test File: test/parser.test.js
Provides parsing support for standard JavaScript linter output formats.
Install with Tessl CLI
npx tessl i tessl/npm-snazzydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10