diff --git a/scripts/markdown-js-snippets-linter.mjs b/scripts/markdown-js-snippets-linter.mjs index 123e56606..5f8be78cf 100644 --- a/scripts/markdown-js-snippets-linter.mjs +++ b/scripts/markdown-js-snippets-linter.mjs @@ -1,6 +1,10 @@ -import { promises as fs } from 'fs'; -import { glob } from 'glob'; - +// const fs = require('fs').promises; +import {promises as fs} from 'fs'; +import glob from 'glob'; +import util from 'util'; +// const glob = require('glob'); +// const util = require('util'); +const globPromise = util.promisify(glob); const extractJsSnippets = (markdownContent) => { const pattern = /```(?:js|javascript)\n([\s\S]*?)```/g; @@ -163,7 +167,7 @@ const lintMarkdownFile = async (filePath, fix = false) => { }; const processFiles = async (globPattern, fix = false) => { try { - const files = await glob(globPattern); + const files = await globPromise(globPattern); if (files.length === 0) { console.error('No files found matching the pattern.'); process.exit(1);