Skip to content

Commit

Permalink
chore: adjust custom lint script
Browse files Browse the repository at this point in the history
  • Loading branch information
mujahidkay committed Oct 3, 2024
1 parent 8b43767 commit 259aac9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/markdown-js-snippets-linter.mjs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 259aac9

Please sign in to comment.