0
0
Fork 0
mirror of https://github.com/DavidAnson/markdownlint-cli2-action.git synced 2024-11-21 22:01:30 +01:00

Include annotation information when reporting errors (fixes #5).

This commit is contained in:
David Anson 2022-02-05 12:57:47 -08:00
parent b3c3b40b95
commit c3b2de4a57
3 changed files with 48 additions and 2 deletions

View file

@ -18,7 +18,10 @@
"reportUnusedDisableDirectives": true, "reportUnusedDisableDirectives": true,
"rules": { "rules": {
"indent": ["error", 2], "indent": ["error", 2],
"function-call-argument-newline": "off",
"one-var": "off", "one-var": "off",
"padded-blocks": "off",
"prefer-named-capture-group": "off",
"sort-keys": "off", "sort-keys": "off",
"node/handle-callback-err": "error", "node/handle-callback-err": "error",
@ -59,6 +62,7 @@
"node/prefer-promises/dns": "error", "node/prefer-promises/dns": "error",
"node/prefer-promises/fs": "error", "node/prefer-promises/fs": "error",
"unicorn/no-unsafe-regex": "off",
"unicorn/prefer-module": "off", "unicorn/prefer-module": "off",
"unicorn/prefer-top-level-await": "off" "unicorn/prefer-top-level-await": "off"
} }

23
dist/index.js vendored
View file

@ -31663,7 +31663,28 @@ const core = __nccwpck_require__(2186);
const {"main": markdownlintCli2} = __nccwpck_require__(9247); const {"main": markdownlintCli2} = __nccwpck_require__(9247);
const logMessage = core.info; const logMessage = core.info;
const logError = core.error; const logError = (error) => {
// eslint-disable-next-line init-declarations
let annotation;
const match = error.match(/^([^:]+):(\d+)(?::(\d+))?\s(\S+)\s(.+)$/u);
if (match) {
const [
,
file,
startLine,
startColumn,
,
title
] = match;
annotation = {
title,
file,
startLine,
startColumn
};
}
core.error(error, annotation);
};
const argv = const argv =
core.getInput("globs"). core.getInput("globs").
split("\n"). split("\n").

View file

@ -6,7 +6,28 @@ const core = require("@actions/core");
const {"main": markdownlintCli2} = require("markdownlint-cli2"); const {"main": markdownlintCli2} = require("markdownlint-cli2");
const logMessage = core.info; const logMessage = core.info;
const logError = core.error; const logError = (error) => {
// eslint-disable-next-line init-declarations
let annotation;
const match = error.match(/^([^:]+):(\d+)(?::(\d+))?\s(\S+)\s(.+)$/u);
if (match) {
const [
,
file,
startLine,
startColumn,
,
title
] = match;
annotation = {
title,
file,
startLine,
startColumn
};
}
core.error(error, annotation);
};
const argv = const argv =
core.getInput("globs"). core.getInput("globs").
split("\n"). split("\n").