From 5bfac6001bbb8fddeda76af2c6f05a2f27b0341b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 2 Apr 2024 10:54:41 +0100 Subject: [PATCH] add husky --- .husky/pre-commit | 1 + package-lock.json | 32 ++++++++++++++++++++++++++++++++ package.json | 15 ++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..2312dc5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/package-lock.json b/package-lock.json index 65a05cc..50608ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,8 @@ "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.1.4", + "husky": "^9.0.11", + "prettier": "^3.2.5", "typescript": "^5" } }, @@ -2396,6 +2398,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/husky": { + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", + "dev": true, + "bin": { + "husky": "bin.mjs" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -4094,6 +4111,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", diff --git a/package.json b/package.json index f192a30..d3673ea 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "dev": "next dev --turbo", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "typecheck": "tsc --noEmit", + "prepare": "husky" }, "dependencies": { "@coingecko/cryptoformat": "^0.8.1", @@ -24,6 +26,17 @@ "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.1.4", + "husky": "^9.0.11", + "prettier": "^3.2.5", "typescript": "^5" + }, + "lint-staged": { + "*.{ts,mjs}": [ + "prettier --write", + "eslint" + ], + "**/*.{json,yml,md}": [ + "prettier --write" + ] } }