diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..cf0c46b93 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no-install lint-staged diff --git a/package.json b/package.json index 7fdc3b05d..7dc0862e2 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "ci": "npm run tsc && npm run build && npm run lint && npm run test", "deploy": "npm run site:build && npm run site:deploy", "dev": "tsc --skipLibCheck packages/design/src/theme/index.ts --outDir ./.dumi/tmp/plugin-theme-less && cross-env UMI_ENV=theme dumi dev", - "prepare": "dumi setup", + "prepare": "husky install && dumi setup", "prepublishOnly": "npm run build", "publish": "lerna publish", "publish:from-package": "lerna publish from-package", @@ -30,11 +30,11 @@ "locale:remove-useless": "ts-node scripts/remove-useless-locale.ts" }, "lint-staged": { - "*.{js,jsx,less,md,json}": [ - "prettier --write" + "*.{js,jsx,ts,tsx}": [ + "eslint" ], - "*.ts?(x)": [ - "prettier --parser=typescript --write" + "*.{js,jsx,ts,tsx,less,md,json}": [ + "prettier --write" ] }, "devDependencies": { @@ -43,12 +43,12 @@ "@ant-design/icons": "^5.2.6", "@babel/cli": "^7.23.0", "@babel/preset-env": "^7.23.2", + "@chenshuai2144/less2cssinjs": "^1.0.7", "@ctrl/tinycolor": "^4.0.2", "@emotion/babel-preset-css-prop": "^11.11.0", "@emotion/css": "^11.11.2", "@emotion/react": "^11.11.1", "@emotion/server": "^11.11.0", - "@chenshuai2144/less2cssinjs": "^1.0.7", "@qixian.cs/github-contributors-list": "^1.1.0", "@stackblitz/sdk": "^1.9.0", "@testing-library/dom": "^9.3.3", @@ -78,6 +78,7 @@ "fs-extra": "^11.1.1", "gh-pages": "^6.0.0", "html2sketch": "^1.0.2", + "husky": "^8.0.3", "identity-obj-proxy": "^3.0.0", "jest": "^29.7.0", "jest-canvas-mock": "^2.5.2", @@ -116,8 +117,5 @@ "yorkie": "^2.0.0" }, "packageManager": "pnpm@8.6.0", - "gitHooks": { - "pre-commit": "lint-staged" - }, "repository": "git@github.com:oceanbase/oceanbase-design.git" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3e5483410..aaa8992c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,6 +128,9 @@ importers: html2sketch: specifier: ^1.0.2 version: 1.0.2 + husky: + specifier: ^8.0.3 + version: 8.0.3 identity-obj-proxy: specifier: ^3.0.0 version: 3.0.0 @@ -13516,6 +13519,12 @@ packages: resolution: {integrity: sha512-E0eIbrFWUhwfXJmsbdjRQFQPrl5pTEoKlz163j1mTqqUnU9PgR4AgB8AIITzuB3vLBdxZXyZ9TDIrwB2OASz4g==} dev: true + /husky@8.0.3: + resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /hyphenate-style-name@1.0.4: resolution: {integrity: sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==} dev: false