Skip to content

Commit 4ec5309

Browse files
committed
add husky to check before commiting
1 parent 03baa2f commit 4ec5309

File tree

7 files changed

+40
-8
lines changed

7 files changed

+40
-8
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
echo "▶ Running Prettier..."
3+
npx lint-staged
4+

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.mdx",
1717
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx,.mdx --fix",
1818
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md,mdx}\"",
19-
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,md,mdx}\""
19+
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,md,mdx}\"",
20+
"prepare": "husky"
2021
},
2122
"dependencies": {
2223
"@docusaurus/core": "3.7.0",
@@ -39,13 +40,22 @@
3940
"@docusaurus/module-type-aliases": "3.7.0",
4041
"@docusaurus/types": "3.7.0",
4142
"eslint": "^8.57.1",
43+
"eslint-config-prettier": "^9.1.0",
4244
"eslint-plugin-import": "^2.32.0",
4345
"eslint-plugin-mdx": "^3.6.2",
44-
"eslint-config-prettier": "^9.1.0",
4546
"eslint-plugin-prettier": "^5.1.3",
4647
"eslint-plugin-react": "^7.34.1",
48+
"husky": "^9.1.7",
4749
"prettier": "^3.2.5"
48-
50+
},
51+
"lint-staged": {
52+
"*.{js,jsx,ts,tsx}": [
53+
"prettier --write",
54+
"eslint --fix"
55+
],
56+
"*.{md,mdx,json}": [
57+
"prettier --write"
58+
]
4959
},
5060
"browserslist": {
5161
"production": [

src/components/StarRepo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const StarRepo = () => {
1717
useEffect(() => {
1818
if (isBrowser && itemId) {
1919
const starredItems = JSON.parse(
20-
localStorage.getItem("starredItems") || "[]"
20+
localStorage.getItem("starredItems") || "[]",
2121
);
2222
setIsStarred(starredItems.includes(itemId));
2323
}

src/components/TreeTraversal/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function TreeVisualization() {
7676
const currentNode = tree.find((n) => n.id === traversalSteps[nextStep]);
7777
if (currentNode) {
7878
const parentNode = tree.find(
79-
(n) => n.left === currentNode.id || n.right === currentNode.id
79+
(n) => n.left === currentNode.id || n.right === currentNode.id,
8080
);
8181
if (parentNode) {
8282
setActivePath(`${parentNode.id}-${currentNode.id}`);

src/pages/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export default function Home() {
3434
return (
3535
<Layout
3636
title={`MetaCall Documentation`}
37-
description="Description will go into a meta tag in <head />">
37+
description="Description will go into a meta tag in <head />"
38+
>
3839
<HomepageHeader />
3940
<main>
4041
<HomepageFeatures />

src/pages/starred.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ const StarredPage = () => {
2626

2727
// Get all docs from all versions
2828
const allDocs = Object.values(allDocsData).flatMap((versionData) =>
29-
versionData.versions.flatMap((v) => v.docs)
29+
versionData.versions.flatMap((v) => v.docs),
3030
);
3131

3232
const starredDocs = allDocs.filter((doc) =>
33-
starredItems.includes(doc.unversionedId || doc.id)
33+
starredItems.includes(doc.unversionedId || doc.id),
3434
);
3535

3636
return (

0 commit comments

Comments
 (0)