chore: add pre commit hook (#479)

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/494/head
Ryan Wang 3 years ago committed by GitHub
parent 020db1422e
commit 9cf97b9d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,24 +2,20 @@
require("@rushstack/eslint-patch/modern-module-resolution"); require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = { module.exports = {
"root": true, root: true,
"extends": [ extends: [
"plugin:vue/vue3-essential", "plugin:vue/vue3-essential",
"eslint:recommended", "eslint:recommended",
"@vue/eslint-config-typescript/recommended", "@vue/eslint-config-typescript/recommended",
"@vue/eslint-config-prettier" "@vue/eslint-config-prettier",
], ],
"env": { env: {
"vue/setup-compiler-macros": true "vue/setup-compiler-macros": true,
}, },
"overrides": [ overrides: [
{ {
"files": [ files: ["cypress/integration/**.spec.{js,ts,jsx,tsx}"],
"cypress/integration/**.spec.{js,ts,jsx,tsx}" extends: ["plugin:cypress/recommended"],
], },
"extends": [ ],
"plugin:cypress/recommended"
]
}
]
}; };

@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
pnpm test:unit
pnpm typecheck
pnpm lint

@ -2,10 +2,11 @@
"name": "halo-admin-next", "name": "halo-admin-next",
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"prepare": "husky install",
"dev": "vite", "dev": "vite",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
"preview": "vite preview --port 5050", "preview": "vite preview --port 5050",
"test:unit": "vitest --environment jsdom", "test:unit": "vitest --environment jsdom --run",
"test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'", "test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'",
"test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'", "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'",
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false", "typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
@ -30,6 +31,7 @@
"eslint": "^8.5.0", "eslint": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1", "eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-vue": "^8.2.0", "eslint-plugin-vue": "^8.2.0",
"husky": "^7.0.4",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"start-server-and-test": "^1.14.0", "start-server-and-test": "^1.14.0",

@ -14,6 +14,7 @@ specifiers:
eslint: ^8.5.0 eslint: ^8.5.0
eslint-plugin-cypress: ^2.12.1 eslint-plugin-cypress: ^2.12.1
eslint-plugin-vue: ^8.2.0 eslint-plugin-vue: ^8.2.0
husky: ^7.0.4
jsdom: ^19.0.0 jsdom: ^19.0.0
pinia: ^2.0.11 pinia: ^2.0.11
prettier: ^2.5.1 prettier: ^2.5.1
@ -44,6 +45,7 @@ devDependencies:
eslint: 8.10.0 eslint: 8.10.0
eslint-plugin-cypress: 2.12.1_eslint@8.10.0 eslint-plugin-cypress: 2.12.1_eslint@8.10.0
eslint-plugin-vue: 8.5.0_eslint@8.10.0 eslint-plugin-vue: 8.5.0_eslint@8.10.0
husky: 7.0.4
jsdom: 19.0.0 jsdom: 19.0.0
prettier: 2.5.1 prettier: 2.5.1
start-server-and-test: 1.14.0 start-server-and-test: 1.14.0
@ -2427,6 +2429,12 @@ packages:
engines: {node: '>=10.17.0'} engines: {node: '>=10.17.0'}
dev: true dev: true
/husky/7.0.4:
resolution: {integrity: sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==}
engines: {node: '>=12'}
hasBin: true
dev: true
/iconv-lite/0.6.3: /iconv-lite/0.6.3:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}

Loading…
Cancel
Save