add husky

This commit is contained in:
vchikalkin 2024-11-27 21:24:09 +03:00
parent a6aa9e4b04
commit ed239ea830
6 changed files with 26 additions and 61 deletions

1
.husky/pre-commit Normal file
View File

@ -0,0 +1 @@
npm run lint

View File

@ -7,7 +7,7 @@
"dev": "next dev --turbopack", "dev": "next dev --turbopack",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint --max-warnings 0", "lint": "next lint",
"check-types": "tsc --noEmit" "check-types": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {

View File

@ -4,10 +4,11 @@
"scripts": { "scripts": {
"build": "turbo build", "build": "turbo build",
"dev": "turbo dev", "dev": "turbo dev",
"lint": "turbo lint", "lint": "turbo lint -- --fix --max-warnings 0",
"format": "prettier --end-of-line lf --write \"**/*.{ts,tsx,md,mjs}\"" "format": "prettier --end-of-line lf --write \"**/*.{ts,tsx,md,mjs}\""
}, },
"devDependencies": { "devDependencies": {
"husky": "^9.1.7",
"prettier": "catalog:", "prettier": "catalog:",
"turbo": "catalog:", "turbo": "catalog:",
"typescript": "catalog:" "typescript": "catalog:"

View File

@ -22,7 +22,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"ui": "pnpm dlx shadcn@latest", "ui": "pnpm dlx shadcn@latest",
"lint": "eslint src/", "lint": "eslint",
"type-check": "tsc --noEmit" "type-check": "tsc --noEmit"
}, },
"devDependencies": { "devDependencies": {

View File

@ -19,11 +19,14 @@ const buttonVariants = cva(
}, },
variant: { variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90', default: 'bg-primary text-primary-foreground hover:bg-primary/90',
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90', destructive:
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
ghost: 'hover:bg-accent hover:text-accent-foreground', ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline', link: 'text-primary underline-offset-4 hover:underline',
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', outline:
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80', 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
secondary:
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
}, },
}, },
}, },
@ -38,7 +41,11 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ asChild = false, className, size, variant, ...props }, ref) => { ({ asChild = false, className, size, variant, ...props }, ref) => {
const Comp = asChild ? Slot : 'button'; const Comp = asChild ? Slot : 'button';
return ( return (
<Comp className={cn(buttonVariants({ className, size, variant }))} ref={ref} {...props} /> <Comp
className={cn(buttonVariants({ className, size, variant }))}
ref={ref}
{...props}
/>
); );
}, },
); );

64
pnpm-lock.yaml generated
View File

@ -6,63 +6,9 @@ settings:
catalogs: catalogs:
default: default:
'@types/node':
specifier: ^20
version: 20.17.8
'@types/react':
specifier: ^18.3.1
version: 18.3.1
'@types/react-dom':
specifier: ^18.3.1
version: 18.3.1
'@vchikalkin/eslint-config-awesome':
specifier: ^2.0.4
version: 2.0.4
autoprefixer:
specifier: ^10.4.20
version: 10.4.20
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
clsx:
specifier: ^2.1.1
version: 2.1.1
eslint:
specifier: ^9.15.0
version: 9.15.0
eslint-plugin-tailwindcss:
specifier: ^3.17.5
version: 3.17.5
eslint-plugin-turbo:
specifier: ^2.3.0
version: 2.3.2
lucide-react:
specifier: ^0.462.0
version: 0.462.0
next:
specifier: ^15.0.3
version: 15.0.3
postcss:
specifier: ^8.4.49
version: 8.4.49
prettier: prettier:
specifier: ^3.2.5 specifier: ^3.2.5
version: 3.4.0 version: 3.4.0
react:
specifier: 19.0.0-rc-5c56b873-20241107
version: 19.0.0-rc-5c56b873-20241107
react-dom:
specifier: 19.0.0-rc-5c56b873-20241107
version: 19.0.0-rc-5c56b873-20241107
tailwind-merge:
specifier: ^2.5.5
version: 2.5.5
tailwindcss:
specifier: ^3.4.15
version: 3.4.15
tailwindcss-animate:
specifier: ^1.0.7
version: 1.0.7
turbo: turbo:
specifier: ^2.3.2 specifier: ^2.3.2
version: 2.3.2 version: 2.3.2
@ -74,6 +20,9 @@ importers:
.: .:
devDependencies: devDependencies:
husky:
specifier: ^9.1.7
version: 9.1.7
prettier: prettier:
specifier: 'catalog:' specifier: 'catalog:'
version: 3.4.0 version: 3.4.0
@ -2456,6 +2405,11 @@ packages:
hosted-git-info@2.8.9: hosted-git-info@2.8.9:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
ignore@5.3.2: ignore@5.3.2:
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
engines: {node: '>= 4'} engines: {node: '>= 4'}
@ -6649,6 +6603,8 @@ snapshots:
hosted-git-info@2.8.9: {} hosted-git-info@2.8.9: {}
husky@9.1.7: {}
ignore@5.3.2: {} ignore@5.3.2: {}
import-fresh@3.3.0: import-fresh@3.3.0: