Skip to content

Commit

Permalink
feat: markdownlint script ignoring errors
Browse files Browse the repository at this point in the history
  • Loading branch information
undead404 committed Jun 21, 2024
1 parent 5e65301 commit 7d67364
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"*.js": ["eslint --quiet --fix"],
"*.md": [
"markdownlint-cli2 || true",
"node scripts/markdownlint.js",
"node scripts/front-matter_linter.js --fix true",
"prettier --write --ignore-unknown"
],
Expand Down
19 changes: 19 additions & 0 deletions scripts/markdownlint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { exec } from "child_process";

const IGNORE_PARAMS = 2;
// Get all arguments
const parameters = process.argv.slice(IGNORE_PARAMS).join(" ");

// Execute the command with arguments
// eslint-disable-next-line security/detect-child-process
exec(`markdownlint-cli2 ${parameters}`, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});

0 comments on commit 7d67364

Please sign in to comment.