Skip to content

Add Husky pre-commit and pre-push hooks for automated doc checks #1413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "🔍 Running automatic fixes before pushing..."
pnpm fix
echo "✅ Fixes applied - your contribution is now ready for review!"
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"fix": "eslint . --ext mdx --fix && pnpm spellcheck:fix && pnpm breadcrumbs && pnpm fix-redirects && pnpm metadata-batch-cli",
"spellcheck:lint": "cspell lint \"**/*.mdx\"",
"spellcheck:fix": "cspell --words-only --unique \"**/*.mdx\" | sort --ignore-case | uniq > words.txt",
"breadcrumbs": "NODE_NO_WARNINGS=1 npx ts-node-esm --skip-project utils/create-breadcrumbs.ts",
"breadcrumbs": "NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/create-breadcrumbs.ts",
"check-breadcrumbs": "NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/breadcrumbs.ts",
"check-redirects": "NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/redirects.ts",
"fix-redirects": "NODE_NO_WARNINGS=1 node --loader ts-node/esm utils/fix-redirects.ts",
Expand All @@ -34,6 +34,7 @@
"clsx": "^2.1.1",
"dotenv": "^16.4.7",
"escape-string-regexp": "^5.0.0",
"glob": "^11.0.1",
"js-yaml": "^4.1.0",
"next": "14.2.21",
"next-sitemap": "^4.2.3",
Expand All @@ -50,6 +51,7 @@
"@eth-optimism/core-utils": "^0.13.1",
"@eth-optimism/sdk": "^3.1.6",
"@types/dotenv": "^8.2.3",
"@types/glob": "^8.1.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "18.11.10",
"cspell": "^8.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Here you'll estimate the cost of a simple transaction that sends a small amount
</Steps>

<Callout type="info">
Estimates will never be entirely accurate due to network conditions and gas price fluctuations, but they should be close to the actual costs.
Estimates will never be entirely accurate due to network conditions and gas price fluctuation, but they should be close to the actual costs.
</Callout>

## Next steps
Expand Down
99 changes: 87 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion utils/create-breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs/promises';
import * as path from 'path';
import matter from 'gray-matter';

const rootDir: string = path.join(__dirname, '..', 'pages');
const rootDir = path.join(process.cwd(), 'pages');

interface FileInfo {
title: string;
Expand Down
3 changes: 0 additions & 3 deletions utils/fix-redirects.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env node
// Save this file as utils/fix-redirects.ts

import * as fs from 'fs/promises';
import * as path from 'path';

Expand Down