diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..c56faac7 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,21 @@ +output: + - summary + - failure +pre-commit: + parallel: true + jobs: + - name: format + glob: "**/*.{ts,tsx}" + run: yarn --silent format {staged_files} + stage_fixed: true + + - name: lint + glob: "**/*.{ts,tsx}" + run: yarn --silent lint {staged_files} + stage_fixed: true + + - name: typecheck + run: yarn --silent typeCheck --pretty false + + - name: test + run: yarn --silent test diff --git a/package.json b/package.json index 50755e82..7f27490e 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,8 @@ "lint": "eslint \"src/**/*{.tsx, .ts}\" --quiet --fix", "test": "vitest run", "dev": "npx concurrently \"npx netlify-cms-proxy-server\" \"npm start -- --progress\"", - "typeCheck": "npx tsc -noEmit" + "typeCheck": "tsc --noEmit", + "prepare": "lefthook install" }, "devDependencies": { "@eslint/js": "^9.38.0", @@ -74,6 +75,7 @@ "gatsby-plugin-postcss": "^6.13.1", "globals": "^16.4.0", "jiti": "^2.6.1", + "lefthook": "^2.0.15", "netlify-cli": "^17.15.7", "postcss": "^8.4.35", "prettier": "^3.6.2", diff --git a/src/hooks/useWidthBreakpoint.ts b/src/hooks/useWidthBreakpoint.ts index a61ba72d..23da516c 100644 --- a/src/hooks/useWidthBreakpoint.ts +++ b/src/hooks/useWidthBreakpoint.ts @@ -1,14 +1,14 @@ import { PHONE_BREAKPOINT, TABLET_BREAKPOINT } from "../constants"; import useWindowWidth from "./useWindowWidth"; -export const useMaxWidthBreakpoint = ( - breakpoint: number -): boolean => { +export const useMaxWidthBreakpoint = (breakpoint: number): boolean => { const windowWidth = useWindowWidth(); - return windowWidth < breakpoint + return windowWidth < breakpoint; }; -export const useMobileBreakpoint = () => useMaxWidthBreakpoint(PHONE_BREAKPOINT); -export const useTabletBreakpoint = () => useMaxWidthBreakpoint(TABLET_BREAKPOINT); +export const useMobileBreakpoint = () => + useMaxWidthBreakpoint(PHONE_BREAKPOINT); +export const useTabletBreakpoint = () => + useMaxWidthBreakpoint(TABLET_BREAKPOINT); export default useMaxWidthBreakpoint; diff --git a/yarn.lock b/yarn.lock index 80847af1..bf6eed55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13415,6 +13415,72 @@ lazystream@^1.0.0: dependencies: readable-stream "^2.0.5" +lefthook-darwin-arm64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-darwin-arm64/-/lefthook-darwin-arm64-2.0.15.tgz#21c2aac653e9ad4dbd928c95bc1622825673d69e" + integrity sha512-ygAqG/NzOgY9bEiqeQtiOmCRTtp9AmOd3eyrpEaSrRB9V9f3RHRgWDrWbde9BiHSsCzcbeY9/X2NuKZ69eUsNA== + +lefthook-darwin-x64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-darwin-x64/-/lefthook-darwin-x64-2.0.15.tgz#24d18d5062fb7de19c7f11e531060089d9826e75" + integrity sha512-3wA30CzdSL5MFKD6dk7v8BMq7ScWQivpLbmIn3Pv67AaBavN57N/hcdGqOFnDDFI5WazVwDY7UqDfMIk5HZjEA== + +lefthook-freebsd-arm64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-2.0.15.tgz#c3e53d484c58641c84fd010a164b7560a5d8fc66" + integrity sha512-FbYBBLVbX8BjdO+icN1t/pC3TOW3FAvTKv/zggBKNihv6jHNn/3s/0j2xIS0k0Pw9oOE7MVmEni3qp2j5vqHrQ== + +lefthook-freebsd-x64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-freebsd-x64/-/lefthook-freebsd-x64-2.0.15.tgz#0fa903beb0d340c99d5eb400e2090d3b6da1e63b" + integrity sha512-udHMjh1E8TfC0Z7Y249XZMATJOyj1Jxlj9JoEinkoBvAsePFKDEQg5teuXuTGhjsHYpqVekfSvLNNfHKUUbbjw== + +lefthook-linux-arm64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-linux-arm64/-/lefthook-linux-arm64-2.0.15.tgz#9da1bbc60ef07034e69c715acedf8d48bfc6768e" + integrity sha512-1HAPmdYhfcOlubv63sTnWtW2rFuC+kT1MvC3JvdrS5V6zrOImbBSnYZMJX/Dd3w4pm0x2ZJb9T+uef8a0jUQkg== + +lefthook-linux-x64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-linux-x64/-/lefthook-linux-x64-2.0.15.tgz#b12aebd93fcf11f521dc5e40d9b7a2dece96b17a" + integrity sha512-Pho87mlNFH47zc4fPKzQSp8q9sWfIFW/KMMZfx/HZNmX25aUUTOqMyRwaXxtdAo/hNJ9FX4JeuZWq9Y3iyM5VA== + +lefthook-openbsd-arm64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-2.0.15.tgz#412dedf52f9f5b7925abe7b4bafc807cabde577e" + integrity sha512-pet03Edlj1QeFUgxcIK1xu8CeZA+ejYplvPgdfe//69+vQFGSDaEx3H2mVx8RqzWfmMbijM2/WfkZXR2EVw3bw== + +lefthook-openbsd-x64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-openbsd-x64/-/lefthook-openbsd-x64-2.0.15.tgz#a98ea91d40517d1233dd417a0ea9b0fda9f8201d" + integrity sha512-i+a364CcSAeIO5wQzLMHsthHt/v6n3XwhKmRq/VBzPOUv9KutNeF55yCE/6lvuvzwxpdEfBjh6cXPERC0yp98w== + +lefthook-windows-arm64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-windows-arm64/-/lefthook-windows-arm64-2.0.15.tgz#3eab319ca7a7a96685056e37a74b106853e30a97" + integrity sha512-69u5GdVOT4QIxc2TK5ce0cTXLzwB55Pk9ZnnJNFf1XsyZTGcg9bUWYYTyD12CIIXbVTa0RVXIIrbU9UgP8O1AQ== + +lefthook-windows-x64@2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook-windows-x64/-/lefthook-windows-x64-2.0.15.tgz#e379f4266cc03b292873fb988ad9f922d47df430" + integrity sha512-/zYEndCUgj8XK+4wvLYLRk3AcfKU6zWf2GHx+tcZ4K2bLaQdej4m+OqmQsVpUlF8N2tN9hfwlj1D50uz75LUuQ== + +lefthook@^2.0.15: + version "2.0.15" + resolved "https://registry.yarnpkg.com/lefthook/-/lefthook-2.0.15.tgz#e74d16135861dd8d852452fa43a469dfb474f3ea" + integrity sha512-sl5rePO6UUOLKp6Ci+MMKOc86zicBaPUCvSw2Cq4gCAgTmxpxhIjhz7LOu2ObYerVRPpTq3gvzPTjI71UotjnA== + optionalDependencies: + lefthook-darwin-arm64 "2.0.15" + lefthook-darwin-x64 "2.0.15" + lefthook-freebsd-arm64 "2.0.15" + lefthook-freebsd-x64 "2.0.15" + lefthook-linux-arm64 "2.0.15" + lefthook-linux-x64 "2.0.15" + lefthook-openbsd-arm64 "2.0.15" + lefthook-openbsd-x64 "2.0.15" + lefthook-windows-arm64 "2.0.15" + lefthook-windows-x64 "2.0.15" + lerc@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lerc/-/lerc-3.0.0.tgz#36f36fbd4ba46f0abf4833799fff2e7d6865f5cb"