Skip to content

Commit

Permalink
chore: improve lint:md-links script and workflow (#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya authored Jan 24, 2024
1 parent 50bf779 commit 66302d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .changeset/giant-melons-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
3 changes: 2 additions & 1 deletion .textlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"rules": {
"no-dead-link": {
"ignoreRedirects": true,
"checkRelative": false
"checkRelative": false,
"ignore": ["https://learnmeabitcoin.com/**"]
}
}
}
14 changes: 3 additions & 11 deletions scripts/lint-md-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@ import { globSync } from 'glob';
const mdFiles = globSync('**/*.md', {
ignore: [
'**/node_modules/**',
'apps/docs/src/api/**', // generated api
'**/CHANGELOG.md',
'apps/demo-nextjs/**',
'apps/demo-react-cra/**',
'apps/demo-react-vite/**',
'templates/**',
],
});
const filesWithLintErrors: string[] = [];
mdFiles.forEach((file) => {
try {
execSync(`pnpm textlint ${file}`).toString();
} catch (error) {
filesWithLintErrors.push(file);
}
});
if (filesWithLintErrors.length > 0) {
process.exit(1);
}

execSync(`pnpm textlint ${mdFiles.join(' ')} --parallel --debug`, { stdio: 'inherit' });
})();

0 comments on commit 66302d4

Please sign in to comment.