Skip to content

Commit a918030

Browse files
committed
is this the new import
1 parent 8e09258 commit a918030

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/validate.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
import markdownIt from "markdown-it";
2-
import markdownlint from "markdownlint";
2+
import { lint } from "markdownlint/sync";
33
import yaml from "js-yaml";
44
const markdownItFactory = () => markdownIt({ html: true });
55

66
export const validate = (markdown, config) => {
77
const configObject = yaml.load(config);
88
return (
9-
markdownlint
10-
.sync({
11-
strings: {
12-
content: markdown,
13-
},
14-
config: config
15-
? { default: false, ...configObject }
16-
: {
17-
default: false,
18-
"no-default-alt-text": true,
19-
"no-alt-text": true,
20-
"no-empty-alt-text": true,
21-
},
22-
handleRuleFailures: true,
23-
markdownItFactory,
24-
customRules: ["@github/markdownlint-github"],
25-
})
26-
.content?.map((error) => {
27-
return `- ${error.ruleDescription} at line ${error.lineNumber}`;
28-
}) ?? []
9+
lint({
10+
strings: {
11+
content: markdown,
12+
},
13+
config: config
14+
? { default: false, ...configObject }
15+
: {
16+
default: false,
17+
"no-default-alt-text": true,
18+
"no-alt-text": true,
19+
"no-empty-alt-text": true,
20+
},
21+
handleRuleFailures: true,
22+
markdownItFactory,
23+
customRules: ["@github/markdownlint-github"],
24+
}).content?.map((error) => {
25+
return `- ${error.ruleDescription} at line ${error.lineNumber}`;
26+
}) ?? []
2927
).join("\n");
3028
};

0 commit comments

Comments
 (0)