feat: use go tool

This commit is contained in:
2026-07-03 19:24:01 -04:00
parent 39548b4332
commit 4d0cab1fe0
1542 changed files with 252399 additions and 14 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) David Anson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+54
View File
@@ -0,0 +1,54 @@
# markdownlint-cli2-formatter-default
> An output formatter for [`markdownlint-cli2`][markdownlint-cli2] that produces
> the same output as [`markdownlint-cli`][markdownlint-cli]
[![npm version][npm-image]][npm-url]
[![License][license-image]][license-url]
## Install
```bash
npm install markdownlint-cli2-formatter-default --save-dev
```
## Use
No action is necessary; this is the default output formatter for
`markdownlint-cli2`.
To reference it directly in `.markdownlint-cli2.jsonc`:
```json
{
"outputFormatters": [
[ "markdownlint-cli2-formatter-default" ]
]
}
```
## Example
```text
dir/about.md:1:3 error MD021/no-multiple-space-closed-atx Multiple spaces inside hashes on closed atx style heading [Context: "# About #"]
dir/about.md:1:10 error MD021/no-multiple-space-closed-atx Multiple spaces inside hashes on closed atx style heading [Context: "# About #"]
dir/about.md:4 error MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "1. List"]
dir/about.md:5:1 error MD029/ol-prefix Ordered list item prefix [Expected: 2; Actual: 3; Style: 1/2/3]
dir/subdir/info.md:1 error MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Information"]
dir/subdir/info.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Information"]
dir/subdir/info.md:2:7 error MD038/no-space-in-code Spaces inside code span elements [Context: "` code1`"]
dir/subdir/info.md:2:26 error MD038/no-space-in-code Spaces inside code span elements [Context: "`code2 `"]
dir/subdir/info.md:4 error MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
viewme.md:3:10 error MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
viewme.md:5 warning MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
viewme.md:6 error MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Description"]
viewme.md:12:4 error MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "## Summary"]
viewme.md:14:14 warning MD047/single-trailing-newline Files should end with a single newline character
```
[license-image]: https://img.shields.io/npm/l/markdownlint-cli2-formatter-default.svg
[license-url]: https://opensource.org/licenses/MIT
[markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
[markdownlint-cli2]: https://github.com/DavidAnson/markdownlint-cli2
[npm-image]: https://img.shields.io/npm/v/markdownlint-cli2-formatter-default.svg
[npm-url]: https://www.npmjs.com/package/markdownlint-cli2-formatter-default
@@ -0,0 +1,25 @@
// @ts-check
"use strict";
/** @typedef {import("../markdownlint-cli2.mjs").OutputFormatterOptions} OutputFormatterOptions */
// Formats markdownlint-cli2 results in the style of `markdownlint-cli`
const outputFormatter = (/** @type {OutputFormatterOptions} */ options) => {
const { results, logError } = options;
for (const errorInfo of results) {
const { fileName, lineNumber, ruleNames, ruleDescription, errorDetail, errorContext, errorRange, severity } = errorInfo;
const rule = ruleNames.join("/");
const line = `:${lineNumber}`;
const rangeStart = (errorRange && errorRange[0]) || 0;
const column = rangeStart ? `:${rangeStart}` : "";
const description = ruleDescription;
const detail = (errorDetail ? ` [${errorDetail}]` : "");
const context = (errorContext ? ` [Context: "${errorContext}"]` : "");
const sev = (severity ? ` ${severity}` : "");
logError(`${fileName}${line}${column}${sev} ${rule} ${description}${detail}${context}`);
}
return Promise.resolve();
};
module.exports = outputFormatter;
+27
View File
@@ -0,0 +1,27 @@
{
"name": "markdownlint-cli2-formatter-default",
"version": "0.0.6",
"description": "An output formatter for markdownlint-cli2 that produces the same output as markdownlint-cli",
"author": {
"name": "David Anson",
"url": "https://dlaa.me/"
},
"license": "MIT",
"main": "markdownlint-cli2-formatter-default.js",
"homepage": "https://github.com/DavidAnson/markdownlint-cli2",
"repository": {
"type": "git",
"url": "git+https://github.com/DavidAnson/markdownlint-cli2.git"
},
"bugs": "https://github.com/DavidAnson/markdownlint-cli2/issues",
"funding": "https://github.com/sponsors/DavidAnson",
"files": [
"markdownlint-cli2-formatter-default.js"
],
"peerDependencies": {
"markdownlint-cli2": ">=0.0.4"
},
"keywords": [
"markdownlint-cli2-formatter"
]
}