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

Commit

Permalink
chore: add pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Jan 17, 2024
1 parent 98e1b2f commit 79f1b08
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm -r exec lint-staged
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@commercelayer/eslint-config-ts-react": "^1.3.0",
"@testing-library/react": "^14.1.2",
"@types/lodash": "^4.14.202",
"@types/node": "^20.11.5",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/data/dictionaries/promotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ export const promotionDictionary = {
// HELPER

export function isPromotionType(
promotionType: any
promotionType: string
): promotionType is PromotionType {
return Object.keys(promotionDictionary).includes(promotionType)
}

export function isPromotionSlug(
promotionSlug: any
promotionSlug: (typeof promotionDictionary)[keyof typeof promotionDictionary]['slug']
): promotionSlug is PromotionSlug {
return Object.values(promotionDictionary)
.map((v) => v.slug)
Expand Down
14 changes: 6 additions & 8 deletions packages/app/src/data/route.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ type ErrorVariables<
: never]-?: 'Is not properly set.'
})

type ValidPath<
Variables extends Record<string, any>,
Path extends string
> = ErrorVariables<Variables, Path> extends never
? Path
: `Missing variable '${ErrorVariables<Variables, Path> extends string
? ErrorVariables<Variables, Path>
: 'unknown'}'`
type ValidPath<Variables extends Record<string, any>, Path extends string> =
ErrorVariables<Variables, Path> extends never
? Path
: `Missing variable '${ErrorVariables<Variables, Path> extends string
? ErrorVariables<Variables, Path>
: 'unknown'}'`
1 change: 1 addition & 0 deletions packages/app/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react'
import ReactDOM from 'react-dom/client'
import { App } from './App'

// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<App />
Expand Down
35 changes: 25 additions & 10 deletions pnpm-lock.yaml

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

0 comments on commit 79f1b08

Please sign in to comment.