From 0ce93d85f7687906c2325bb2fe4b6971d678e306 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Sat, 9 Aug 2025 21:03:14 +0300 Subject: [PATCH 01/14] devplm-4524 --- markdownlint-cli2-action.js | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 24f2930..060bf8e 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -4,6 +4,8 @@ const core = require("@actions/core"); const { "main": markdownlintCli2 } = require("markdownlint-cli2"); +const fs = require("node:fs"); +const path = require("node:path"); const logMessage = core.info; const outputFormatter = (options) => { @@ -49,6 +51,38 @@ const outputFormatter = (options) => { } }; +const makeFileFormatter = (destPath) => (options) => { + const { results, logMessage } = options; + + const findings = results.map((r) => ({ + file: r.fileName, + line: r.lineNumber, + column: r.errorRange ? r.errorRange[0] : null, + endColumn: r.errorRange ? r.errorRange[0] + r.errorRange[1] - 1 : null, + rule: r.ruleNames.join("/"), + rulePrimary: r.ruleNames[0], + description: r.ruleDescription, + detail: r.errorDetail || null, + context: r.errorContext || null, + infoUrl: r.ruleInformation || null + })); + + const outFile = path.resolve(destPath || "markdownlint-results.json"); + try { + fs.mkdirSync(path.dirname(outFile), { recursive: true }); + const payload = { + tool: "markdownlint-cli2", + version: 1, + count: findings.length, + results: findings + }; + fs.writeFileSync(outFile, JSON.stringify(payload, null, 2)); + logMessage(`Wrote markdownlint results to: ${outFile} (${findings.length} issues)`); + } catch (e) { + core.warning(`Failed to write results file: ${e instanceof Error ? e.message : String(e)}`); + } +}; + const separator = core.getInput("separator") || "\n"; const argv = core.getInput("globs"). @@ -64,11 +98,21 @@ if (fix) { argv.push("--fix"); } +const outputFormatters = [[ outputFormatter ]] + +const resultsFile = + core.getInput("results-file") || + process.env.MARKDOWNLINT_RESULTS_FILE || + "markdownlint-results.json"; +if (resultsFile && resultsFile.length > 0) { + outputFormatters.push([makeFileFormatter(resultsFile)]) +} + const parameters = { argv, logMessage, "optionsOverride": { - "outputFormatters": [ [ outputFormatter ] ] + "outputFormatters": outputFormatters } }; markdownlintCli2(parameters).then( From 53696cda6a9c6188e44ecaac6e0e85294aadf256 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Wed, 13 Aug 2025 21:01:41 +0300 Subject: [PATCH 02/14] devplm-4524 --- markdownlint-cli2-action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 060bf8e..116d7c3 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -101,7 +101,7 @@ if (fix) { const outputFormatters = [[ outputFormatter ]] const resultsFile = - core.getInput("results-file") || + core.getInput("results_file") || process.env.MARKDOWNLINT_RESULTS_FILE || "markdownlint-results.json"; if (resultsFile && resultsFile.length > 0) { From caca8add82dbffe13ae5b3c7cd1cfff24fe16bbd Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Wed, 13 Aug 2025 21:36:18 +0300 Subject: [PATCH 03/14] devplm-4524 --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 36756b5..f855c74 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: description: String to use as a separator for the "globs" input (defaults to newline) default: "\n" required: false + results_file: + description: File to write json result report + default: "" + required: false runs: using: node20 main: dist/index.js From 47aeb6bc1e42f15012f78da959ea46a2d269a8ad Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Wed, 13 Aug 2025 21:51:10 +0300 Subject: [PATCH 04/14] devplm-4524 --- markdownlint-cli2-action.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 116d7c3..adcafc3 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -98,7 +98,7 @@ if (fix) { argv.push("--fix"); } -const outputFormatters = [[ outputFormatter ]] +const outputFormatters = [ outputFormatter ] const resultsFile = core.getInput("results_file") || @@ -112,7 +112,7 @@ const parameters = { argv, logMessage, "optionsOverride": { - "outputFormatters": outputFormatters + "outputFormatters": [outputFormatters] } }; markdownlintCli2(parameters).then( From e59b5eb3d59b66d88f8b8840be66f97e922c4316 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Wed, 13 Aug 2025 21:52:36 +0300 Subject: [PATCH 05/14] devplm-4524 --- markdownlint-cli2-action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index adcafc3..30ec611 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -112,7 +112,7 @@ const parameters = { argv, logMessage, "optionsOverride": { - "outputFormatters": [outputFormatters] + "outputFormatters": [[outputFormatters[1]]] } }; markdownlintCli2(parameters).then( From ce3e7545f7b42cb720b967bb10ce65e64887a437 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Wed, 13 Aug 2025 21:54:59 +0300 Subject: [PATCH 06/14] devplm-4524 --- markdownlint-cli2-action.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 30ec611..dccbf75 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -98,7 +98,7 @@ if (fix) { argv.push("--fix"); } -const outputFormatters = [ outputFormatter ] +const outputFormatters = [[ outputFormatter ]] const resultsFile = core.getInput("results_file") || @@ -108,11 +108,13 @@ if (resultsFile && resultsFile.length > 0) { outputFormatters.push([makeFileFormatter(resultsFile)]) } +core.info(`Formatters: ${outputFormatters.length}`) + const parameters = { argv, logMessage, "optionsOverride": { - "outputFormatters": [[outputFormatters[1]]] + "outputFormatters": outputFormatters } }; markdownlintCli2(parameters).then( From 8c417fde23ba71633bf7307c15cc6f6fe323caec Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Wed, 13 Aug 2025 22:03:02 +0300 Subject: [PATCH 07/14] devplm-4524 --- markdownlint-cli2-action.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index dccbf75..5334515 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -108,7 +108,7 @@ if (resultsFile && resultsFile.length > 0) { outputFormatters.push([makeFileFormatter(resultsFile)]) } -core.info(`Formatters: ${outputFormatters.length}`) +logMessage(`Formatters: ${outputFormatters.length}`) const parameters = { argv, From 52678ffaac9a276f546b9e3c335552127d4c6cd4 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Sat, 16 Aug 2025 14:25:52 +0300 Subject: [PATCH 08/14] devplm-4524 --- .github/workflows/report_test.yml | 21 +++ dist/index.js | 218 ++++++++++++++++++++++-------- markdownlint-cli2-action.js | 16 +-- 3 files changed, 187 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/report_test.yml diff --git a/.github/workflows/report_test.yml b/.github/workflows/report_test.yml new file mode 100644 index 0000000..a0c748b --- /dev/null +++ b/.github/workflows/report_test.yml @@ -0,0 +1,21 @@ +name: Local Markdown Lint Test + +on: [workflow_dispatch] + +jobs: + lint_local_test: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Run Local Markdown Lint Action + uses: ./ + with: + globs: | + **/*.md + !node_modules/**/*.md + results_file: ./local/lint_results.json + + - name: Keep container alive for debugging + run: sleep 3600 \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index c69a7b9..346b487 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6471,11 +6471,19 @@ class EntryFilter { this.index = new Map(); } getFilter(positive, negative) { - const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); - const negativeRe = utils.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })); - return (entry) => this._filter(entry, positiveRe, negativeRe); + const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative); + const patterns = { + positive: { + all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions) + }, + negative: { + absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })), + relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })) + } + }; + return (entry) => this._filter(entry, patterns); } - _filter(entry, positiveRe, negativeRe) { + _filter(entry, patterns) { const filepath = utils.path.removeLeadingDotSegment(entry.path); if (this._settings.unique && this._isDuplicateEntry(filepath)) { return false; @@ -6483,11 +6491,7 @@ class EntryFilter { if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { return false; } - if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) { - return false; - } - const isDirectory = entry.dirent.isDirectory(); - const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory); + const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory()); if (this._settings.unique && isMatched) { this._createIndexRecord(filepath); } @@ -6505,14 +6509,32 @@ class EntryFilter { _onlyDirectoryFilter(entry) { return this._settings.onlyDirectories && !entry.dirent.isDirectory(); } - _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { - if (!this._settings.absolute) { + _isMatchToPatternsSet(filepath, patterns, isDirectory) { + const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory); + if (!isMatched) { + return false; + } + const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory); + if (isMatchedByRelativeNegative) { + return false; + } + const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory); + if (isMatchedByAbsoluteNegative) { + return false; + } + return true; + } + _isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) { + if (patternsRe.length === 0) { return false; } - const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); - return utils.pattern.matchAny(fullpath, patternsRe); + const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath); + return this._isMatchToPatterns(fullpath, patternsRe, isDirectory); } _isMatchToPatterns(filepath, patternsRe, isDirectory) { + if (patternsRe.length === 0) { + return false; + } // Trying to match files and directories by patterns. const isMatched = utils.pattern.matchAny(filepath, patternsRe); // A pattern with a trailling slash can be used for directory matching. @@ -7254,7 +7276,7 @@ exports.convertPosixPathToPattern = convertPosixPathToPattern; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; +exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; const path = __nccwpck_require__(6928); const globParent = __nccwpck_require__(8188); const micromatch = __nccwpck_require__(8785); @@ -7440,6 +7462,24 @@ function removeDuplicateSlashes(pattern) { return pattern.replace(DOUBLE_SLASH_RE, '/'); } exports.removeDuplicateSlashes = removeDuplicateSlashes; +function partitionAbsoluteAndRelative(patterns) { + const absolute = []; + const relative = []; + for (const pattern of patterns) { + if (isAbsolute(pattern)) { + absolute.push(pattern); + } + else { + relative.push(pattern); + } + } + return [absolute, relative]; +} +exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative; +function isAbsolute(pattern) { + return path.isAbsolute(pattern); +} +exports.isAbsolute = isAbsolute; /***/ }), @@ -7782,19 +7822,19 @@ function queueAsPromised (context, worker, _concurrency) { } function drained () { - if (queue.idle()) { - return new Promise(function (resolve) { - resolve() - }) - } - - var previousDrain = queue.drain - var p = new Promise(function (resolve) { - queue.drain = function () { - previousDrain() - resolve() - } + process.nextTick(function () { + if (queue.idle()) { + resolve() + } else { + var previousDrain = queue.drain + queue.drain = function () { + if (typeof previousDrain === 'function') previousDrain() + resolve() + queue.drain = previousDrain + } + } + }) }) return p @@ -31693,7 +31733,7 @@ module.exports = { const { parseSetCookie } = __nccwpck_require__(8915) -const { stringify, getHeadersList } = __nccwpck_require__(3834) +const { stringify } = __nccwpck_require__(3834) const { webidl } = __nccwpck_require__(4222) const { Headers } = __nccwpck_require__(6349) @@ -31769,14 +31809,13 @@ function getSetCookies (headers) { webidl.brandCheck(headers, Headers, { strict: false }) - const cookies = getHeadersList(headers).cookies + const cookies = headers.getSetCookie() if (!cookies) { return [] } - // In older versions of undici, cookies is a list of name:value. - return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair)) + return cookies.map((pair) => parseSetCookie(pair)) } /** @@ -32204,14 +32243,15 @@ module.exports = { /***/ }), /***/ 3834: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ ((module) => { "use strict"; -const assert = __nccwpck_require__(2613) -const { kHeadersList } = __nccwpck_require__(6443) - +/** + * @param {string} value + * @returns {boolean} + */ function isCTLExcludingHtab (value) { if (value.length === 0) { return false @@ -32472,31 +32512,13 @@ function stringify (cookie) { return out.join('; ') } -let kHeadersListNode - -function getHeadersList (headers) { - if (headers[kHeadersList]) { - return headers[kHeadersList] - } - - if (!kHeadersListNode) { - kHeadersListNode = Object.getOwnPropertySymbols(headers).find( - (symbol) => symbol.description === 'headers list' - ) - - assert(kHeadersListNode, 'Headers cannot be parsed') - } - - const headersList = headers[kHeadersListNode] - assert(headersList) - - return headersList -} - module.exports = { isCTLExcludingHtab, - stringify, - getHeadersList + validateCookieName, + validateCookiePath, + validateCookieValue, + toIMFDate, + stringify } @@ -34425,6 +34447,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(8253) const { File: UndiciFile } = __nccwpck_require__(3041) const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(4322) +let random +try { + const crypto = __nccwpck_require__(7598) + random = (max) => crypto.randomInt(0, max) +} catch { + random = (max) => Math.floor(Math.random(max)) +} + let ReadableStream = globalThis.ReadableStream /** @type {globalThis['File']} */ @@ -34510,7 +34540,7 @@ function extractBody (object, keepalive = false) { // Set source to a copy of the bytes held by object. source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength)) } else if (util.isFormDataLike(object)) { - const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}` + const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}` const prefix = `--${boundary}\r\nContent-Disposition: form-data` /*! formdata-polyfill. MIT License. Jimmy Wärting */ @@ -36492,6 +36522,7 @@ const { isValidHeaderName, isValidHeaderValue } = __nccwpck_require__(5523) +const util = __nccwpck_require__(9023) const { webidl } = __nccwpck_require__(4222) const assert = __nccwpck_require__(2613) @@ -37045,6 +37076,9 @@ Object.defineProperties(Headers.prototype, { [Symbol.toStringTag]: { value: 'Headers', configurable: true + }, + [util.inspect.custom]: { + enumerable: false } }) @@ -46221,6 +46255,20 @@ class Pool extends PoolBase { ? { ...options.interceptors } : undefined this[kFactory] = factory + + this.on('connectionError', (origin, targets, error) => { + // If a connection error occurs, we remove the client from the pool, + // and emit a connectionError event. They will not be re-used. + // Fixes https://github.com/nodejs/undici/issues/3895 + for (const target of targets) { + // Do not use kRemoveClient here, as it will close the client, + // but the client cannot be closed in this state. + const idx = this[kClients].indexOf(target) + if (idx !== -1) { + this[kClients].splice(idx, 1) + } + } + }) } [kGetDispatcher] () { @@ -48629,6 +48677,14 @@ module.exports = require("net"); /***/ }), +/***/ 7598: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:crypto"); + +/***/ }), + /***/ 8474: /***/ ((module) => { @@ -58724,6 +58780,8 @@ var __webpack_exports__ = {}; const core = __nccwpck_require__(7484); const { "main": markdownlintCli2 } = __nccwpck_require__(2039); +const fs = __nccwpck_require__(3024); +const path = __nccwpck_require__(6760); const logMessage = core.info; const outputFormatter = (options) => { @@ -58769,6 +58827,38 @@ const outputFormatter = (options) => { } }; +const makeFileFormatter = (destPath) => (options) => { + const { results, logMessage } = options; + + const findings = results.map((r) => ({ + file: r.fileName, + line: r.lineNumber, + column: r.errorRange ? r.errorRange[0] : null, + endColumn: r.errorRange ? r.errorRange[0] + r.errorRange[1] - 1 : null, + rule: r.ruleNames.join("/"), + rulePrimary: r.ruleNames[0], + description: r.ruleDescription, + detail: r.errorDetail || null, + context: r.errorContext || null, + infoUrl: r.ruleInformation || null + })); + + const outFile = path.resolve(destPath); + try { + fs.mkdirSync(path.dirname(outFile), { recursive: true }); + const payload = { + tool: "markdownlint-cli2", + version: 1, + count: findings.length, + results: findings + }; + fs.writeFileSync(outFile, JSON.stringify(payload, null, 2)); + logMessage(`Wrote markdownlint results to: ${outFile} (${findings.length} issues)`); + } catch (e) { + core.warning(`Failed to write results file: ${e instanceof Error ? e.message : String(e)}`); + } +}; + const separator = core.getInput("separator") || "\n"; const argv = core.getInput("globs"). @@ -58784,11 +58874,21 @@ if (fix) { argv.push("--fix"); } +const outputFormatters = [ [ outputFormatter ] ]; + +const resultsFile = core.getInput("results_file"); +if (resultsFile && resultsFile.length > 0) { + core.info(`Markdown lint report will be recorded in file ${resultsFile}`) + outputFormatters.push([ makeFileFormatter(resultsFile) ]); +} else { + core.info(`Markdown lint creating file report skipped`) +} + const parameters = { argv, logMessage, "optionsOverride": { - "outputFormatters": [ [ outputFormatter ] ] + "outputFormatters": outputFormatters } }; markdownlintCli2(parameters).then( diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 5334515..7e0e736 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -67,7 +67,7 @@ const makeFileFormatter = (destPath) => (options) => { infoUrl: r.ruleInformation || null })); - const outFile = path.resolve(destPath || "markdownlint-results.json"); + const outFile = path.resolve(destPath); try { fs.mkdirSync(path.dirname(outFile), { recursive: true }); const payload = { @@ -98,18 +98,16 @@ if (fix) { argv.push("--fix"); } -const outputFormatters = [[ outputFormatter ]] +const outputFormatters = [ [ outputFormatter ] ]; -const resultsFile = - core.getInput("results_file") || - process.env.MARKDOWNLINT_RESULTS_FILE || - "markdownlint-results.json"; +const resultsFile = core.getInput("results_file"); if (resultsFile && resultsFile.length > 0) { - outputFormatters.push([makeFileFormatter(resultsFile)]) + core.info(`Markdown lint report will be recorded in file ${resultsFile}`) + outputFormatters.push([ makeFileFormatter(resultsFile) ]); +} else { + core.info(`Markdown lint creating file report skipped`) } -logMessage(`Formatters: ${outputFormatters.length}`) - const parameters = { argv, logMessage, From 492ae7fdd2190dbf98e26752fd43ca5f677583e7 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Sat, 16 Aug 2025 14:33:49 +0300 Subject: [PATCH 09/14] devplm-4524 lint fixes --- dist/index.js | 34 +++++++++++++++++----------------- markdownlint-cli2-action.js | 32 ++++++++++++++++---------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/dist/index.js b/dist/index.js index 346b487..e5dc8cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -58827,23 +58827,23 @@ const outputFormatter = (options) => { } }; -const makeFileFormatter = (destPath) => (options) => { - const { results, logMessage } = options; - - const findings = results.map((r) => ({ - file: r.fileName, - line: r.lineNumber, - column: r.errorRange ? r.errorRange[0] : null, - endColumn: r.errorRange ? r.errorRange[0] + r.errorRange[1] - 1 : null, - rule: r.ruleNames.join("/"), - rulePrimary: r.ruleNames[0], - description: r.ruleDescription, - detail: r.errorDetail || null, - context: r.errorContext || null, - infoUrl: r.ruleInformation || null +const makeFileFormatter = (destinationPath) => (options) => { + const { results } = options; + + const findings = results.map((reportItem) => ({ + 'file': reportItem.fileName, + 'line': reportItem.lineNumber, + 'column': reportItem.errorRange ? reportItem.errorRange[0] : null, + 'endColumn': reportItem.errorRange ? reportItem.errorRange[0] + reportItem.errorRange[1] - 1 : null, + 'rule': reportItem.ruleNames.join("/"), + 'rulePrimary': reportItem.ruleNames[0], + 'description': reportItem.ruleDescription, + 'detail': reportItem.errorDetail || null, + 'context': reportItem.errorContext || null, + 'infoUrl': reportItem.ruleInformation || null })); - const outFile = path.resolve(destPath); + const outFile = path.resolve(destinationPath); try { fs.mkdirSync(path.dirname(outFile), { recursive: true }); const payload = { @@ -58878,10 +58878,10 @@ const outputFormatters = [ [ outputFormatter ] ]; const resultsFile = core.getInput("results_file"); if (resultsFile && resultsFile.length > 0) { - core.info(`Markdown lint report will be recorded in file ${resultsFile}`) + logMessage(`Markdown lint report will be recorded in file ${resultsFile}`) outputFormatters.push([ makeFileFormatter(resultsFile) ]); } else { - core.info(`Markdown lint creating file report skipped`) + logMessage(`Markdown lint creating file report skipped`) } const parameters = { diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 7e0e736..83da96b 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -51,23 +51,23 @@ const outputFormatter = (options) => { } }; -const makeFileFormatter = (destPath) => (options) => { - const { results, logMessage } = options; +const makeFileFormatter = (destinationPath) => (options) => { + const { results } = options; - const findings = results.map((r) => ({ - file: r.fileName, - line: r.lineNumber, - column: r.errorRange ? r.errorRange[0] : null, - endColumn: r.errorRange ? r.errorRange[0] + r.errorRange[1] - 1 : null, - rule: r.ruleNames.join("/"), - rulePrimary: r.ruleNames[0], - description: r.ruleDescription, - detail: r.errorDetail || null, - context: r.errorContext || null, - infoUrl: r.ruleInformation || null + const findings = results.map((reportItem) => ({ + 'file': reportItem.fileName, + 'line': reportItem.lineNumber, + 'column': reportItem.errorRange ? reportItem.errorRange[0] : null, + 'endColumn': reportItem.errorRange ? reportItem.errorRange[0] + reportItem.errorRange[1] - 1 : null, + 'rule': reportItem.ruleNames.join("/"), + 'rulePrimary': reportItem.ruleNames[0], + 'description': reportItem.ruleDescription, + 'detail': reportItem.errorDetail || null, + 'context': reportItem.errorContext || null, + 'infoUrl': reportItem.ruleInformation || null })); - const outFile = path.resolve(destPath); + const outFile = path.resolve(destinationPath); try { fs.mkdirSync(path.dirname(outFile), { recursive: true }); const payload = { @@ -102,10 +102,10 @@ const outputFormatters = [ [ outputFormatter ] ]; const resultsFile = core.getInput("results_file"); if (resultsFile && resultsFile.length > 0) { - core.info(`Markdown lint report will be recorded in file ${resultsFile}`) + logMessage(`Markdown lint report will be recorded in file ${resultsFile}`) outputFormatters.push([ makeFileFormatter(resultsFile) ]); } else { - core.info(`Markdown lint creating file report skipped`) + logMessage(`Markdown lint creating file report skipped`) } const parameters = { From 9e899db14e41139b46c29a6fa6428a0bb2270809 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Sat, 16 Aug 2025 14:36:56 +0300 Subject: [PATCH 10/14] devplm-4524 lint fixes --- markdownlint-cli2-action.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 83da96b..52be654 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -55,16 +55,16 @@ const makeFileFormatter = (destinationPath) => (options) => { const { results } = options; const findings = results.map((reportItem) => ({ - 'file': reportItem.fileName, - 'line': reportItem.lineNumber, - 'column': reportItem.errorRange ? reportItem.errorRange[0] : null, - 'endColumn': reportItem.errorRange ? reportItem.errorRange[0] + reportItem.errorRange[1] - 1 : null, - 'rule': reportItem.ruleNames.join("/"), - 'rulePrimary': reportItem.ruleNames[0], - 'description': reportItem.ruleDescription, - 'detail': reportItem.errorDetail || null, - 'context': reportItem.errorContext || null, - 'infoUrl': reportItem.ruleInformation || null + "file": reportItem.fileName, + "line": reportItem.lineNumber, + "column": reportItem.errorRange ? reportItem.errorRange[0] : null, + "endColumn": reportItem.errorRange ? reportItem.errorRange[0] + reportItem.errorRange[1] - 1 : null, + "rule": reportItem.ruleNames.join("/"), + "rulePrimary": reportItem.ruleNames[0], + "description": reportItem.ruleDescription, + "detail": reportItem.errorDetail || null, + "context": reportItem.errorContext || null, + "infoUrl": reportItem.ruleInformation || null })); const outFile = path.resolve(destinationPath); From 797edb250d2cab387556971f6c73bc450b6d4c30 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Tue, 19 Aug 2025 10:58:21 +0300 Subject: [PATCH 11/14] devplm-4524 lint fixes --- markdownlint-cli2-action.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 52be654..e66d877 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -69,12 +69,12 @@ const makeFileFormatter = (destinationPath) => (options) => { const outFile = path.resolve(destinationPath); try { - fs.mkdirSync(path.dirname(outFile), { recursive: true }); + fs.mkdirSync(path.dirname(outFile), { "recursive": true }); const payload = { - tool: "markdownlint-cli2", - version: 1, - count: findings.length, - results: findings + "tool": "markdownlint-cli2", + "version": 1, + "count": findings.length, + "results": findings }; fs.writeFileSync(outFile, JSON.stringify(payload, null, 2)); logMessage(`Wrote markdownlint results to: ${outFile} (${findings.length} issues)`); From 8e66c32259190e95c8ccf5968cc8a956a15a17d1 Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Tue, 19 Aug 2025 11:36:19 +0300 Subject: [PATCH 12/14] devplm-4524 lint fixes --- markdownlint-cli2-action.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index e66d877..2bb6d07 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -78,8 +78,8 @@ const makeFileFormatter = (destinationPath) => (options) => { }; fs.writeFileSync(outFile, JSON.stringify(payload, null, 2)); logMessage(`Wrote markdownlint results to: ${outFile} (${findings.length} issues)`); - } catch (e) { - core.warning(`Failed to write results file: ${e instanceof Error ? e.message : String(e)}`); + } catch (err) { + core.warning(`Failed to write results file: ${err instanceof Error ? err.message : String(err)}`); } }; From aa18477b88210a8b23c9e308968cef57007d0cfa Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Tue, 19 Aug 2025 11:39:35 +0300 Subject: [PATCH 13/14] devplm-4524 lint fixes --- markdownlint-cli2-action.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 2bb6d07..6442be7 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -78,8 +78,8 @@ const makeFileFormatter = (destinationPath) => (options) => { }; fs.writeFileSync(outFile, JSON.stringify(payload, null, 2)); logMessage(`Wrote markdownlint results to: ${outFile} (${findings.length} issues)`); - } catch (err) { - core.warning(`Failed to write results file: ${err instanceof Error ? err.message : String(err)}`); + } catch (error) { + core.warning(`Failed to write results file: ${error instanceof Error ? error.message : String(error)}`); } }; From 724c033a8d5cce1827217dcb8553e3112556206a Mon Sep 17 00:00:00 2001 From: "andrey.shlygin" Date: Tue, 19 Aug 2025 11:44:49 +0300 Subject: [PATCH 14/14] devplm-4524 lint fixes --- markdownlint-cli2-action.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markdownlint-cli2-action.js b/markdownlint-cli2-action.js index 6442be7..8ba224c 100644 --- a/markdownlint-cli2-action.js +++ b/markdownlint-cli2-action.js @@ -102,10 +102,10 @@ const outputFormatters = [ [ outputFormatter ] ]; const resultsFile = core.getInput("results_file"); if (resultsFile && resultsFile.length > 0) { - logMessage(`Markdown lint report will be recorded in file ${resultsFile}`) + logMessage(`Markdown lint report will be recorded in file ${resultsFile}`); outputFormatters.push([ makeFileFormatter(resultsFile) ]); } else { - logMessage(`Markdown lint creating file report skipped`) + logMessage(`Markdown lint creating file report skipped`); } const parameters = {