Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
add pre-commit hook to check for mdx formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliotFriend committed Dec 14, 2023
1 parent 16c485f commit 9f2df3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

G='\033[0;32m'
P='\033[0;35m'
CLEAN='\033[0;0m'

yarn run check:mdx || (echo -e "${G}Hint:${CLEAN} execute ${P}yarn format:mdx${CLEAN} to format files" && exit 1)
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"check:mdx": "prettier --prose-wrap preserve --check \"docs/**/*.{md,mdx}\"",
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"prepare": "husky install",
"postinstall": "patch-package"
},
"dependencies": {
Expand Down Expand Up @@ -74,6 +75,7 @@
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-jsdoc": "^46.4.4",
"eslint-plugin-prefer-arrow": "^1.2.3",
"husky": "^8.0.3",
"mdast-util-to-markdown": "^1.4.0",
"prettier": "^3.0.0",
"react-player": "^2.12.0",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7077,6 +7077,11 @@ human-signals@^2.1.0:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==

husky@^8.0.3:
version "8.0.3"
resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184"
integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==

hyphenate-style-name@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d"
Expand Down

0 comments on commit 9f2df3c

Please sign in to comment.