Skip to content

Commit

Permalink
Attempt to fix polynomial regular expression warning in formatter-tem…
Browse files Browse the repository at this point in the history
…plate by making the pattern more explicit.
  • Loading branch information
DavidAnson committed Nov 9, 2024
1 parent 358d2dc commit f4462c6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion formatter-template/markdownlint-cli2-formatter-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"use strict";

// eslint-disable-next-line prefer-named-capture-group
const tokenRe = /\$\{([^:!}]+)(?:([:!])([^{}]*\{[^{}]+\}[^{}]*|[^}]+))?\}/igu;
const tokenRe = /\$\{(fileName|lineNumber|columnNumber|ruleName|ruleDescription|ruleInformation|errorContext|errorDetail)(?:([:!])([^{}]*\{[^{}]+\}[^{}]*|[^}]+))?\}/igu;

// Output markdownlint-cli2 results using a template
const outputFormatter = (options, params) => {
Expand Down
10 changes: 5 additions & 5 deletions test/snapshots/markdownlint-cli2-test-exec.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -5139,11 +5139,11 @@ Generated by [AVA](https://avajs.dev).
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=6;code=MD025/single-title/single-h1]Multiple top-level headings in the same document␊
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=12;columnumber=4;code=MD019/no-multiple-space-atx]Multiple spaces after hash on atx style heading␊
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=14;columnumber=14;code=MD047/single-trailing-newline]Files should end with a single newline character␊
#Undefined=#Column=10#Column=10##Column=10#␊
#Undefined=#Column=##No column number#No column number#␊
#Undefined=#Column=##No column number#No column number#␊
#Undefined=#Column=4#Column=4##Column=4#␊
#Undefined=#Column=14#Column=14##Column=14#`,
#Undefined=${undefined}#Column=10#Column=10##Column=10#␊
#Undefined=${undefined}#Column=##No column number#No column number#␊
#Undefined=${undefined}#Column=##No column number#No column number#␊
#Undefined=${undefined}#Column=4#Column=4##Column=4#␊
#Undefined=${undefined}#Column=14#Column=14##Column=14#`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: **/*.md␊
Linting: 1 file(s)␊
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-exec.js.snap
Binary file not shown.
10 changes: 5 additions & 5 deletions test/snapshots/markdownlint-cli2-test-main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -4377,11 +4377,11 @@ Generated by [AVA](https://avajs.dev).
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=6;code=MD025/single-title/single-h1]Multiple top-level headings in the same document␊
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=12;columnumber=4;code=MD019/no-multiple-space-atx]Multiple spaces after hash on atx style heading␊
##vso[task.logissue type=error;sourcepath=viewme.md;linenumber=14;columnumber=14;code=MD047/single-trailing-newline]Files should end with a single newline character␊
#Undefined=#Column=10#Column=10##Column=10#␊
#Undefined=#Column=##No column number#No column number#␊
#Undefined=#Column=##No column number#No column number#␊
#Undefined=#Column=4#Column=4##Column=4#␊
#Undefined=#Column=14#Column=14##Column=14#␊
#Undefined=${undefined}#Column=10#Column=10##Column=10#␊
#Undefined=${undefined}#Column=##No column number#No column number#␊
#Undefined=${undefined}#Column=##No column number#No column number#␊
#Undefined=${undefined}#Column=4#Column=4##Column=4#␊
#Undefined=${undefined}#Column=14#Column=14##Column=14#␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: **/*.md␊
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-main.js.snap
Binary file not shown.

0 comments on commit f4462c6

Please sign in to comment.