Skip to content

Commit f51c583

Browse files
authored
fix(loaders): missing promise (#210)
1 parent 05baf7b commit f51c583

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

bin/cli.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const linter = createLinter(lintDryRun, disableRule);
108108
const { loadFiles } = createMarkdownLoader();
109109
const { parseApiDocs } = createMarkdownParser();
110110

111-
const apiDocFiles = loadFiles(input, ignore);
111+
const apiDocFiles = await loadFiles(input, ignore);
112112

113113
const parsedApiDocs = await parseApiDocs(apiDocFiles);
114114

src/loaders/markdown.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const createLoader = () => {
2222
*
2323
* @see https://code.visualstudio.com/docs/editor/glob-patterns
2424
*/
25-
const loadFiles = (searchPath, ignorePath) => {
25+
const loadFiles = async (searchPath, ignorePath) => {
2626
const ignoredFiles = ignorePath
2727
? globSync(ignorePath).filter(filePath => extname(filePath) === '.md')
2828
: [];
@@ -32,11 +32,13 @@ const createLoader = () => {
3232
extname(filePath) === '.md' && !ignoredFiles.includes(filePath)
3333
);
3434

35-
return resolvedFiles.map(async filePath => {
36-
const fileContents = await readFile(filePath, 'utf-8');
35+
return Promise.all(
36+
resolvedFiles.map(async filePath => {
37+
const fileContents = await readFile(filePath, 'utf-8');
3738

38-
return new VFile({ path: filePath, value: fileContents });
39-
});
39+
return new VFile({ path: filePath, value: fileContents });
40+
})
41+
);
4042
};
4143

4244
return { loadFiles };

0 commit comments

Comments
 (0)