From 4f77a18b2a0dbc9041de936b20c894a22a436ba4 Mon Sep 17 00:00:00 2001 From: PY Date: Mon, 13 Dec 2021 11:44:18 +0800 Subject: [PATCH] chore: globalconfig edit (#25) * chore: globalconfig edit * chore: mv stylelint-config-prettier to devdep * feat: add vscode config * fix: lint fix * feat: update base url --- .gitignore | 2 -- .husky/commit-msg | 4 +++ .husky/pre-commit | 4 +++ .vscode/extensions.json | 3 +++ .vscode/settings.json | 24 ++++++++++++++++++ cache.dockerfile | 2 +- package.json | 27 ++++++++------------ src/pages/login/components/Login.vue | 6 ++--- src/pages/login/index.less | 1 + src/store/modules/user.ts | 37 ++++++++++++++-------------- stylelint.config.js | 13 ++-------- vite.config.ts | 1 + 12 files changed, 72 insertions(+), 52 deletions(-) create mode 100755 .husky/commit-msg create mode 100755 .husky/pre-commit create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 1dd38d3..15aeac6 100755 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ node_modules -.vscode .DS_Store -.vscode # build files es/ diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..ccfec39 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint -e $GIT_PARAMS \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..c37466e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..940260d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["dbaeumer.vscode-eslint"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a6a2fd5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,24 @@ +{ + "eslint.format.enable": true, + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"], + "[vue]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, + "[typescriptreact]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, + "[javascriptreact]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, + "[typescript]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, + "[javascript]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + } +} diff --git a/cache.dockerfile b/cache.dockerfile index 5e0cae1..955908e 100644 --- a/cache.dockerfile +++ b/cache.dockerfile @@ -1,5 +1,5 @@ # 选择一个 Base 镜像 -FROM node:12 +FROM node:14 # 设置工作目录 WORKDIR /space diff --git a/package.json b/package.json index a68e2cb..36addc9 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "lint": "eslint --ext .vue,.js,.jsx,.ts,.tsx ./ --max-warnings 0", "lint:fix": "eslint --ext .vue,.js,jsx,.ts,.tsx ./ --max-warnings 0 --fix", "stylelint": "stylelint src/**/*.{html,vue,sass,less}", - "stylelint:fix": "stylelint --cache --fix src/**/*.{html,vue,vss,sass,less}" + "stylelint:fix": "stylelint --fix src/**/*.{html,vue,vss,sass,less}", + "prepare": "husky install" }, "dependencies": { "dayjs": "^1.10.6", @@ -25,7 +26,7 @@ }, "devDependencies": { "@commitlint/cli": "^15.0.0", - "@commitlint/config-conventional": "^13.1.0", + "@commitlint/config-conventional": "^15.0.0", "@types/echarts": "^4.9.10", "@types/ws": "^8.2.2", "@typescript-eslint/eslint-plugin": "^4.29.3", @@ -42,20 +43,19 @@ "eslint-plugin-import": "^2.24.2", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-vue": "^8.2.0", - "http-proxy-agent": "^4.0.1", + "http-proxy-agent": "^5.0.0", "husky": "^7.0.4", "less": "^4.1.1", + "lint-staged": "^12.1.2", "mockjs": "^1.1.0", - "postcss-less": "^5.0.0", "prettier": "^2.4.1", - "stylelint": "^14.1.0", - "stylelint-config-standard": "^24.0.0", + "stylelint": "^13.13.1", + "stylelint-config-prettier": "^9.0.3", + "stylelint-less": "^1.0.1", "stylelint-order": "^4.1.0", - "stylelint-scss": "^4.0.0", "typescript": "^4.4.3", "vite": "^2.7.1", "vite-plugin-mock": "^2.9.6", - "vite-plugin-svg-sprite-component": "^1.0.10", "vite-svg-loader": "^3.1.0", "vue-clipboard3": "^1.0.1", "vue-tsc": "^0.29.8" @@ -65,22 +65,15 @@ "path": "./node_modules/cz-conventional-changelog" } }, - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true", - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } - }, "lint-staged": { "*.{js,jsx,vue,ts,tsx}": [ "prettier --write", "npm run lint:fix", - "git add" + "git add ." ], "*.{html,vue,vss,sass,less}": [ "npm run stylelint:fix", - "git add" + "git add ." ] } } diff --git a/src/pages/login/components/Login.vue b/src/pages/login/components/Login.vue index be5a154..d85c7cb 100644 --- a/src/pages/login/components/Login.vue +++ b/src/pages/login/components/Login.vue @@ -9,7 +9,7 @@ >